My STOS conversion for seconds...
What I do is "bit test" bit 0, if its 1 then add one to S. If bit 1 is set, then add 2 to s, if bit 3 is set add 8 to s... and so on.
I've had it debugging to the screen and seems to work. So we are now counting in seconds 0-59 correctly
Code: Select all
10 dim A(200)
20 for A=0 to 120
30 doke ($FF8960),0
40 ZZ=deek($FF8962)
50 Z$=str$(ZZ) : AA$=Z$
60 S=0
70 if btst(0,ZZ) then S=S+1
80 if btst(1,ZZ) then S=S+2
90 if btst(2,ZZ) then S=S+4
100 if btst(3,ZZ) then S=S+8
110 if btst(4,ZZ) then S=S+10
120 if btst(5,ZZ) then S=S+20
130 if btst(6,ZZ) then S=S+40
140 print A,bin$(ZZ),S
150 A(A)=ZZ
160 while Z$=AA$
170 doke ($FF8960),0
180 AA$=str$(deek($FF8962))
190 wend
200 next A
210 open out #1,"output.txt"
220 for A=0 to 120
230 print #1,A,bin$(A(A))
240 next A
250 close #1
EDIT:
Now I just noticed the second table in the datasheet where seconds and minutes can be read as binary