Examples cleanup

This commit is contained in:
neauoire 2021-08-17 19:40:07 -07:00
parent 5167a103ec
commit da229d5a82
7 changed files with 33 additions and 34 deletions

View File

@ -9,7 +9,6 @@
%RTN { JMP2r }
%TOS { #00 SWP }
%MOD { DUP2 / * - }
%LTS2 { #8000 ++ SWP2 #8000 ++ >> }
%GTS2 { #8000 ++ SWP2 #8000 ++ << }
%2/ { #01 SFT }
%2// { #01 SFT2 }
@ -268,13 +267,13 @@ RTN
.octave-view/x1 LDZ2 .octave-view/y1 LDZ2
OVR2 OVR2 ;keys-left-icns #01 .last-note LDZ #00 = + ;draw-key JSR2
OVR2 #0008 ++ OVR2 ;keys-middle-icns #01 .last-note LDZ #02 = + ;draw-key JSR2
OVR2 #0010 ++ OVR2 ;keys-right-icns #01 .last-note LDZ #04 = + ;draw-key JSR2
OVR2 #0018 ++ OVR2 ;keys-left-icns #01 .last-note LDZ #05 = + ;draw-key JSR2
OVR2 #0020 ++ OVR2 ;keys-middle-icns #01 .last-note LDZ #07 = + ;draw-key JSR2
OVR2 #0028 ++ OVR2 ;keys-middle-icns #01 .last-note LDZ #09 = + ;draw-key JSR2
SWP2 #0030 ++ SWP2 ;keys-right-icns #01 .last-note LDZ #0b = + ;draw-key JSR2
OVR2 OVR2 ;keys-left-icns .last-note LDZ #00 = INC ;draw-key JSR2
OVR2 #0008 ++ OVR2 ;keys-middle-icns .last-note LDZ #02 = INC ;draw-key JSR2
OVR2 #0010 ++ OVR2 ;keys-right-icns .last-note LDZ #04 = INC ;draw-key JSR2
OVR2 #0018 ++ OVR2 ;keys-left-icns .last-note LDZ #05 = INC ;draw-key JSR2
OVR2 #0020 ++ OVR2 ;keys-middle-icns .last-note LDZ #07 = INC ;draw-key JSR2
OVR2 #0028 ++ OVR2 ;keys-middle-icns .last-note LDZ #09 = INC ;draw-key JSR2
SWP2 #0030 ++ SWP2 ;keys-right-icns .last-note LDZ #0b = INC ;draw-key JSR2
.octave-view/x1 LDZ2 #0048 ++ .Screen/x DEO2

View File

@ -60,7 +60,7 @@ BRK
.counter LDZ #18 MOD #30 ADD
.Audio0/pitch .counter LDZ #03 AND #40 SFT ADD DEO
.counter LDZ #01 ADD .counter STZ
.counter LDZ INC .counter STZ
#00 .timer STZ
BRK

View File

@ -10,8 +10,7 @@
;hello-word
&while
( send ) LDAk .Console/write DEO
( incr ) #0001 ADD2
( loop ) LDAk ,&while JCN
INC2 LDAk ,&while JCN
POP2
( show debugger ) #01 .System/debug DEO

View File

@ -146,21 +146,21 @@ RTN
@line-rect ( x1* y1* x2* y2* color -- )
( load ) .color STZ DUP2 STH2 .rect/y2 STZ2 .rect/x2 STZ2 DUP2 STH2 .rect/y1 STZ2 .rect/x1 STZ2
STH2r #0001 ++ STH2r
STH2r INC2 STH2r
&ver
( save ) OVR2 .Screen/y DEO2
( draw ) .rect/x1 LDZ2 .Screen/x DEO2 .color LDZ DUP .Screen/pixel DEO
( draw ) .rect/x2 LDZ2 .Screen/x DEO2 .Screen/pixel DEO
( incr ) SWP2 #0001 ++ SWP2
( incr ) SWP2 INC2 SWP2
OVR2 OVR2 LTS2 ,&ver JCN
POP2 POP2
.rect/x1 LDZ2 #0001 ++ .rect/x2 LDZ2 #0001 --
.rect/x1 LDZ2 INC2 .rect/x2 LDZ2 #0001 --
&hor
( save ) OVR2 .Screen/x DEO2
( draw ) .rect/y1 LDZ2 .Screen/y DEO2 .color LDZ DUP .Screen/pixel DEO
( draw ) .rect/y2 LDZ2 .Screen/y DEO2 .Screen/pixel DEO
( incr ) SWP2 #0001 ++ SWP2
OVR2 OVR2 #0001 ++ LTS2 ,&hor JCN
( incr ) SWP2 INC2 SWP2
OVR2 OVR2 INC2 LTS2 ,&hor JCN
POP2 POP2
RTN

View File

@ -71,14 +71,13 @@ BRK
#0080 SCALEX #0080 SCALEY .needles/hx LDZ2 .needles/hy LDZ2 #03 ;draw-line JSR2
( circle )
#00 #3c
#3c #00
&loop
( load ) OVR #00 SWP 2** ;table ADD2 LDA2
( load ) DUP #00 SWP 2** ;table ADD2 LDA2
#00 SWP SCALEY .Screen/y DEO2
#00 SWP SCALEX .Screen/x DEO2
OVR #0f MOD #00 EQU #01 ADD .Screen/pixel DEO
( incr ) SWP #01 ADD SWP
LTHk ,&loop JCN
DUP #0f MOD #00 EQU INC .Screen/pixel DEO
INC GTHk ,&loop JCN
POP2
;draw-display JSR2

View File

@ -1,6 +1,8 @@
( dev/screen )
%RTN { JMP2r }
%2/ { #01 SFT }
%4/ { #02 SFT }
( devices )
@ -42,7 +44,7 @@ BRK
@on-frame ( -> )
.count LDZ2 #0001 ADD2 [ DUP2 ] .count STZ2
.count LDZ2 INC2 [ DUP2 ] .count STZ2
.center/x LDZ2 #0048 ADD2 .Screen/x DEO2
.center/y LDZ2 #0050 SUB2 .Screen/y DEO2
@ -79,7 +81,7 @@ BRK
.center/y LDZ2 #0040 SUB2 ADD2 .Screen/y DEO2
.center/x LDZ2 #0050 SUB2 .Screen/x DEO2
( draw ) #01 .Screen/sprite DEO
#01 ADD GTHk ,&loop JCN
INC GTHk ,&loop JCN
POP2
RTN
@ -89,12 +91,12 @@ RTN
;preview_icn .Screen/addr DEO2
#00 #00
&loop
( move ) DUP #0f AND #40 SFT #02 DIV #00 SWP
( move ) DUP #0f AND #40 SFT 2/ #00 SWP
.center/x LDZ2 #0040 SUB2 ADD2 .Screen/x DEO2
( move ) DUP #f0 AND #02 DIV #00 SWP
( move ) DUP #f0 AND 2/ #00 SWP
.center/y LDZ2 #0040 SUB2 ADD2 .Screen/y DEO2
( draw ) DUP .Screen/sprite DEO
#01 ADD NEQk ,&loop JCN
INC NEQk ,&loop JCN
POP2
RTN
@ -104,12 +106,12 @@ RTN
#10 #00
&loop
( color ) STHk
( y ) DUP #04 DIV [ #00 SWP ] #40 SFT2
( y ) DUP 4/ [ #00 SWP ] #40 SFT2
[ .center/y LDZ2 #0040 SUB2 ADD2 ] STH2
( x ) DUP #03 AND [ #00 SWP ] #40 SFT2 #0040 ADD2
[ .center/x LDZ2 #0008 ADD2 ADD2 ]
STH2r STHr #00 ;draw-circle JSR2
#01 ADD GTHk ,&loop JCN
INC GTHk ,&loop JCN
POP2
RTN
@ -119,12 +121,12 @@ RTN
#10 #00
&loop
( color ) STHk
( y ) DUP #04 DIV [ #00 SWP ] #40 SFT2
( y ) DUP 4/ [ #00 SWP ] #40 SFT2
[ .center/y LDZ2 ADD2 ] STH2
( x ) DUP #03 AND [ #00 SWP ] #40 SFT2 #0040 ADD2
[ .center/x LDZ2 #0008 ADD2 ADD2 ]
STH2r STHr #80 ;draw-circle JSR2
#01 ADD GTHk ,&loop JCN
INC GTHk ,&loop JCN
POP2
RTN

View File

@ -53,7 +53,7 @@ RTN
.label/addr LDZ2
&loop
( draw ) LDAk #00 SWP 8** ;font ADD2 .Screen/addr DEO2 .label/color LDZ .Screen/sprite DEO
( incr ) #0001 ADD2
( incr ) INC2
( incr ) .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
LDAk ,&loop JCN
POP2
@ -67,7 +67,7 @@ RTN
.label/addr LDZ2
&loop
( draw ) LDAk #00 SWP 8** ;font ADD2 .Screen/addr DEO2 .label/color LDZ .Screen/sprite DEO
( incr ) #0001 ADD2
( incr ) INC2
( incr ) .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
LDAk ,&loop JCN
POP2
@ -81,7 +81,7 @@ RTN
.label/addr LDZ2
&loop
( draw ) LDAk #00 SWP 8** ;font ADD2 .Screen/addr DEO2 .label/color LDZ .Screen/sprite DEO
( incr ) #0001 ADD2
( incr ) INC2
( incr ) .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
LDAk ,&loop JCN
POP2
@ -92,7 +92,7 @@ RTN
#0000 ( counter )
&loop
( incr ) #0001 ADD2 OVR2 OVR2 ADD2
( incr ) INC2 OVR2 OVR2 ADD2
LDA ,&loop JCN
NIP2