2021-04-21 15:44:57 -04:00
|
|
|
( dev/audio )
|
|
|
|
|
|
|
|
%MOD { DUP2 DIV MUL SUB }
|
|
|
|
|
2021-04-22 22:57:47 -04:00
|
|
|
@timer $1
|
2021-04-21 15:46:40 -04:00
|
|
|
@progress $1
|
2021-04-21 15:44:57 -04:00
|
|
|
|
|
|
|
( devices )
|
|
|
|
|
|
|
|
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|
|
|
|
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &color $1 ]
|
2021-04-25 10:12:45 -04:00
|
|
|
|30 @Audio [ &pad $8 &adsr $2 &len $2 &addr $2 &volume $1 &pitch $1 ]
|
2021-04-21 15:44:57 -04:00
|
|
|
|
|
|
|
|0100 ( -> )
|
|
|
|
|
|
|
|
( set color pallete )
|
2021-04-22 23:44:38 -04:00
|
|
|
#00ff .System/r DEO2
|
|
|
|
#0f0f .System/g DEO2
|
|
|
|
#0ff0 .System/b DEO2
|
2021-04-21 15:44:57 -04:00
|
|
|
|
2021-04-22 23:44:38 -04:00
|
|
|
;on-frame .Screen/vector DEO2 ( run on-frame every 1/60th of a second )
|
2021-04-25 10:12:45 -04:00
|
|
|
#ff .Audio/volume DEO ( set volume to max )
|
|
|
|
;saw .Audio/addr DEO2 ( set waveform to saw for audio engine )
|
2021-04-25 13:04:34 -04:00
|
|
|
;saw/end ;saw SUB2 .Audio/len DEO2
|
2021-04-25 10:12:45 -04:00
|
|
|
#1202 .Audio/adsr DEO2 ( set envelope for audio engine )
|
2021-04-21 15:44:57 -04:00
|
|
|
|
|
|
|
BRK
|
|
|
|
|
|
|
|
@on-frame ( -> )
|
|
|
|
|
2021-04-22 23:44:38 -04:00
|
|
|
( incr ) .timer PEK #01 ADD .timer POK
|
|
|
|
( skip ) .timer PEK #10 EQU ,&play-note JNZ BRK &play-note
|
2021-04-21 15:44:57 -04:00
|
|
|
|
|
|
|
( get note )
|
2021-04-22 23:44:38 -04:00
|
|
|
;melody #00 .progress PEK ADD2 GET
|
2021-04-21 15:44:57 -04:00
|
|
|
|
|
|
|
( play note )
|
2021-04-25 10:12:45 -04:00
|
|
|
DUP .Audio/pitch DEO
|
2021-04-21 15:44:57 -04:00
|
|
|
|
|
|
|
( erase last note )
|
2021-04-22 23:44:38 -04:00
|
|
|
#20 .Screen/color DEO
|
2021-04-21 15:44:57 -04:00
|
|
|
|
|
|
|
( draw note )
|
2021-04-22 23:44:38 -04:00
|
|
|
#00 SWP #0004 MUL2 #0100 SUB2 .Screen/y DEO2
|
|
|
|
#00 .progress PEK #0008 MUL2 .Screen/x DEO2
|
|
|
|
;dot .Screen/addr DEO2
|
|
|
|
#21 .Screen/color DEO
|
2021-04-21 15:44:57 -04:00
|
|
|
|
2021-04-22 23:44:38 -04:00
|
|
|
( incr ) .progress PEK #01 ADD #20 MOD .progress POK
|
2021-04-21 15:44:57 -04:00
|
|
|
|
2021-04-22 23:44:38 -04:00
|
|
|
#00 .timer POK
|
2021-04-21 15:44:57 -04:00
|
|
|
|
|
|
|
BRK
|
|
|
|
|
|
|
|
@silence ( -> )
|
|
|
|
|
|
|
|
BRK
|
|
|
|
|
|
|
|
( defines a sawtooth wave. )
|
|
|
|
|
|
|
|
@saw ( -> )
|
2021-04-25 13:04:34 -04:00
|
|
|
5f5f 5e5e 5e5d 5d5d 5c5c 5b5b 5b5a 5a5a
|
|
|
|
5959 5858 5857 5757 5656 5555 5554 5454
|
|
|
|
5353 5252 5251 5151 5050 4f4f 4f4e 4e4e
|
|
|
|
4d4d 4c4c 4c4b 4b4b 4a4a 4949 4948 4848
|
|
|
|
4747 4646 4645 4545 4444 4343 4342 4242
|
|
|
|
4141 4040 403f 3f3f 3e3e 3d3d 3d3c 3c3c
|
|
|
|
3b3b 3a3a 3a39 3939 3838 3737 3736 3636
|
|
|
|
3535 3434 3433 3333 3232 3131 3130 3030
|
|
|
|
2f2f 2e2e 2e2d 2d2d 2c2c 2b2b 2b2a 2a2a
|
|
|
|
2929 2828 2827 2727 2626 2525 2524 2424
|
|
|
|
2323 2222 2221 2121 2020 1f1f 1f1e 1e1e
|
|
|
|
1d1d 1c1c 1c1b 1b1b 1a1a 1919 1918 1818
|
|
|
|
1717 1616 1615 1515 1414 1313 1312 1212
|
|
|
|
1111 1010 100f 0f0f 0e0e 0d0d 0d0c 0c0c
|
|
|
|
0b0b 0a0a 0a09 0909 0808 0707 0706 0606
|
|
|
|
0505 0404 0403 0303 0202 0101 0100 0000
|
2021-04-25 10:12:45 -04:00
|
|
|
&end
|
2021-04-21 15:44:57 -04:00
|
|
|
|
|
|
|
BRK
|
|
|
|
|
2021-04-21 15:46:40 -04:00
|
|
|
( song data, #ff is used for a rest )
|
2021-04-21 15:44:57 -04:00
|
|
|
|
|
|
|
@melody [
|
|
|
|
54 52 54 4f 4b 4f 48 ff
|
|
|
|
54 52 54 4f 4b 4f 48 ff
|
|
|
|
54 56 57 56 57 54 56 54
|
|
|
|
56 52 54 52 54 50 54 ff
|
|
|
|
]
|
|
|
|
|
2021-04-21 15:46:40 -04:00
|
|
|
( dot sprite )
|
2021-04-21 15:44:57 -04:00
|
|
|
|
|
|
|
@dot [ 003c 7eff 7e3c 0000 ]
|