Browse code

Added per-second dings to time example.

Andrew Alderwick authored on 02/04/2021 15:05:29
Showing 1 changed files
... ...
@@ -11,12 +11,14 @@
11 11
 ;needles { hx 2 hy 2 mx 2 my 2 sx 2 sy 2 }
12 12
 ;line { x0 2 y0 2 x 2 y 2 sx 2 sy 2 dx 2 dy 2 e1 2 e2 2 }
13 13
 ;color { byte 1 }
14
+;ding { volume 1 }
14 15
 
15 16
 ( devices )
16 17
 
17 18
 |0100 ;Console { pad 8 char 1 byte 1 short 2 }
18 19
 |0110 ;Screen { width 2 height 2 pad 4 x 2 y 2 color 1 }
19 20
 |0120 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
21
+|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 }
20 22
 |0190 ;Time { year 2 month 1 day 1 hour 1 minute 1 second 1 dow 1 doy 2 isdst 1 get 1 }
21 23
 |01F0 ;System { pad 8 r 2 g 2 b 2 }
22 24
 
... ...
@@ -36,12 +38,21 @@ BRK
36 38
 
37 39
 @FRAME
38 40
 	
41
+	~ding.volume
42
+	DUP #00 EQU ^$keep JNZ
43
+	DUP #04 SUB =ding.volume
44
+	$keep
45
+	=Audio.ch1vol
46
+
39 47
 	#00 =Time.get
40 48
 
41 49
 	( only draw once per second )
42 50
 	~Time.second ~current.second NEQ #01 JNZ BRK
43 51
 	~Time.second =current.second
44 52
 
53
+	~Time.second #1d ADD =Audio.ch1pitch
54
+	#fc =ding.volume
55
+
45 56
 	( clear )
46 57
 	#0080 SCALEX #0080 SCALEY ~needles.sx ~needles.sy #00 ,draw-line JSR2
47 58
 	#0080 SCALEX #0080 SCALEY ~needles.mx ~needles.my #00 ,draw-line JSR2