Mini cleanup

This commit is contained in:
neauoire 2021-04-25 14:00:35 -07:00
parent d01eb6cc45
commit d4981f4779
1 changed files with 10 additions and 43 deletions

View File

@ -1,13 +1,11 @@
( piano ) ( piano )
%RTN { JMP2r } %RTN { JMP2r }
%8+ { #0008 ADD2 } %8- { #0008 SUB2 } %8+ { #0008 ADD2 }
%8* { #0008 MUL2 } %8/ { #0008 DIV2 } %8/ { #0008 DIV2 }
%2/ { #0002 DIV2 } %2/ { #0002 DIV2 }
%++ { #0001 ADD2 } %++ { #0001 ADD2 }
%MOD { DUP2 DIV MUL SUB }
%TOS { #00 SWP } %TOS { #00 SWP }
%PRINT-SHORT { .Console/short DEO2 #0d .Console/char DEO }
( devices ) ( devices )
@ -30,7 +28,6 @@
@pointer [ &x $2 &y $2 ] @pointer [ &x $2 &y $2 ]
@color $1 @color $1
@rect [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ]
@adsr-view [ &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 ] @wave-view [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ]
@ -81,9 +78,10 @@
;sine-wave .Audio/addr DEO2 ;sine-wave .Audio/addr DEO2
;sine-wave/end ;sine-wave SUB2 #0001 SFT2 .Audio/length DEO2 ;sine-wave/end ;sine-wave SUB2 #0001 SFT2 .Audio/length DEO2
( inital drawing )
( background ) ;draw-octave JSR2
;redraw JSR2 ;draw-adsr JSR2
;draw-wave JSR2
BRK BRK
@ -123,11 +121,9 @@ BRK
.Mouse/x DEI2 .octave-view/x1 PEK2 SUB2 #0008 DIV2 SWP POP #08 NEQ ,&no-mod JNZ .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 .Mouse/y DEI2 .octave-view/y1 PEK2 SUB2 #0008 DIV2 SWP POP
DUP #00 NEQ ,&no-incr JNZ DUP #00 NEQ ,&no-incr JNZ
.octave PEK #01 ADD .octave POK .octave PEK #01 ADD .octave POK &no-incr
&no-incr
DUP #02 NEQ ,&no-decr JNZ DUP #02 NEQ ,&no-decr JNZ
.octave PEK #01 SUB .octave POK .octave PEK #01 SUB .octave POK &no-decr
&no-decr
POP POP
( release ) #00 .Mouse/state DEO ( release ) #00 .Mouse/state DEO
;draw-octave JSR2 ;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 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 .Audio/adsr #01 ADD DEO &no-r
POP POP
( release ) #00 .Mouse/state DEO ( release ) #00 .Mouse/state DEO
;draw-adsr JSR2 ;draw-adsr JSR2
;draw-cursor JSR2 ;draw-cursor JSR2
@ -205,7 +202,7 @@ BRK
( move ) .Audio/addr DEI2 #0001 ADD2 .Audio/addr DEO2 &no-right ( move ) .Audio/addr DEI2 #0001 ADD2 .Audio/addr DEO2 &no-right
POP POP
;redraw JSR2 ;draw-octave JSR2
BRK BRK
@ -215,14 +212,6 @@ BRK
RTN RTN
@redraw ( -- )
;draw-octave JSR2
;draw-adsr JSR2
;draw-wave JSR2
RTN
@draw-cursor ( -- ) @draw-cursor ( -- )
( clear last cursor ) ( clear last cursor )
@ -413,28 +402,6 @@ RTN
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 [ @clear [
0000 0000 0000 0000 ] 0000 0000 0000 0000 ]