12 | 14 |
deleted file mode 100644 |
... | ... |
@@ -1,659 +0,0 @@ |
1 |
-( mini music tracker ) |
|
2 |
- |
|
3 |
-%RTN { JMP2r } |
|
4 |
-%8++ { #0008 ADD2 } %8-- { #0008 SUB2 } |
|
5 |
-%8** { #30 SFT2 } %8// { #03 SFT2 } |
|
6 |
-%++ { #0001 ADD2 } %2// { #01 SFT2 } |
|
7 |
-%MOD8 { #07 AND } |
|
8 |
-%TRACK { ;track/ch1 #00 .track/active LDZ #50 SFT2 ADD2 } |
|
9 |
- |
|
10 |
-( variables ) |
|
11 |
- |
|
12 |
-@pointer [ &x $2 &y $2 ] |
|
13 |
-@color [ &byte $1 ] |
|
14 |
-@rect [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ] |
|
15 |
-@trkframe [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ] |
|
16 |
-@chnframe [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ] |
|
17 |
-@ctlframe [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ] |
|
18 |
-@label [ &x $2 &y $2 &color $1 &addr $2 ] |
|
19 |
-@knob [ &x $2 &y $2 &value $1 ] |
|
20 |
-@head [ &pos $1 ] |
|
21 |
-@track [ &active $1 &ch1 $20 &ch2 $20 &ch3 $20 &ch4 $20 ] |
|
22 |
- |
|
23 |
-( devices ) |
|
24 |
- |
|
25 |
-|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ] |
|
26 |
-|10 @Console [ &vector $2 &read $1 &pad $5 &write $1 &error $1 ] |
|
27 |
-|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ] |
|
28 |
-|30 @Audio0 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &len $2 &addr $2 &volume $1 &pitch $1 ] |
|
29 |
-|40 @Audio1 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &len $2 &addr $2 &volume $1 &pitch $1 ] |
|
30 |
-|50 @Audio2 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &len $2 &addr $2 &volume $1 &pitch $1 ] |
|
31 |
-|60 @Audio3 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &len $2 &addr $2 &volume $1 &pitch $1 ] |
|
32 |
-|80 @Controller [ &vector $2 &button $1 &key $1 ] |
|
33 |
-|90 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &wheel $1 ] |
|
34 |
-|a0 @File [ &vector $2 &success $2 &offset $2 &pad $2 &name $2 &length $2 &load $2 &save $2 ] |
|
35 |
- |
|
36 |
-( vectors ) |
|
37 |
- |
|
38 |
-|0100 |
|
39 |
- @noise-wave |
|
40 |
- |
|
41 |
- ( theme ) #e0fa .System/r DEO2 #30fa .System/g DEO2 #30fa .System/b DEO2 |
|
42 |
- ( vectors ) ;on-screen .Screen/vector DEO2 |
|
43 |
- ( vectors ) ;on-mouse .Mouse/vector DEO2 |
|
44 |
- ( vectors ) ;on-button .Controller/vector DEO2 |
|
45 |
- |
|
46 |
- .Screen/width DEI2 2// DUP2 #0080 SUB2 .trkframe/x1 STZ2 |
|
47 |
- #0080 ADD2 .trkframe/x2 STZ2 |
|
48 |
- .Screen/height DEI2 2// DUP2 #0038 SUB2 #0010 SUB2 .trkframe/y1 STZ2 |
|
49 |
- #0038 ADD2 #0010 SUB2 .trkframe/y2 STZ2 |
|
50 |
- |
|
51 |
- .trkframe/x1 LDZ2 .chnframe/x1 STZ2 .trkframe/y2 LDZ2 .chnframe/y1 STZ2 |
|
52 |
- .chnframe/x1 LDZ2 #0030 ADD2 .chnframe/x2 STZ2 .chnframe/y1 LDZ2 #0030 ADD2 .chnframe/y2 STZ2 |
|
53 |
- |
|
54 |
- .chnframe/x2 LDZ2 .ctlframe/x1 STZ2 .chnframe/y1 LDZ2 .ctlframe/y1 STZ2 |
|
55 |
- .trkframe/x2 LDZ2 .ctlframe/x2 STZ2 .chnframe/y2 LDZ2 .ctlframe/y2 STZ2 |
|
56 |
- |
|
57 |
- ( default settings ) |
|
58 |
- #048c .Audio0/adsr DEO2 #88 .Audio0/volume DEO |
|
59 |
- #159d .Audio1/adsr DEO2 #88 .Audio1/volume DEO |
|
60 |
- #26ae .Audio2/adsr DEO2 #88 .Audio2/volume DEO |
|
61 |
- #0000 .Audio3/adsr DEO2 #88 .Audio3/volume DEO |
|
62 |
- |
|
63 |
- ;square-wave .Audio0/addr DEO2 |
|
64 |
- ;square-wave/end ;square-wave SUB2 .Audio0/len DEO2 |
|
65 |
- ;on-square-done .Audio0/vector DEO2 |
|
66 |
- ;triangle-wave .Audio1/addr DEO2 |
|
67 |
- ;triangle-wave/end ;triangle-wave SUB2 .Audio1/len DEO2 |
|
68 |
- ;on-triangle-done .Audio1/vector DEO2 |
|
69 |
- ;sine-wave .Audio2/addr DEO2 |
|
70 |
- ;sine-wave/end ;sine-wave SUB2 .Audio2/len DEO2 |
|
71 |
- ;on-sine-done .Audio2/vector DEO2 |
|
72 |
- ;noise-wave .Audio3/addr DEO2 |
|
73 |
- ;noise-wave-end ;noise-wave SUB2 .Audio3/len DEO2 |
|
74 |
- ;on-noise-done .Audio3/vector DEO2 |
|
75 |
- |
|
76 |
- ;draw-timeline JSR2 |
|
77 |
- ;draw-controls JSR2 |
|
78 |
- ;draw-channels JSR2 |
|
79 |
- |
|
80 |
-BRK |
|
81 |
- |
|
82 |
-@on-screen ( -> ) |
|
83 |
- |
|
84 |
- ;move-head JSR2 |
|
85 |
- ;draw-vu JSR2 |
|
86 |
- .head/pos LDZ MOD8 ,&skip JCN |
|
87 |
- ;bang JSR2 |
|
88 |
- &skip |
|
89 |
- |
|
90 |
-BRK |
|
91 |
- |
|
92 |
-@on-mouse ( -> ) |
|
93 |
- |
|
94 |
- .Mouse/state DEI #00 EQU ;&click-end JCN2 |
|
95 |
- .Mouse/x DEI2 .trkframe/x1 LDZ2 GTH2 .Mouse/x DEI2 .trkframe/x2 LDZ2 LTH2 #0101 EQU2 |
|
96 |
- .Mouse/y DEI2 .trkframe/y1 LDZ2 GTH2 .Mouse/y DEI2 .trkframe/y2 LDZ2 LTH2 #0101 EQU2 |
|
97 |
- #0101 EQU2 ;touch-trk JCN2 |
|
98 |
- .Mouse/x DEI2 .chnframe/x1 LDZ2 GTH2 .Mouse/x DEI2 .chnframe/x2 LDZ2 LTH2 #0101 EQU2 |
|
99 |
- .Mouse/y DEI2 .chnframe/y1 LDZ2 8++ GTH2 .Mouse/y DEI2 .chnframe/y2 LDZ2 8-- LTH2 #0101 EQU2 |
|
100 |
- #0101 EQU2 ;touch-chn JCN2 |
|
101 |
- .Mouse/x DEI2 .ctlframe/x1 LDZ2 GTH2 .Mouse/x DEI2 .ctlframe/x2 LDZ2 LTH2 #0101 EQU2 |
|
102 |
- .Mouse/y DEI2 .ctlframe/y1 LDZ2 8++ GTH2 .Mouse/y DEI2 .ctlframe/y2 LDZ2 8-- LTH2 #0101 EQU2 |
|
103 |
- #0101 EQU2 ;touch-ctl JCN2 |
|
104 |
- &click-end |
|
105 |
- |
|
106 |
- ;draw-cursor JSR2 |
|
107 |
- |
|
108 |
-BRK |
|
109 |
- |
|
110 |
-@on-button ( -> ) |
|
111 |
- |
|
112 |
- .Controller/key DEI |
|
113 |
- DUP #61 NEQ ,&no-c JCN |
|
114 |
- ;notes LDA ;play JSR2 &no-c |
|
115 |
- DUP #73 NEQ ,&no-d JCN |
|
116 |
- ;notes #0001 ADD2 LDA ;play JSR2 &no-d |
|
117 |
- DUP #64 NEQ ,&no-e JCN |
|
118 |
- ;notes #0002 ADD2 LDA ;play JSR2 &no-e |
|
119 |
- DUP #66 NEQ ,&no-f JCN |
|
120 |
- ;notes #0003 ADD2 LDA ;play JSR2 &no-f |
|
121 |
- DUP #67 NEQ ,&no-g JCN |
|
122 |
- ;notes #0004 ADD2 LDA ;play JSR2 &no-g |
|
123 |
- DUP #68 NEQ ,&no-a JCN |
|
124 |
- ;notes #0005 ADD2 LDA ;play JSR2 &no-a |
|
125 |
- DUP #6a NEQ ,&no-b JCN |
|
126 |
- ;notes #0006 ADD2 LDA ;play JSR2 &no-b |
|
127 |
- DUP #6b NEQ ,&no-c2 JCN |
|
128 |
- ;notes #0007 ADD2 LDA ;play JSR2 &no-c2 |
|
129 |
- POP |
|
130 |
- |
|
131 |
-BRK |
|
132 |
- |
|
133 |
-@on-square-done ( -> ) |
|
134 |
- LIT '0 .Console/write DEO |
|
135 |
- BRK |
|
136 |
- |
|
137 |
-@on-triangle-done ( -> ) |
|
138 |
- LIT '1 .Console/write DEO |
|
139 |
- BRK |
|
140 |
- |
|
141 |
-@on-sine-done ( -> ) |
|
142 |
- LIT '2 .Console/write DEO |
|
143 |
- BRK |
|
144 |
- |
|
145 |
-@on-noise-done ( -> ) |
|
146 |
- LIT '3 .Console/write DEO |
|
147 |
- BRK |
|
148 |
- |
|
149 |
-@play ( pitch -- ) |
|
150 |
- |
|
151 |
- .Audio0/pitch DEO |
|
152 |
- |
|
153 |
-RTN |
|
154 |
- |
|
155 |
-@touch-trk ( -- ) |
|
156 |
- |
|
157 |
- ;clear-notes JSR2 |
|
158 |
- ( get note ) |
|
159 |
- #0e .Mouse/y DEI2 .trkframe/y1 LDZ2 SUB2 NIP #08 DIV SUB |
|
160 |
- .Mouse/state DEI #10 NEQ ,&no-erase JCN POP #00 &no-erase |
|
161 |
- ( edit note ) |
|
162 |
- TRACK #00 .Mouse/x DEI2 .trkframe/x1 LDZ2 SUB2 NIP #08 DIV ADD2 STA |
|
163 |
- ( release ) #00 .Mouse/state DEO |
|
164 |
- ;draw-notes JSR2 |
|
165 |
- |
|
166 |
-BRK |
|
167 |
- |
|
168 |
-@touch-chn ( -- ) |
|
169 |
- |
|
170 |
- ;clear-notes JSR2 |
|
171 |
- ( save ) .Mouse/y DEI2 .chnframe/y1 LDZ2 SUB2 NIP #08 DIV #01 SUB .track/active STZ |
|
172 |
- ( release ) #00 .Mouse/state DEO |
|
173 |
- ;draw-channels JSR2 |
|
174 |
- ;draw-notes JSR2 |
|
175 |
- ;draw-controls JSR2 |
|
176 |
- |
|
177 |
-BRK |
|
178 |
- |
|
179 |
-@touch-ctl ( -- ) |
|
180 |
- |
|
181 |
- .Mouse/x DEI2 .ctlframe/x1 LDZ2 SUB2 8-- 8// NIP #02 DIV |
|
182 |
- DUP ,&no-a JCN |
|
183 |
- .Audio0/adsr .track/active LDZ #40 SFT ADD DEI |
|
184 |
- #10 .Mouse/state DEI #10 EQU #e0 MUL ADD ADD |
|
185 |
- .Audio0/adsr .track/active LDZ #40 SFT ADD DEO &no-a |
|
186 |
- DUP #01 NEQ ,&no-d JCN |
|
187 |
- .Audio0/adsr .track/active LDZ #40 SFT ADD DEI |
|
188 |
- DUP #f0 AND STH #01 .Mouse/state DEI #10 EQU #0e MUL ADD ADD #0f AND STHr ADD |
|
189 |
- .Audio0/adsr .track/active LDZ #40 SFT ADD DEO &no-d |
|
190 |
- DUP #02 NEQ ,&no-s JCN |
|
191 |
- .Audio0/adsr .track/active LDZ #40 SFT ADD #01 ADD DEI |
|
192 |
- #10 .Mouse/state DEI #10 EQU #e0 MUL ADD ADD |
|
193 |
- .Audio0/adsr .track/active LDZ #40 SFT ADD #01 ADD DEO &no-s |
|
194 |
- DUP #03 NEQ ,&no-r JCN |
|
195 |
- .Audio0/adsr .track/active LDZ #40 SFT ADD #01 ADD DEI |
|
196 |
- DUP #f0 AND STH #01 .Mouse/state DEI #10 EQU #0e MUL ADD ADD #0f AND STHr ADD |
|
197 |
- .Audio0/adsr .track/active LDZ #40 SFT ADD #01 ADD DEO &no-r |
|
198 |
- DUP #05 NEQ ,&no-left JCN |
|
199 |
- .Audio0/volume .track/active LDZ #40 SFT ADD DEI |
|
200 |
- #10 .Mouse/state DEI #10 EQU #e0 MUL ADD ADD |
|
201 |
- .Audio0/volume .track/active LDZ #40 SFT ADD DEO &no-left |
|
202 |
- DUP #06 NEQ ,&no-right JCN |
|
203 |
- .Audio0/volume .track/active LDZ #40 SFT ADD DEI |
|
204 |
- DUP #f0 AND STH #01 .Mouse/state DEI #10 EQU #0e MUL ADD ADD #0f AND STHr ADD |
|
205 |
- .Audio0/volume .track/active LDZ #40 SFT ADD DEO &no-right |
|
206 |
- POP |
|
207 |
- ( release ) #00 .Mouse/state DEO |
|
208 |
- ;draw-controls JSR2 |
|
209 |
- |
|
210 |
-BRK |
|
211 |
- |
|
212 |
-@bang ( -- ) |
|
213 |
- |
|
214 |
- ;track/ch1 #00 .head/pos LDZ #08 DIV ADD2 LDA |
|
215 |
- #01 SUB |
|
216 |
- DUP #ff NEQ ,&skip1 JCN |
|
217 |
- POP ,&listen2 JMP |
|
218 |
- &skip1 |
|
219 |
- #00 SWP ;notes ADD2 LDA .Audio0/pitch DEO |
|
220 |
- &listen2 |
|
221 |
- ;track/ch2 #00 .head/pos LDZ #08 DIV ADD2 LDA |
|
222 |
- #01 SUB |
|
223 |
- DUP #ff NEQ ,&skip2 JCN |
|
224 |
- POP ,&listen3 JMP |
|
225 |
- &skip2 |
|
226 |
- #00 SWP ;notes ADD2 LDA .Audio1/pitch DEO |
|
227 |
- &listen3 |
|
228 |
- ;track/ch3 #00 .head/pos LDZ #08 DIV ADD2 LDA |
|
229 |
- #01 SUB |
|
230 |
- DUP #ff NEQ ,&skip3 JCN |
|
231 |
- POP ,&listen4 JMP |
|
232 |
- &skip3 |
|
233 |
- #00 SWP ;notes ADD2 LDA .Audio2/pitch DEO |
|
234 |
- &listen4 |
|
235 |
- ;track/ch4 #00 .head/pos LDZ #08 DIV ADD2 LDA |
|
236 |
- #01 SUB |
|
237 |
- DUP #ff NEQ ,&skip4 JCN |
|
238 |
- POP ,&end JMP |
|
239 |
- &skip4 |
|
240 |
- #00 SWP ;notes ADD2 LDA #80 ORA .Audio3/pitch DEO |
|
241 |
- &end |
|
242 |
- |
|
243 |
-RTN |
|
244 |
- |
|
245 |
-@move-head ( -- ) |
|
246 |
- |
|
247 |
- ( clear ) |
|
248 |
- .trkframe/y1 LDZ2 8-- .Screen/y DEO2 |
|
249 |
- .trkframe/x1 LDZ2 #00 .head/pos LDZ ADD2 .Screen/x DEO2 |
|
250 |
- ;head_icn .Screen/addr DEO2 |
|
251 |
- #00 .Screen/sprite DEO |
|
252 |
- ( incr ) .head/pos LDZ #01 ADD .head/pos STZ |
|
253 |
- .trkframe/x1 LDZ2 #00 .head/pos LDZ ADD2 .Screen/x DEO2 |
|
254 |
- ;head_icn .Screen/addr DEO2 |
|
255 |
- #01 ( if note ) TRACK #00 .head/pos LDZ #08 DIV ADD2 LDA #00 NEQ ADD .Screen/sprite DEO |
|
256 |
- |
|
257 |
-RTN |
|
258 |
- |
|
259 |
-@clear-notes ( -- ) |
|
260 |
- |
|
261 |
- #00 #20 |
|
262 |
- &loop |
|
263 |
- ( load ) OVR #00 SWP TRACK ADD2 LDA |
|
264 |
- DUP STH #00 SWP #0e SWP SUB 8** .trkframe/y1 LDZ2 ADD2 .Screen/y DEO2 |
|
265 |
- OVR #00 SWP 8** .trkframe/x1 LDZ2 ADD2 .Screen/x DEO2 |
|
266 |
- STHr #00 EQU ,&skip JCN |
|
267 |
- #00 .Screen/sprite DEO |
|
268 |
- &skip |
|
269 |
- ( incr ) SWP #01 ADD SWP |
|
270 |
- DUP2 LTH ,&loop JCN |
|
271 |
- POP2 |
|
272 |
- |
|
273 |
-RTN |
|
274 |
- |
|
275 |
-@draw-notes ( -- ) |
|
276 |
- |
|
277 |
- #00 #20 |
|
278 |
- ¬es-loop |
|
279 |
- ( load ) OVR #00 SWP TRACK ADD2 LDA |
|
280 |
- DUP STH #00 SWP #0e SWP SUB 8** .trkframe/y1 LDZ2 ADD2 .Screen/y DEO2 |
|
281 |
- OVR #00 SWP 8** .trkframe/x1 LDZ2 ADD2 .Screen/x DEO2 |
|
282 |
- ;note_icn .Screen/addr DEO2 |
|
283 |
- STHr #00 EQU ,&skip JCN |
|
284 |
- #05 .Screen/sprite DEO |
|
285 |
- &skip |
|
286 |
- ( incr ) SWP #01 ADD SWP |
|
287 |
- DUP2 LTH ,¬es-loop JCN |
|
288 |
- POP2 |
|
289 |
- ;draw-bars JSR2 |
|
290 |
- |
|
291 |
-RTN |
|
292 |
- |
|
293 |
-@draw-bars ( -- ) |
|
294 |
- |
|
295 |
- .trkframe/x1 LDZ2 .trkframe/y1 LDZ2 .trkframe/x2 LDZ2 .trkframe/y2 LDZ2 #01 ;line-rect JSR2 |
|
296 |
- |
|
297 |
- ( grid ) |
|
298 |
- .trkframe/y1 LDZ2 #0010 SUB2 .Screen/y DEO2 |
|
299 |
- ;font_hex .Screen/addr DEO2 |
|
300 |
- #0000 #0100 |
|
301 |
- &loop |
|
302 |
- OVR2 NIP #02 DIV #0f AND ,&skip JCN |
|
303 |
- OVR2 .trkframe/x1 LDZ2 ADD2 .Screen/x DEO2 |
|
304 |
- .trkframe/y1 LDZ2 #0010 SUB2 .Screen/y DEO2 |
|
305 |
- #02 .Screen/sprite DEO |
|
306 |
- .Screen/addr DEI2 8++ .Screen/addr DEO2 |
|
307 |
- OVR2 .trkframe/x1 LDZ2 ADD2 .trkframe/y1 LDZ2 ++ .trkframe/y2 LDZ2 #01 ;line-vertical-dotted JSR2 |
|
308 |
- &skip |
|
309 |
- OVR2 .trkframe/x1 LDZ2 ADD2 .trkframe/y1 LDZ2 .trkframe/y2 LDZ2 #01 ;line-vertical-dotted JSR2 |
|
310 |
- SWP2 8++ SWP2 |
|
311 |
- OVR2 OVR2 LTH2 ,&loop JCN |
|
312 |
- POP2 |
|
313 |
- POP2 |
|
314 |
- |
|
315 |
- .trkframe/x1 LDZ2 .trkframe/x2 LDZ2 .trkframe/y1 LDZ2 8-- #0040 ADD2 #01 ;line-horizontal-dotted JSR2 |
|
316 |
- |
|
317 |
-RTN |
|
318 |
- |
|
319 |
-@draw-octave ( x y -- ) |
|
320 |
- |
|
321 |
- .Screen/y DEO2 |
|
322 |
- .Screen/x DEO2 |
|
323 |
- ;octave_icn .Screen/addr DEO2 |
|
324 |
- .Screen/y DEI2 .Screen/y DEI2 #0038 ADD2 |
|
325 |
- &loop |
|
326 |
- OVR2 .Screen/y DEO2 |
|
327 |
- #01 .Screen/sprite DEO |
|
328 |
- .Screen/addr DEI2 8++ .Screen/addr DEO2 |
|
329 |
- .Screen/x DEI2 8++ .Screen/x DEO2 |
|
330 |
- #01 .Screen/sprite DEO |
|
331 |
- .Screen/addr DEI2 8++ .Screen/addr DEO2 |
|
332 |
- .Screen/x DEI2 8-- .Screen/x DEO2 |
|
333 |
- SWP2 8++ SWP2 |
|
334 |
- OVR2 OVR2 LTH2 ,&loop JCN |
|
335 |
- POP2 |
|
336 |
- POP2 |
|
337 |
- |
|
338 |
-RTN |
|
339 |
- |
|
340 |
-@draw-octaves ( -- ) |
|
341 |
- |
|
342 |
- .trkframe/x1 LDZ2 #0018 SUB2 DUP2 .trkframe/y1 LDZ2 ;draw-octave JSR2 |
|
343 |
- .trkframe/y1 LDZ2 #0038 ADD2 ;draw-octave JSR2 |
|
344 |
- .trkframe/x1 LDZ2 #0028 SUB2 .Screen/x DEO2 |
|
345 |
- .trkframe/y1 LDZ2 #0030 ADD2 .Screen/y DEO2 |
|
346 |
- ;font_hex #0020 ADD2 .Screen/addr DEO2 |
|
347 |
- #03 .Screen/sprite DEO |
|
348 |
- .trkframe/x1 LDZ2 #0030 SUB2 .Screen/x DEO2 |
|
349 |
- ;font_hex #0060 ADD2 .Screen/addr DEO2 |
|
350 |
- #03 .Screen/sprite DEO |
|
351 |
- .trkframe/x1 LDZ2 #0028 SUB2 .Screen/x DEO2 |
|
352 |
- .trkframe/y1 LDZ2 #0068 ADD2 .Screen/y DEO2 |
|
353 |
- ;font_hex #0018 ADD2 .Screen/addr DEO2 |
|
354 |
- #03 .Screen/sprite DEO |
|
355 |
- .trkframe/x1 LDZ2 #0030 SUB2 .Screen/x DEO2 |
|
356 |
- ;font_hex #0060 ADD2 .Screen/addr DEO2 |
|
357 |
- #03 .Screen/sprite DEO |
|
358 |
- |
|
359 |
-RTN |
|
360 |
- |
|
361 |
-@draw-timeline ( -- ) |
|
362 |
- |
|
363 |
- ;draw-bars JSR2 |
|
364 |
- ;draw-octaves JSR2 |
|
365 |
- |
|
366 |
-RTN |
|
367 |
- |
|
368 |
-@draw-knob ( x* y* value -- ) |
|
369 |
- .track/active LDZ #03 EQU ;&blank JCN2 |
|
370 |
- |
|
371 |
- &force |
|
372 |
- ( load ) .knob/value STZ .knob/y STZ2 .knob/x STZ2 |
|
373 |
- |
|
374 |
- .knob/x LDZ2 .Screen/x DEO2 |
|
375 |
- .knob/y LDZ2 .Screen/y DEO2 ;knob_icns .Screen/addr DEO2 #01 .Screen/sprite DEO |
|
376 |
- .knob/x LDZ2 8++ .Screen/x DEO2 ;knob_icns 8++ .Screen/addr DEO2 #01 .Screen/sprite DEO |
|
377 |
- .knob/y LDZ2 8++ .Screen/y DEO2 ;knob_icns #0018 ADD2 .Screen/addr DEO2 #01 .Screen/sprite DEO |
|
378 |
- .knob/x LDZ2 .Screen/x DEO2 ;knob_icns #0010 ADD2 .Screen/addr DEO2 #01 .Screen/sprite DEO |
|
379 |
- .knob/x LDZ2 #00 #00 .knob/value LDZ ;knob_offsetx ADD2 LDA ADD2 .Screen/x DEO2 |
|
380 |
- .knob/y LDZ2 #00 #00 .knob/value LDZ ;knob_offsety ADD2 LDA ADD2 .Screen/y DEO2 |
|
381 |
- ;knob_icns #0020 ADD2 .Screen/addr DEO2 |
|
382 |
- #05 .Screen/sprite DEO |
|
383 |
- .knob/x LDZ2 #0004 ADD2 .Screen/x DEO2 |
|
384 |
- .knob/y LDZ2 #0010 ADD2 .Screen/y DEO2 |
|
385 |
- ;font_hex #00 .knob/value LDZ #30 SFT ADD2 .Screen/addr DEO2 |
|
386 |
- #01 .Screen/sprite DEO |
|
387 |
- |
|
388 |
-RTN |
|
389 |
- |
|
390 |
- &blank |
|
391 |
- |
|
392 |
- ( load ) .knob/value STZ .knob/y STZ2 .knob/x STZ2 |
|
393 |
- |
|
394 |
- .knob/x LDZ2 .Screen/x DEO2 |
|
395 |
- .knob/y LDZ2 .Screen/y DEO2 #00 .Screen/sprite DEO |
|
396 |
- .knob/x LDZ2 8++ .Screen/x DEO2 #00 .Screen/sprite DEO |
|
397 |
- .knob/y LDZ2 8++ .Screen/y DEO2 #00 .Screen/sprite DEO |
|
398 |
- .knob/x LDZ2 .Screen/x DEO2 #00 .Screen/sprite DEO |
|
399 |
- .knob/x LDZ2 #0004 ADD2 .Screen/x DEO2 |
|
400 |
- .knob/y LDZ2 #0010 ADD2 .Screen/y DEO2 |
|
401 |
- #00 .Screen/sprite DEO |
|
402 |
-RTN |
|
403 |
- |
|
404 |
-@draw-controls ( -- ) |
|
405 |
- |
|
406 |
- .ctlframe/x1 LDZ2 .ctlframe/y1 LDZ2 .ctlframe/x2 LDZ2 .ctlframe/y2 LDZ2 #01 ;line-rect JSR2 |
|
407 |
- ( env ) |
|
408 |
- .ctlframe/x1 LDZ2 8++ .ctlframe/y1 LDZ2 8++ #02 ;env_txt ;draw-label JSR2 |
|
409 |
- .ctlframe/x1 LDZ2 8++ .ctlframe/y1 LDZ2 #0010 ADD2 |
|
410 |
- .Audio0/adsr .track/active LDZ #40 SFT ADD DEI #04 SFT |
|
411 |
- ;draw-knob JSR2 |
|
412 |
- .ctlframe/x1 LDZ2 #0018 ADD2 .ctlframe/y1 LDZ2 #0010 ADD2 |
|
413 |
- .Audio0/adsr .track/active LDZ #40 SFT ADD DEI #0f AND |
|
414 |
- ;draw-knob JSR2 |
|
415 |
- .ctlframe/x1 LDZ2 #0028 ADD2 .ctlframe/y1 LDZ2 #0010 ADD2 |
|
416 |
- .Audio0/adsr .track/active LDZ #40 SFT ADD #01 ADD DEI #04 SFT |
|
417 |
- ;draw-knob JSR2 |
|
418 |
- .ctlframe/x1 LDZ2 #0038 ADD2 .ctlframe/y1 LDZ2 #0010 ADD2 |
|
419 |
- .Audio0/adsr .track/active LDZ #40 SFT ADD #01 ADD DEI #0f AND |
|
420 |
- ;draw-knob JSR2 |
|
421 |
- ( vol ) |
|
422 |
- .ctlframe/x1 LDZ2 #0058 ADD2 .ctlframe/y1 LDZ2 8++ #02 ;vol_txt ;draw-label JSR2 |
|
423 |
- .ctlframe/x1 LDZ2 #0058 ADD2 .ctlframe/y1 LDZ2 #0010 ADD2 |
|
424 |
- .Audio0/volume .track/active LDZ #40 SFT ADD DEI #04 SFT |
|
425 |
- ;draw-knob/force JSR2 |
|
426 |
- .ctlframe/x1 LDZ2 #0068 ADD2 .ctlframe/y1 LDZ2 #0010 ADD2 |
|
427 |
- .Audio0/volume .track/active LDZ #40 SFT ADD DEI #0f AND |
|
428 |
- ;draw-knob/force JSR2 |
|
429 |
- |
|
430 |
-RTN |
|
431 |
- |
|
432 |
-@draw-vu ( -- ) |
|
433 |
- .ctlframe/x1 LDZ2 #0088 ADD2 .ctlframe/y1 LDZ2 #0010 ADD2 |
|
434 |
- .Audio0/output .track/active LDZ #40 SFT ADD DEI DUP STH #04 SFT |
|
435 |
- ;draw-knob/force JSR2 |
|
436 |
- .ctlframe/x1 LDZ2 #0098 ADD2 .ctlframe/y1 LDZ2 #0010 ADD2 |
|
437 |
- STHr #0f AND |
|
438 |
- ;draw-knob/force JSR2 |
|
439 |
- |
|
440 |
-RTN |
|
441 |
- |
|
442 |
-@draw-channels |
|
443 |
- |
|
444 |
- .chnframe/x1 LDZ2 .chnframe/y1 LDZ2 .chnframe/x2 LDZ2 .chnframe/y2 LDZ2 #01 ;line-rect JSR2 |
|
445 |
- .chnframe/x1 LDZ2 8++ .chnframe/y1 LDZ2 8++ #01 .track/active LDZ #00 EQU #07 MUL ADD ;ch1_txt ;draw-label JSR2 |
|
446 |
- .chnframe/x1 LDZ2 8++ .chnframe/y1 LDZ2 #0010 ADD2 #01 .track/active LDZ #01 EQU #07 MUL ADD ;ch2_txt ;draw-label JSR2 |
|
447 |
- .chnframe/x1 LDZ2 8++ .chnframe/y1 LDZ2 #0018 ADD2 #01 .track/active LDZ #02 EQU #07 MUL ADD ;ch3_txt ;draw-label JSR2 |
|
448 |
- .chnframe/x1 LDZ2 8++ .chnframe/y1 LDZ2 #0020 ADD2 #01 .track/active LDZ #03 EQU #07 MUL ADD ;ch4_txt ;draw-label JSR2 |
|
449 |
- |
|
450 |
-RTN |
|
451 |
- |
|
452 |
-@draw-cursor ( -- ) |
|
453 |
- |
|
454 |
- ( clear last cursor ) |
|
455 |
- ;clear_icn .Screen/addr DEO2 |
|
456 |
- .pointer/x LDZ2 .Screen/x DEO2 |
|
457 |
- .pointer/y LDZ2 .Screen/y DEO2 |
|
458 |
- #40 .Screen/sprite DEO |
|
459 |
- ( record pointer positions ) |
|
460 |
- .Mouse/x DEI2 .pointer/x STZ2 .Mouse/y DEI2 .pointer/y STZ2 |
|
461 |
- ( draw new cursor ) |
|
462 |
- ;cursor_icn .Screen/addr DEO2 |
|
463 |
- .pointer/x LDZ2 .Screen/x DEO2 |
|
464 |
- .pointer/y LDZ2 .Screen/y DEO2 |
|
465 |
- #42 .Mouse/state DEI #00 NEQ ADD .Screen/sprite DEO |
|
466 |
- |
|
467 |
-RTN |
|
468 |
- |
|
469 |
-( generics ) |
|
470 |
- |
|
471 |
-@draw-label ( x y color addr -- ) |
|
472 |
- |
|
473 |
- ( load ) .label/addr STZ2 .label/color STZ .Screen/y DEO2 .Screen/x DEO2 |
|
474 |
- .label/addr LDZ2 |
|
475 |
- &loop |
|
476 |
- ( draw ) LDAk #00 SWP 8** ;font ADD2 .Screen/addr DEO2 .label/color LDZ .Screen/sprite DEO |
|
477 |
- ( incr ) ++ |
|
478 |
- ( incr ) .Screen/x DEI2 8++ .Screen/x DEO2 |
|
479 |
- LDAk ,&loop JCN |
|
480 |
- POP2 |
|
481 |
- |
|
482 |
-RTN |
|
483 |
- |
|
484 |
-@line-vertical-dotted ( x y0 y1 color -- ) |
|
485 |
- |
|
486 |
- .color STZ STH2 SWP2 .Screen/x DEO2 STH2r OVR2 .Screen/y DEO2 |
|
487 |
- &draw-ver |
|
488 |
- ( draw ) .color LDZ .Screen/pixel DEO |
|
489 |
- ( incr ) SWP2 #0002 ADD2 DUP2 .Screen/y DEO2 SWP2 |
|
490 |
- OVR2 OVR2 LTH2 ,&draw-ver JCN |
|
491 |
- POP2 POP2 |
|
492 |
- |
|
493 |
-RTN |
|
494 |
- |
|
495 |
-@line-horizontal-dotted ( x0 x1 y color -- ) |
|
496 |
- |
|
497 |
- .color STZ .Screen/y DEO2 OVR2 .Screen/x DEO2 |
|
498 |
- &draw-hor |
|
499 |
- ( draw ) .color LDZ .Screen/pixel DEO |
|
500 |
- ( incr ) SWP2 #0002 ADD2 DUP2 .Screen/x DEO2 SWP2 |
|
501 |
- OVR2 OVR2 LTH2 ,&draw-hor JCN |
|
502 |
- POP2 POP2 |
|
503 |
- |
|
504 |
-RTN |
|
505 |
- |
|
506 |
-@line-rect ( x1 y1 x2 y2 color ) |
|
507 |
- |
|
508 |
- ( load ) .color STZ .rect/y2 STZ2 .rect/x2 STZ2 DUP2 .Screen/y DEO2 .rect/y1 STZ2 DUP2 .Screen/x DEO2 .rect/x1 STZ2 |
|
509 |
- &hor |
|
510 |
- ( incr ) .Screen/x DEI2 ++ .Screen/x DEO2 |
|
511 |
- ( draw ) .rect/y1 LDZ2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO |
|
512 |
- ( draw ) .rect/y2 LDZ2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO |
|
513 |
- .Screen/x DEI2 .rect/x2 LDZ2 LTH2 ,&hor JCN |
|
514 |
- .rect/y1 LDZ2 .Screen/y DEO2 |
|
515 |
- &ver |
|
516 |
- ( draw ) .rect/x1 LDZ2 .Screen/x DEO2 .color LDZ .Screen/pixel DEO |
|
517 |
- ( draw ) .rect/x2 LDZ2 .Screen/x DEO2 .color LDZ .Screen/pixel DEO |
|
518 |
- ( incr ) .Screen/y DEI2 ++ .Screen/y DEO2 |
|
519 |
- .Screen/y DEI2 .rect/y2 LDZ2 ++ LTH2 ,&ver JCN |
|
520 |
- |
|
521 |
-RTN |
|
522 |
- |
|
523 |
-@ch1_txt [ "SQR 20 00 ] |
|
524 |
-@ch2_txt [ "TRI 20 00 ] |
|
525 |
-@ch3_txt [ "SINE 00 ] |
|
526 |
-@ch4_txt [ "DRUM 00 ] |
|
527 |
-@env_txt [ "Envelope 00 ] |
|
528 |
-@vol_txt [ "Volume 00 ] |
|
529 |
- |
|
530 |
-@clear_icn [ 0000 0000 0000 0000 ] |
|
531 |
-@cursor_icn [ 80c0 e0f0 f8e0 1000 ] |
|
532 |
-@note_icn [ 0000 1c3e 3e3e 1c00 ] |
|
533 |
-@head_icn [ 0018 1818 7e3c 1800 ] |
|
534 |
- |
|
535 |
-@notes [ |
|
536 |
- 3c 3e 40 41 43 45 47 |
|
537 |
- 48 4a 4c 4d 4f 51 53 |
|
538 |
-] |
|
539 |
- |
|
540 |
-@knob_icns [ |
|
541 |
- 0003 0c10 2020 4040 |
|
542 |
- 00c0 3008 0404 0202 |
|
543 |
- 4040 2020 100c 0300 |
|
544 |
- 0202 0404 0830 c000 |
|
545 |
- 0000 183c 3c18 0000 |
|
546 |
-] |
|
547 |
- |
|
548 |
-@octave_icn [ |
|
549 |
- ff00 0000 fefe fffe |
|
550 |
- ff01 0101 0102 fc00 |
|
551 |
- fffe fc00 fefe fffe |
|
552 |
- ff01 0101 0102 fc00 |
|
553 |
- fffe fc00 fefe fffe |
|
554 |
- ff01 0101 0102 fc00 |
|
555 |
- fffe fc00 0000 ff00 |
|
556 |
- ff01 0101 0102 fc00 |
|
557 |
- ff00 0000 fefe fffe |
|
558 |
- ff01 0101 0102 fc00 |
|
559 |
- fffe fc00 fefe fffe |
|
560 |
- ff01 0101 0102 fc00 |
|
561 |
- fffe fc00 0000 ff00 |
|
562 |
- ff01 0101 0102 fc00 |
|
563 |
-] |
|
564 |
- |
|
565 |
-@knob_offsetx [ |
|
566 |
- 01 00 00 00 00 01 02 03 |
|
567 |
- 05 06 07 08 08 08 08 07 |
|
568 |
-] |
|
569 |
- |
|
570 |
-@knob_offsety [ |
|
571 |
- 07 06 05 03 02 01 00 00 |
|
572 |
- 00 00 01 02 03 05 06 07 |
|
573 |
-] |
|
574 |
- |
|
575 |
-@font_hex ( 0-F ) |
|
576 |
-[ |
|
577 |
- 007c 8282 8282 827c 0030 1010 1010 1010 |
|
578 |
- 007c 8202 7c80 80fe 007c 8202 1c02 827c |
|
579 |
- 000c 1424 4484 fe04 00fe 8080 7c02 827c |
|
580 |
- 007c 8280 fc82 827c 007c 8202 1e02 0202 |
|
581 |
- 007c 8282 7c82 827c 007c 8282 7e02 827c |
|
582 |
- 007c 8202 7e82 827e 00fc 8282 fc82 82fc |
|
583 |
- 007c 8280 8080 827c 00fc 8282 8282 82fc |
|
584 |
- 007c 8280 f080 827c 007c 8280 f080 8080 |
|
585 |
-] |
|
586 |
- |
|
587 |
-@font ( spectrum-zx font ) |
|
588 |
-[ |
|
589 |
- 0000 0000 0000 0000 0000 2400 7e3c 0000 0000 2400 3c42 0000 0000 6c7c 7c38 1000 |
|
590 |
- 0010 387c 7c38 1000 0038 387c 6c10 3800 0010 387c 7c10 3800 0000 0018 1800 0000 |
|
591 |
- 007e 4242 4242 7e00 0000 1824 2418 0000 0018 2442 4224 1800 001e 063a 4a48 3000 |
|
592 |
- 0038 446c 107c 1000 000c 0808 0838 3800 003e 2222 2266 6600 0000 0822 0022 0800 |
|
593 |
- 0000 1018 1c18 1000 0000 0818 3818 0800 0008 1c00 001c 0800 0028 2828 2800 2800 |
|
594 |
- 003e 4a4a 3a0a 0a00 000c 3046 620c 3000 0000 0000 0000 ffff 0010 3800 3810 0038 |
|
595 |
- 0008 1c2a 0808 0800 0008 0808 2a1c 0800 0000 0804 7e04 0800 0000 1020 7e20 1000 |
|
596 |
- 0000 4040 7e00 0000 0000 0024 6624 0000 0000 1038 7c00 0000 0000 007c 3810 0000 |
|
597 |
- 0000 0000 0000 0000 0008 0808 0800 0800 0014 1400 0000 0000 0024 7e24 247e 2400 |
|
598 |
- 0008 1e28 1c0a 3c08 0042 0408 1020 4200 0030 4832 4c44 3a00 0008 1000 0000 0000 |
|
599 |
- 0004 0808 0808 0400 0010 0808 0808 1000 0000 1408 3e08 1400 0000 0808 3e08 0800 |
|
600 |
- 0000 0000 0008 0810 0000 0000 3c00 0000 0000 0000 0000 0800 0000 0204 0810 2000 |
|
601 |
- 003c 464a 5262 3c00 0018 2808 0808 3e00 003c 4202 3c40 7e00 003c 421c 0242 3c00 |
|
602 |
- 0008 1828 487e 0800 007e 407c 0242 3c00 003c 407c 4242 3c00 007e 0204 0810 1000 |
|
603 |
- 003c 423c 4242 3c00 003c 4242 3e02 3c00 0000 0008 0000 0800 0000 0800 0008 0810 |
|
604 |
- 0000 0810 2010 0800 0000 003e 003e 0000 0000 1008 0408 1000 003c 4202 0c00 0800 |
|
605 |
- 003c 425a 5442 3c00 0018 2442 7e42 4200 007c 427c 4242 7c00 003c 4240 4042 3c00 |
|
606 |
- 0078 4442 4244 7800 007e 407c 4040 7e00 003e 4040 7c40 4000 003c 4240 4e42 3c00 |
|
607 |
- 0042 427e 4242 4200 003e 0808 0808 3e00 0002 0202 4242 3c00 0044 4870 4844 4200 |
|
608 |
- 0040 4040 4040 7e00 0042 665a 4242 4200 0042 6252 4a46 4200 003c 4242 4242 3c00 |
|
609 |
- 007c 4242 7c40 4000 003c 4242 524a 3c00 007c 4242 7c44 4200 003c 403c 0242 3c00 |
|
610 |
- 00fe 1010 1010 1000 0042 4242 4242 3c00 0042 4242 4224 1800 0042 4242 5a66 4200 |
|
611 |
- 0042 2418 1824 4200 0082 4428 1010 1000 007e 0408 1020 7e00 000c 0808 0808 0c00 |
|
612 |
- 0040 2010 0804 0200 0018 0808 0808 1800 0008 1422 0000 0000 0000 0000 0000 7e00 |
|
613 |
- 0008 0400 0000 0000 0000 1c02 1e22 1e00 0020 203c 2222 3c00 0000 1e20 2020 1e00 |
|
614 |
- 0002 021e 2222 1e00 0000 1c22 3c20 1e00 000c 101c 1010 1000 0000 1c22 221e 021c |
|
615 |
- 0020 202c 3222 2200 0008 0018 0808 0400 0008 0008 0808 4830 0020 2428 3028 2400 |
|
616 |
- 0010 1010 1010 0c00 0000 6854 5454 5400 0000 5864 4444 4400 0000 3844 4444 3800 |
|
617 |
- 0000 7844 4478 4040 0000 3c44 443c 0406 0000 2c30 2020 2000 0000 3840 3804 7800 |
|
618 |
- 0010 103c 1010 0c00 0000 4444 4444 3800 0000 4444 2828 1000 0000 4454 5454 2800 |
|
619 |
- 0000 4428 1028 4400 0000 4444 443c 0438 0000 7c08 1020 7c00 000c 0810 1008 0c00 |
|
620 |
- 0008 0808 0808 0800 0030 1008 0810 3000 0000 0032 4c00 0000 3c42 99a1 a199 423c |
|
621 |
-] |
|
622 |
- |
|
623 |
-@square-wave |
|
624 |
- 28 d8 |
|
625 |
- &end |
|
626 |
- |
|
627 |
-@triangle-wave |
|
628 |
- 8082 8486 888a 8c8e 9092 9496 989a 9c9e a0a2 a4a6 a8aa acae |
|
629 |
- b0b2 b4b6 b8ba bcbe c0c1 c3c5 c7c9 cbcd cfd1 d3d5 d7d9 dbdd |
|
630 |
- dfe1 e3e5 e7e9 ebed eff1 f3f5 f7f9 fbfd fffd fbf9 f7f5 f3f1 |
|
631 |
- efed ebe9 e7e5 e3e1 dfdd dbd9 d7d5 d3d1 cfcd cbc9 c7c5 c3c1 |
|
632 |
- c0be bcba b8b6 b4b2 b0ae acaa a8a6 a4a2 a09e 9c9a 9896 9492 |
|
633 |
- 908e 8c8a 8886 8482 807e 7c7a 7876 7472 706e 6c6a 6866 6462 |
|
634 |
- 605e 5c5a 5856 5452 504e 4c4a 4846 4442 413f 3d3b 3937 3533 |
|
635 |
- 312f 2d2b 2927 2523 211f 1d1b 1917 1513 110f 0d0b 0907 0503 |
|
636 |
- 0103 0507 090b 0d0f 1113 1517 191b 1d1f 2123 2527 292b 2d2f |
|
637 |
- 3133 3537 393b 3d3f 4142 4446 484a 4c4e 5052 5456 585a 5c5e |
|
638 |
- 6062 6466 686a 6c6e 7072 7476 787a 7c7e |
|
639 |
- &end |
|
640 |
- |
|
641 |
-@sine-wave |
|
642 |
- 8084 898e 9297 9ca0 a5a9 aeb2 b6bb bfc3 c7cb ced2 d6d9 dce0 |
|
643 |
- e3e5 e8eb edf0 f2f4 f6f7 f9fa fbfc fdfe fefe fefe fefe fdfc |
|
644 |
- fbfa f9f8 f6f4 f2f0 eeeb e9e6 e3e0 ddda d7d3 cfcc c8c4 c0bc |
|
645 |
- b8b3 afaa a6a1 9d98 948f 8a85 817c 7772 6e69 6460 5b57 524e |
|
646 |
- 4a45 413d 3935 312e 2a27 2320 1d1a 1715 1210 0e0c 0a08 0705 |
|
647 |
- 0403 0202 0101 0101 0101 0202 0304 0607 090a 0c0e 1113 1518 |
|
648 |
- 1b1e 2124 282b 2f32 363a 3e42 464b 4f53 585c 6166 6a6f 7478 |
|
649 |
- 7d82 878b 9095 999e a3a7 acb0 b4b9 bdc1 c5c9 cdd0 d4d7 dbde |
|
650 |
- e1e4 e7ea ecee f1f3 f5f6 f8f9 fbfc fdfd fefe fefe fefe fdfd |
|
651 |
- fcfb faf8 f7f5 f3f1 efed eae8 e5e2 dfdc d8d5 d1ce cac6 c2be |
|
652 |
- bab5 b1ad a8a4 9f9b 9691 8d88 837e 7a75 706b 6762 5e59 5550 |
|
653 |
- 4c47 433f 3b37 3330 2c28 2522 1f1c 1916 1411 0f0d 0b09 0706 |
|
654 |
- 0504 0302 0101 0101 0101 0102 0304 0506 0809 0b0d 0f12 1417 |
|
655 |
- 1a1c 1f23 2629 2d31 3438 3c40 4449 4d51 565a 5f63 686d 7176 |
|
656 |
- 7b |
|
657 |
- &end |
|
658 |
- |
|
659 |
-@noise-wave-end |
... | ... |
@@ -1,68 +1,160 @@ |
1 | 1 |
( dev/audio ) |
2 | 2 |
|
3 |
+%2// { #01 SFT2 } |
|
3 | 4 |
%4** { #20 SFT2 } |
4 | 5 |
%8** { #30 SFT2 } |
6 |
+%20MOD { #1f AND } |
|
7 |
+%RTN { JMP2r } |
|
8 |
+ |
|
9 |
+%GET-NOTE { #00 SWP ;melody ADD2 LDA } |
|
10 |
+%GET-HEXCHAR { #00 SWP 8** ;font-hex ADD2 .Screen/addr DEO2 } |
|
5 | 11 |
|
6 | 12 |
( devices ) |
7 | 13 |
|
8 | 14 |
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ] |
9 | 15 |
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ] |
10 | 16 |
|30 @Audio0 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] |
17 |
+|80 @Controller [ &vector $2 &button $1 &key $1 ] |
|
11 | 18 |
|
12 | 19 |
( variables ) |
13 | 20 |
|
14 | 21 |
|0000 |
15 | 22 |
|
16 |
-@timer $1 |
|
17 |
-@progress $1 |
|
23 |
+@timer $1 |
|
24 |
+@progress $1 |
|
25 |
+@selection $1 |
|
26 |
+@offset |
|
27 |
+ &x $2 &y $2 |
|
18 | 28 |
|
19 | 29 |
|0100 ( -> ) |
20 | 30 |
|
21 | 31 |
( theme ) |
22 |
- #00ff .System/r DEO2 |
|
32 |
+ #0fff .System/r DEO2 |
|
23 | 33 |
#0f0f .System/g DEO2 |
24 |
- #0ff0 .System/b DEO2 |
|
34 |
+ #0f00 .System/b DEO2 |
|
25 | 35 |
|
26 | 36 |
( vectors ) |
27 | 37 |
;on-frame .Screen/vector DEO2 |
38 |
+ ;on-button .Controller/vector DEO2 |
|
28 | 39 |
|
29 | 40 |
( setup synth ) |
30 |
- #1202 .Audio0/adsr DEO2 |
|
41 |
+ #0202 .Audio0/adsr DEO2 |
|
31 | 42 |
;saw .Audio0/addr DEO2 |
32 | 43 |
#0100 .Audio0/length DEO2 |
33 |
- #ff .Audio0/volume DEO |
|
44 |
+ #00 .Audio0/volume DEO ( TODO: turn ON ) |
|
45 |
+ |
|
46 |
+ ( center ) |
|
47 |
+ .Screen/width DEI2 2// #0080 SUB2 .offset/x STZ2 |
|
48 |
+ .Screen/height DEI2 2// #0040 SUB2 .offset/y STZ2 |
|
49 |
+ |
|
50 |
+ ;draw JSR2 |
|
51 |
+ #02 ;draw-selector JSR2 |
|
52 |
+ |
|
53 |
+BRK |
|
34 | 54 |
|
55 |
+@on-button ( -> ) |
|
56 |
+ |
|
57 |
+ .Controller/button DEI #04 SFT |
|
58 |
+ [ #01 ] NEQk NIP ,&no-up JCN |
|
59 |
+ .selection LDZ STHk |
|
60 |
+ #00 ;draw-note JSR2 |
|
61 |
+ [ STHkr GET-NOTE #01 ADD ] #00 STHkr ;melody ADD2 STA |
|
62 |
+ STHr #01 ;draw-note JSR2 |
|
63 |
+ #02 ;draw-selector JSR2 |
|
64 |
+ &no-up |
|
65 |
+ [ #02 ] NEQk NIP ,&no-down JCN |
|
66 |
+ .selection LDZ STHk |
|
67 |
+ #00 ;draw-note JSR2 |
|
68 |
+ [ STHkr GET-NOTE #01 SUB ] #00 STHkr ;melody ADD2 STA |
|
69 |
+ STHr #01 ;draw-note JSR2 |
|
70 |
+ #02 ;draw-selector JSR2 |
|
71 |
+ &no-down |
|
72 |
+ [ #04 ] NEQk NIP ,&no-left JCN |
|
73 |
+ #00 ;draw-selector JSR2 |
|
74 |
+ .selection LDZ #01 SUB 20MOD .selection STZ |
|
75 |
+ #02 ;draw-selector JSR2 |
|
76 |
+ &no-left |
|
77 |
+ [ #08 ] NEQk NIP ,&no-right JCN |
|
78 |
+ #00 ;draw-selector JSR2 |
|
79 |
+ .selection LDZ INC 20MOD .selection STZ |
|
80 |
+ #02 ;draw-selector JSR2 |
|
81 |
+ &no-right |
|
82 |
+ POP |
|
83 |
+ |
|
35 | 84 |
BRK |
36 | 85 |
|
37 | 86 |
@on-frame ( -> ) |
38 | 87 |
|
39 |
- ( incr ) .timer LDZ #01 ADD .timer STZ |
|
88 |
+ ( incr ) .timer LDZ INC .timer STZ |
|
40 | 89 |
( skip ) .timer LDZ #10 EQU #01 JCN [ BRK ] |
90 |
+ .progress LDZ |
|
91 |
+ ( play note ) DUP GET-NOTE .Audio0/pitch DEO |
|
92 |
+ ( erase last ) DUP #01 SUB 20MOD #01 ,draw-note JSR |
|
93 |
+ ( draw current ) #01 ,draw-note JSR |
|
94 |
+ ( incr ) .progress LDZ INC 20MOD .progress STZ |
|
95 |
+ #00 .timer STZ |
|
41 | 96 |
|
42 |
- ( get note ) |
|
43 |
- ;melody #00 .progress LDZ ADD2 LDA |
|
97 |
+BRK |
|
44 | 98 |
|
45 |
- ( play note ) |
|
46 |
- DUP .Audio0/pitch DEO |
|
99 |
+@draw ( -- ) |
|
47 | 100 |
|
48 |
- ( erase last note ) |
|
49 |
- #00 .Screen/sprite DEO |
|
101 |
+ #20 #00 |
|
102 |
+ &loop |
|
103 |
+ DUP #01 ,draw-note JSR |
|
104 |
+ INC GTHk ,&loop JCN |
|
105 |
+ POP2 |
|
50 | 106 |
|
51 |
- ( draw note ) |
|
52 |
- #00 SWP 4** #0100 SUB2 .Screen/y DEO2 |
|
53 |
- #00 .progress LDZ 8** .Screen/x DEO2 |
|
54 |
- ;dot .Screen/addr DEO2 |
|
55 |
- #01 .Screen/sprite DEO |
|
107 |
+RTN |
|
56 | 108 |
|
57 |
- ( incr ) .progress LDZ #01 ADD #1f AND .progress STZ |
|
109 |
+@draw-note ( id color -- ) |
|
58 | 110 |
|
59 |
- #00 .timer STZ |
|
111 |
+ STH STH |
|
112 |
+ ( set x ) [ #00 STHkr ] 8** .offset/x LDZ2 ADD2 .Screen/x DEO2 |
|
113 |
+ ( set y ) [ #00 #00 STHkr ;melody ADD2 LDA ] 4** #0100 SWP2 SUB2 .offset/y LDZ2 ADD2 #0080 ADD2 .Screen/y DEO2 |
|
114 |
+ ( set addr ) ;marker-icn [ #00 .progress LDZ STHr EQU #08 MUL ADD2 ] .Screen/addr DEO2 |
|
115 |
+ ( draw ) STHr .Screen/sprite DEO |
|
60 | 116 |
|
61 |
-BRK |
|
117 |
+RTN |
|
62 | 118 |
|
63 |
-@dot [ 003c 7eff 7e3c 0000 ] |
|
119 |
+@draw-selector ( color -- ) |
|
120 |
+ |
|
121 |
+ STH |
|
122 |
+ [ #00 .selection LDZ ] 8** .offset/x LDZ2 ADD2 .Screen/x DEO2 |
|
123 |
+ #0070 .offset/y LDZ2 ADD2 .Screen/y DEO2 |
|
124 |
+ ;selector-icn .Screen/addr DEO2 |
|
125 |
+ STHkr .Screen/sprite DEO |
|
126 |
+ |
|
127 |
+ .Screen/y DEI2 #0008 ADD2 .Screen/y DEO2 |
|
128 |
+ .selection LDZ GET-NOTE STHr ,draw-byte JSR |
|
129 |
+ |
|
130 |
+RTN |
|
131 |
+ |
|
132 |
+@draw-byte ( byte color -- ) |
|
133 |
+ |
|
134 |
+ STH |
|
135 |
+ DUP |
|
136 |
+ #04 SFT GET-HEXCHAR |
|
137 |
+ ( draw ) STHkr .Screen/sprite DEO |
|
138 |
+ .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2 |
|
139 |
+ #0f AND GET-HEXCHAR |
|
140 |
+ ( draw ) STHr .Screen/sprite DEO |
|
141 |
+ |
|
142 |
+RTN |
|
143 |
+ |
|
144 |
+@melody |
|
145 |
+ 54 52 54 4f 4b 4f 48 00 |
|
146 |
+ 54 52 54 4f 4b 4f 48 00 |
|
147 |
+ 54 56 57 56 57 54 56 54 |
|
148 |
+ 56 52 54 52 54 50 54 00 |
|
149 |
+ |
|
150 |
+@selector-icn |
|
151 |
+ 0000 0010 387c 0000 |
|
152 |
+ |
|
153 |
+@marker-icn |
|
154 |
+ 3844 8282 8244 3800 |
|
155 |
+ 387c fefe fe7c 3800 |
|
64 | 156 |
|
65 |
-@saw [ |
|
157 |
+@saw |
|
66 | 158 |
0003 0609 0c0f 1215 181b 1e21 2427 2a2d |
67 | 159 |
3033 3639 3b3e 4143 4649 4b4e 5052 5557 |
68 | 160 |
595b 5e60 6264 6667 696b 6c6e 7071 7274 |
... | ... |
@@ -78,10 +170,14 @@ BRK |
78 | 170 |
8182 8282 8282 8383 8485 8586 8788 898a |
79 | 171 |
8b8c 8e8f 9092 9495 9799 9a9c 9ea0 a2a5 |
80 | 172 |
a7a9 abae b0b2 b5b7 babd bfc2 c5c7 cacd |
81 |
- d0d3 d6d9 dcdf e2e5 e8eb eef1 f4f7 fafd ] |
|
82 |
- |
|
83 |
-@melody [ |
|
84 |
- 54 52 54 4f 4b 4f 48 ff |
|
85 |
- 54 52 54 4f 4b 4f 48 ff |
|
86 |
- 54 56 57 56 57 54 56 54 |
|
87 |
- 56 52 54 52 54 50 54 ff ] |
|
173 |
+ d0d3 d6d9 dcdf e2e5 e8eb eef1 f4f7 fafd |
|
174 |
+ |
|
175 |
+@font-hex ( 0-F ) |
|
176 |
+ 007c 8282 8282 827c 0030 1010 1010 1010 |
|
177 |
+ 007c 8202 7c80 80fe 007c 8202 1c02 827c |
|
178 |
+ 000c 1424 4484 fe04 00fe 8080 7c02 827c |
|
179 |
+ 007c 8280 fc82 827c 007c 8202 1e02 0202 |
|
180 |
+ 007c 8282 7c82 827c 007c 8282 7e02 827c |
|
181 |
+ 007c 8202 7e82 827e 00fc 8282 fc82 82fc |
|
182 |
+ 007c 8280 8080 827c 00fc 8282 8282 82fc |
|
183 |
+ 007c 8280 f080 827c 007c 8280 f080 8080 |
|
88 | 184 |
\ No newline at end of file |