Added per-second dings to time example.

This commit is contained in:
Andrew Alderwick 2021-04-02 16:05:29 +01:00
parent 09091275b5
commit 8a8960debe
1 changed files with 11 additions and 0 deletions

View File

@ -11,12 +11,14 @@
;needles { hx 2 hy 2 mx 2 my 2 sx 2 sy 2 } ;needles { hx 2 hy 2 mx 2 my 2 sx 2 sy 2 }
;line { x0 2 y0 2 x 2 y 2 sx 2 sy 2 dx 2 dy 2 e1 2 e2 2 } ;line { x0 2 y0 2 x 2 y 2 sx 2 sy 2 dx 2 dy 2 e1 2 e2 2 }
;color { byte 1 } ;color { byte 1 }
;ding { volume 1 }
( devices ) ( devices )
|0100 ;Console { pad 8 char 1 byte 1 short 2 } |0100 ;Console { pad 8 char 1 byte 1 short 2 }
|0110 ;Screen { width 2 height 2 pad 4 x 2 y 2 color 1 } |0110 ;Screen { width 2 height 2 pad 4 x 2 y 2 color 1 }
|0120 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 } |0120 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
|0170 ;Audio { ch1asdr 2 ch2asdr 2 ch3asdr 2 ch4asdr 2 ch1pitch 1 ch1vol 1 ch2pitch 1 ch2vol 1 ch3pitch 1 ch3vol 1 ch4pitch 1 ch4vol 1 }
|0190 ;Time { year 2 month 1 day 1 hour 1 minute 1 second 1 dow 1 doy 2 isdst 1 get 1 } |0190 ;Time { year 2 month 1 day 1 hour 1 minute 1 second 1 dow 1 doy 2 isdst 1 get 1 }
|01F0 ;System { pad 8 r 2 g 2 b 2 } |01F0 ;System { pad 8 r 2 g 2 b 2 }
@ -36,12 +38,21 @@ BRK
@FRAME @FRAME
~ding.volume
DUP #00 EQU ^$keep JNZ
DUP #04 SUB =ding.volume
$keep
=Audio.ch1vol
#00 =Time.get #00 =Time.get
( only draw once per second ) ( only draw once per second )
~Time.second ~current.second NEQ #01 JNZ BRK ~Time.second ~current.second NEQ #01 JNZ BRK
~Time.second =current.second ~Time.second =current.second
~Time.second #1d ADD =Audio.ch1pitch
#fc =ding.volume
( clear ) ( clear )
#0080 SCALEX #0080 SCALEY ~needles.sx ~needles.sy #00 ,draw-line JSR2 #0080 SCALEX #0080 SCALEY ~needles.sx ~needles.sy #00 ,draw-line JSR2
#0080 SCALEX #0080 SCALEY ~needles.mx ~needles.my #00 ,draw-line JSR2 #0080 SCALEX #0080 SCALEY ~needles.mx ~needles.my #00 ,draw-line JSR2