uxn

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

commit d4981f4779b16e75489c36ab10b8ab6d27445c4f
parent d01eb6cc45ed26fd296fefd8eeea68062dc0f6df
Author: neauoire <aliceffekt@gmail.com>
Date:   Sun, 25 Apr 2021 14:00:35 -0700

Mini cleanup

Diffstat:
Mprojects/demos/piano.usm | 53++++++++++-------------------------------------------
1 file changed, 10 insertions(+), 43 deletions(-)

diff --git a/projects/demos/piano.usm b/projects/demos/piano.usm @@ -1,13 +1,11 @@ ( piano ) %RTN { JMP2r } -%8+ { #0008 ADD2 } %8- { #0008 SUB2 } -%8* { #0008 MUL2 } %8/ { #0008 DIV2 } +%8+ { #0008 ADD2 } +%8/ { #0008 DIV2 } %2/ { #0002 DIV2 } %++ { #0001 ADD2 } -%MOD { DUP2 DIV MUL SUB } %TOS { #00 SWP } -%PRINT-SHORT { .Console/short DEO2 #0d .Console/char DEO } ( devices ) @@ -30,7 +28,6 @@ @pointer [ &x $2 &y $2 ] @color $1 -@rect [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ] @adsr-view [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ] @wave-view [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ] @@ -81,9 +78,10 @@ ;sine-wave .Audio/addr DEO2 ;sine-wave/end ;sine-wave SUB2 #0001 SFT2 .Audio/length DEO2 - - ( background ) - ;redraw JSR2 + ( inital drawing ) + ;draw-octave JSR2 + ;draw-adsr JSR2 + ;draw-wave JSR2 BRK @@ -123,11 +121,9 @@ BRK .Mouse/x DEI2 .octave-view/x1 PEK2 SUB2 #0008 DIV2 SWP POP #08 NEQ ,&no-mod JNZ .Mouse/y DEI2 .octave-view/y1 PEK2 SUB2 #0008 DIV2 SWP POP DUP #00 NEQ ,&no-incr JNZ - .octave PEK #01 ADD .octave POK - &no-incr + .octave PEK #01 ADD .octave POK &no-incr DUP #02 NEQ ,&no-decr JNZ - .octave PEK #01 SUB .octave POK - &no-decr + .octave PEK #01 SUB .octave POK &no-decr POP ( release ) #00 .Mouse/state DEO ;draw-octave JSR2 @@ -161,6 +157,7 @@ BRK DUP #f0 AND STH #01 .Mouse/state DEI #10 EQU #0e MUL ADD ADD #0f AND STHr ADD .Audio/adsr #01 ADD DEO &no-r POP + ( release ) #00 .Mouse/state DEO ;draw-adsr JSR2 ;draw-cursor JSR2 @@ -205,7 +202,7 @@ BRK ( move ) .Audio/addr DEI2 #0001 ADD2 .Audio/addr DEO2 &no-right POP - ;redraw JSR2 + ;draw-octave JSR2 BRK @@ -215,14 +212,6 @@ BRK RTN -@redraw ( -- ) - - ;draw-octave JSR2 - ;draw-adsr JSR2 - ;draw-wave JSR2 - -RTN - @draw-cursor ( -- ) ( clear last cursor ) @@ -413,28 +402,6 @@ RTN RTN -@line-rect ( x1 y1 x2 y2 color -- ) - - ( load ) .color POK DUP2 STH2 .rect/y2 POK2 .rect/x2 POK2 DUP2 STH2 .rect/y1 POK2 .rect/x1 POK2 - STH2r STH2r - &ver - ( save ) OVR2 .Screen/y DEO2 - ( draw ) .rect/x1 PEK2 .Screen/x DEO2 .color PEK DUP .Screen/color DEO - ( draw ) .rect/x2 PEK2 .Screen/x DEO2 .Screen/color DEO - ( incr ) SWP2 ++ SWP2 - OVR2 OVR2 LTS2 ,&ver JNZ - POP2 POP2 - .rect/x1 PEK2 .rect/x2 PEK2 - &hor - ( save ) OVR2 .Screen/x DEO2 - ( draw ) .rect/y1 PEK2 .Screen/y DEO2 .color PEK DUP .Screen/color DEO - ( draw ) .rect/y2 PEK2 .Screen/y DEO2 .Screen/color DEO - ( incr ) SWP2 ++ SWP2 - OVR2 OVR2 ++ LTS2 ,&hor JNZ - POP2 POP2 - -RTN - @clear [ 0000 0000 0000 0000 ]