uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit 4bac8e9e300948bb291e04d828e74e2f44fe2d85
parent fd9612d65662a448d6517cdcca24a14a79968813
Author: neauoire <aliceffekt@gmail.com>
Date:   Wed, 12 May 2021 11:44:18 -0700

Fixed leak in piano

Diffstat:
Mbuild.sh | 2+-
Mprojects/demos/bifurcan.usm | 27+++++++++++++--------------
Mprojects/demos/piano.usm | 22+++++++++++-----------
3 files changed, 25 insertions(+), 26 deletions(-)

diff --git a/build.sh b/build.sh @@ -42,7 +42,7 @@ then fi echo "Assembling.." -./bin/uxnasm projects/demos/piano.usm bin/boot.rom +./bin/uxnasm projects/demos/bifurcan.usm bin/boot.rom echo "Running.." if [ "${2}" = '--cli' ]; diff --git a/projects/demos/bifurcan.usm b/projects/demos/bifurcan.usm @@ -4,10 +4,7 @@ ) %RTN { JMP2r } -%8+ { #0008 ADD2 } -%2/ { #0002 DIV2 } %MOD { DUP2 DIV MUL SUB } -%INC { #01 ADD } %TOS { #00 SWP } ( devices ) @@ -41,8 +38,8 @@ ;on-mouse .Mouse/vector DEO2 ( find center ) - .Screen/width DEI2 2/ .center/x STZ2 - .Screen/height DEI2 2/ .center/y STZ2 + .Screen/width DEI2 #0002 DIV2 .center/x STZ2 + .Screen/height DEI2 #0002 DIV2 .center/y STZ2 ( background ) ;tiles ;cover-pattern JSR2 @@ -66,7 +63,7 @@ BRK ;draw-cursor JSR2 .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 ( fg ) ;redraw JSR2 ( release ) #00 .Mouse/state DEO @@ -102,7 +99,7 @@ BRK RTN -@draw-number ( x y n -- ) +@draw-number ( x* y* n -- ) STH ( save pos ) .anchor/y STZ2 .anchor/x STZ2 @@ -116,14 +113,14 @@ RTN ( set style ) .style LDZ #10 MUL TOS ADD2 .Screen/addr DEO2 ( draw ) #21 .Screen/color DEO - ( incr ) SWP INC SWP + ( incr ) SWP #01 ADD SWP DUP2 LTH ,&loop JCN POP2 POPr RTN -@cover-pattern ( addr -- ) +@cover-pattern ( addr* -- ) ( load ) .Screen/addr DEO2 #0000 .Screen/height DEI2 @@ -133,11 +130,11 @@ RTN &hor ( save ) OVR2 .Screen/x DEO2 ( draw ) #21 .Screen/color DEO - ( incr ) SWP2 8+ SWP2 - OVR2 OVR2 LTH2 ,&hor JCN + ( incr ) SWP2 #0008 ADD2 SWP2 + LTH2k ,&hor JCN POP2 POP2 - ( incr ) SWP2 8+ SWP2 - OVR2 OVR2 LTH2 ,&ver JCN + ( incr ) SWP2 #0008 ADD2 SWP2 + LTH2k ,&ver JCN POP2 POP2 RTN @@ -174,4 +171,6 @@ RTN 0718 2040 4080 8080 0101 0102 0204 18e0 0808 0810 e304 0808 - 0808 0804 e310 0808 ] + 0808 0804 e310 0808 + 0000 0000 0000 0001 + ffff ffff ffff ffff ] diff --git a/projects/demos/piano.usm b/projects/demos/piano.usm @@ -5,11 +5,12 @@ %++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 } %<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 } -%RTN { JMP2r } -%TOS { #00 SWP } -%MOD { DUP2 / * - } -%LTS2 { #8000 ++ SWP2 #8000 ++ >> } -%GTS2 { #8000 ++ SWP2 #8000 ++ << } +%RTN { JMP2r } +%TOS { #00 SWP } +%MOD { DUP2 / * - } +%LTS2 { #8000 ++ SWP2 #8000 ++ >> } +%GTS2 { #8000 ++ SWP2 #8000 ++ << } +%INCR { SWP #01 + SWP } %WAVEFORM { #1000 } @@ -107,7 +108,7 @@ BRK .adsr-view/x2 LDZ2 #003a -- #0002 ++ .Screen/x DEO2 OVR #10 SWP - .Audio0/output DEI #04 SFT < .Screen/color DEO .Screen/y DEI2 #0002 ++ .Screen/y DEO2 - ( incr ) SWP #01 + SWP + ( incr ) INCR LTHk ,&loop JCN POP2 @@ -116,7 +117,6 @@ BRK @on-control ( -> ) ( clear last cursor ) - #fff8 .Screen/addr DEO2 .pointer/x LDZ2 .Screen/x DEO2 .pointer/y LDZ2 .Screen/y DEO2 #30 .Screen/color DEO @@ -252,7 +252,7 @@ BRK @play ( pitch -- ) - DUP .octave LDZ #0c * + .Audio0/pitch DEO + .octave LDZ #0c * + .Audio0/pitch DEO RTN @@ -313,7 +313,7 @@ RTN ( draw ) STHrk .Screen/color DEO ( incr ) .Screen/addr DEI2 #0008 ++ .Screen/addr DEO2 ( incr ) SWP2 #0008 ++ SWP2 - OVR2 OVR2 << ,&loop JCN + LTH2k ,&loop JCN POP2 POP2 POPr @@ -370,7 +370,7 @@ RTN TOS #0004 // .wave-view/y1 LDZ2 ++ .Screen/y DEO2 .Screen/x DEI2 #0001 ++ .Screen/x DEO2 ( draw ) OVR .Audio0/length DEI2 SWP POP > #02 * #01 + .Screen/color DEO - ( incr ) SWP #01 + SWP + ( incr ) INCR LTHk ,&loop JCN POP2 @@ -392,7 +392,7 @@ RTN OVR2 .Screen/y DEO2 ( draw ) STHrk .Screen/color DEO ( incr ) SWP2 #0001 ++ SWP2 - OVR2 OVR2 << ,&loop JCN + LTH2k ,&loop JCN POP2 POP2 POPr