0
0
Fork 0
mirror of https://git.sr.ht/~rabbits/uxn synced 2024-11-27 08:13:01 +00:00

Fixed leak in piano

This commit is contained in:
neauoire 2021-05-12 11:44:18 -07:00
parent fd9612d656
commit 4bac8e9e30
3 changed files with 25 additions and 26 deletions

View file

@ -42,7 +42,7 @@ then
fi fi
echo "Assembling.." echo "Assembling.."
./bin/uxnasm projects/demos/piano.usm bin/boot.rom ./bin/uxnasm projects/demos/bifurcan.usm bin/boot.rom
echo "Running.." echo "Running.."
if [ "${2}" = '--cli' ]; if [ "${2}" = '--cli' ];

View file

@ -4,10 +4,7 @@
) )
%RTN { JMP2r } %RTN { JMP2r }
%8+ { #0008 ADD2 }
%2/ { #0002 DIV2 }
%MOD { DUP2 DIV MUL SUB } %MOD { DUP2 DIV MUL SUB }
%INC { #01 ADD }
%TOS { #00 SWP } %TOS { #00 SWP }
( devices ) ( devices )
@ -41,8 +38,8 @@
;on-mouse .Mouse/vector DEO2 ;on-mouse .Mouse/vector DEO2
( find center ) ( find center )
.Screen/width DEI2 2/ .center/x STZ2 .Screen/width DEI2 #0002 DIV2 .center/x STZ2
.Screen/height DEI2 2/ .center/y STZ2 .Screen/height DEI2 #0002 DIV2 .center/y STZ2
( background ) ( background )
;tiles ;cover-pattern JSR2 ;tiles ;cover-pattern JSR2
@ -66,7 +63,7 @@ BRK
;draw-cursor JSR2 ;draw-cursor JSR2
.Mouse/state DEI #00 EQU ,&no-touch JCN .Mouse/state DEI #00 EQU ,&no-touch JCN
( incr ) .style LDZ INC #03 MOD .style STZ ( incr ) .style LDZ #01 ADD #04 MOD .style STZ
( bg ) ;tiles .style LDZ #10 MUL TOS ADD2 ;cover-pattern JSR2 ( bg ) ;tiles .style LDZ #10 MUL TOS ADD2 ;cover-pattern JSR2
( fg ) ;redraw JSR2 ( fg ) ;redraw JSR2
( release ) #00 .Mouse/state DEO ( release ) #00 .Mouse/state DEO
@ -102,7 +99,7 @@ BRK
RTN RTN
@draw-number ( x y n -- ) @draw-number ( x* y* n -- )
STH STH
( save pos ) .anchor/y STZ2 .anchor/x STZ2 ( save pos ) .anchor/y STZ2 .anchor/x STZ2
@ -116,14 +113,14 @@ RTN
( set style ) .style LDZ #10 MUL TOS ADD2 ( set style ) .style LDZ #10 MUL TOS ADD2
.Screen/addr DEO2 .Screen/addr DEO2
( draw ) #21 .Screen/color DEO ( draw ) #21 .Screen/color DEO
( incr ) SWP INC SWP ( incr ) SWP #01 ADD SWP
DUP2 LTH ,&loop JCN DUP2 LTH ,&loop JCN
POP2 POP2
POPr POPr
RTN RTN
@cover-pattern ( addr -- ) @cover-pattern ( addr* -- )
( load ) .Screen/addr DEO2 ( load ) .Screen/addr DEO2
#0000 .Screen/height DEI2 #0000 .Screen/height DEI2
@ -133,11 +130,11 @@ RTN
&hor &hor
( save ) OVR2 .Screen/x DEO2 ( save ) OVR2 .Screen/x DEO2
( draw ) #21 .Screen/color DEO ( draw ) #21 .Screen/color DEO
( incr ) SWP2 8+ SWP2 ( incr ) SWP2 #0008 ADD2 SWP2
OVR2 OVR2 LTH2 ,&hor JCN LTH2k ,&hor JCN
POP2 POP2 POP2 POP2
( incr ) SWP2 8+ SWP2 ( incr ) SWP2 #0008 ADD2 SWP2
OVR2 OVR2 LTH2 ,&ver JCN LTH2k ,&ver JCN
POP2 POP2 POP2 POP2
RTN RTN
@ -174,4 +171,6 @@ RTN
0718 2040 4080 8080 0718 2040 4080 8080
0101 0102 0204 18e0 0101 0102 0204 18e0
0808 0810 e304 0808 0808 0810 e304 0808
0808 0804 e310 0808 ] 0808 0804 e310 0808
0000 0000 0000 0001
ffff ffff ffff ffff ]

View file

@ -10,6 +10,7 @@
%MOD { DUP2 / * - } %MOD { DUP2 / * - }
%LTS2 { #8000 ++ SWP2 #8000 ++ >> } %LTS2 { #8000 ++ SWP2 #8000 ++ >> }
%GTS2 { #8000 ++ SWP2 #8000 ++ << } %GTS2 { #8000 ++ SWP2 #8000 ++ << }
%INCR { SWP #01 + SWP }
%WAVEFORM { #1000 } %WAVEFORM { #1000 }
@ -107,7 +108,7 @@ BRK
.adsr-view/x2 LDZ2 #003a -- #0002 ++ .Screen/x DEO2 .adsr-view/x2 LDZ2 #003a -- #0002 ++ .Screen/x DEO2
OVR #10 SWP - .Audio0/output DEI #04 SFT < .Screen/color DEO OVR #10 SWP - .Audio0/output DEI #04 SFT < .Screen/color DEO
.Screen/y DEI2 #0002 ++ .Screen/y DEO2 .Screen/y DEI2 #0002 ++ .Screen/y DEO2
( incr ) SWP #01 + SWP ( incr ) INCR
LTHk ,&loop JCN LTHk ,&loop JCN
POP2 POP2
@ -116,7 +117,6 @@ BRK
@on-control ( -> ) @on-control ( -> )
( clear last cursor ) ( clear last cursor )
#fff8 .Screen/addr DEO2
.pointer/x LDZ2 .Screen/x DEO2 .pointer/x LDZ2 .Screen/x DEO2
.pointer/y LDZ2 .Screen/y DEO2 .pointer/y LDZ2 .Screen/y DEO2
#30 .Screen/color DEO #30 .Screen/color DEO
@ -252,7 +252,7 @@ BRK
@play ( pitch -- ) @play ( pitch -- )
DUP .octave LDZ #0c * + .Audio0/pitch DEO .octave LDZ #0c * + .Audio0/pitch DEO
RTN RTN
@ -313,7 +313,7 @@ RTN
( draw ) STHrk .Screen/color DEO ( draw ) STHrk .Screen/color DEO
( incr ) .Screen/addr DEI2 #0008 ++ .Screen/addr DEO2 ( incr ) .Screen/addr DEI2 #0008 ++ .Screen/addr DEO2
( incr ) SWP2 #0008 ++ SWP2 ( incr ) SWP2 #0008 ++ SWP2
OVR2 OVR2 << ,&loop JCN LTH2k ,&loop JCN
POP2 POP2 POP2 POP2
POPr POPr
@ -370,7 +370,7 @@ RTN
TOS #0004 // .wave-view/y1 LDZ2 ++ .Screen/y DEO2 TOS #0004 // .wave-view/y1 LDZ2 ++ .Screen/y DEO2
.Screen/x DEI2 #0001 ++ .Screen/x DEO2 .Screen/x DEI2 #0001 ++ .Screen/x DEO2
( draw ) OVR .Audio0/length DEI2 SWP POP > #02 * #01 + .Screen/color DEO ( draw ) OVR .Audio0/length DEI2 SWP POP > #02 * #01 + .Screen/color DEO
( incr ) SWP #01 + SWP ( incr ) INCR
LTHk ,&loop JCN LTHk ,&loop JCN
POP2 POP2
@ -392,7 +392,7 @@ RTN
OVR2 .Screen/y DEO2 OVR2 .Screen/y DEO2
( draw ) STHrk .Screen/color DEO ( draw ) STHrk .Screen/color DEO
( incr ) SWP2 #0001 ++ SWP2 ( incr ) SWP2 #0001 ++ SWP2
OVR2 OVR2 << ,&loop JCN LTH2k ,&loop JCN
POP2 POP2 POP2 POP2
POPr POPr