Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
70
Task/Sleep/Action-/sleep.action
Normal file
70
Task/Sleep/Action-/sleep.action
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
BYTE RTCLOK1=$13
|
||||
BYTE RTCLOK2=$14
|
||||
BYTE PALNTSC=$D014
|
||||
|
||||
PROC Wait(CARD frames)
|
||||
BYTE lsb=frames,msb=frames+1
|
||||
|
||||
;wait lsb of frames
|
||||
lsb==+RTCLOK2
|
||||
WHILE lsb#RTCLOK2 DO OD
|
||||
|
||||
;wait msb of 256*frames
|
||||
WHILE msb>0
|
||||
DO
|
||||
WHILE lsb=RTCLOK2 DO OD
|
||||
WHILE lsb#RTCLOK2 DO OD
|
||||
msb==-1
|
||||
OD
|
||||
RETURN
|
||||
|
||||
CARD FUNC GetFrame()
|
||||
CARD res
|
||||
BYTE lsb=res,msb=res+1
|
||||
|
||||
lsb=RTCLOK2
|
||||
msb=RTCLOK1
|
||||
RETURN (res)
|
||||
|
||||
CARD FUNC MsToFrames(CARD ms)
|
||||
CARD res
|
||||
|
||||
IF PALNTSC=15 THEN
|
||||
res=ms/60
|
||||
ELSE
|
||||
res=ms/50
|
||||
FI
|
||||
RETURN (res)
|
||||
|
||||
CARD FUNC FramesToMs(CARD frames)
|
||||
CARD res
|
||||
|
||||
IF PALNTSC=15 THEN
|
||||
res=frames*60
|
||||
ELSE
|
||||
res=frames*50
|
||||
FI
|
||||
RETURN (res)
|
||||
|
||||
PROC Main()
|
||||
CARD ARRAY data=[1 5 10 50 100 500]
|
||||
CARD beg,end,diff,diffMs,delay,delayMs
|
||||
BYTE i
|
||||
|
||||
FOR i=0 TO 5
|
||||
DO
|
||||
delay=data(i)
|
||||
delayMs=FramesToMs(delay)
|
||||
PrintF("Wait %U frames / %U ms...%E",delay,delayMs)
|
||||
|
||||
beg=GetFrame()
|
||||
Wait(delay)
|
||||
end=GetFrame()
|
||||
diff=end-beg
|
||||
diffMs=FramesToMs(diff)
|
||||
|
||||
PrintF("Frame number at begin %U%E",beg)
|
||||
PrintF("Frame number at end %U%E",end)
|
||||
PrintF("Waited %U-%U=%U frames / %U ms%E%E",end,beg,diff,diffMs)
|
||||
OD
|
||||
RETURN
|
||||
Loading…
Add table
Add a link
Reference in a new issue