commit b94d0204c2b5d86c8662fc9652afc63b32be86d7
parent 861c8494a878daa2acf09a0e5d5b56f2edd85b2e
Author: Devine Lu Linvega <aliceffekt@gmail.com>
Date: Fri, 22 Jul 2022 11:57:45 -0700
Housekeeping on some of the example files
Diffstat:
10 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/projects/examples/demos/bunnymark.tal b/projects/examples/demos/bunnymark.tal
@@ -183,7 +183,7 @@ JMP2r
;sprite/length LDA2
( don't let length go below 0 )
- DUP2 #0000 EQU2 ,&bail JCN
+ ORAk #00 EQU ,&bail JCN
( clear the old sprite location )
DUP2 #0001 SUB2 #30 SFT2 ;sprite/array ADD2
( top )
@@ -217,7 +217,7 @@ JMP2r
( z = a )
,&a LDR DUP ,&z STR
( a = z ^ t ^ (z >> 1) ^ (t << 1) )
- DUP DUP ADD EOR SWP DUP #01 SFT EOR EOR
+ DUPk ADD EOR SWP DUP #01 SFT EOR EOR
DUP ,&a STR
JMP2r
diff --git a/projects/examples/demos/cube3d.tal b/projects/examples/demos/cube3d.tal
@@ -43,22 +43,22 @@ BRK
STHk
#00 .timer LDZ [ #00 STHkr INC #07 AND #60 SFT ADD2 ] #00ff AND2 ;table ADD2 LDA #01 SFT
#00 .timer LDZ [ #00 STHkr #60 SFT ADD2 ] #00ff AND2 ;table ADD2 LDA #02 SFT [ #00 STHkr #62 SFT2 ADD2 ]
- .cube/v0 STHr #10 SFT ADD STZ2
+ .cube/v0 STHr DUP ADD ADD STZ2
INC GTHk ,&loop JCN
POP2
( vertices )
#0800
&ver-loop
- DUP #10 SFT .cube ADD LDZ2 ;draw-vertex JSR2
+ DUP DUP ADD .cube ADD LDZ2 ;draw-vertex JSR2
INC GTHk ,&ver-loop JCN
POP2
( lines )
#0400
&line-loop
STHk
- .cube/v0 STHkr #10 SFT ADD .cube/v0 STHkr INC #03 AND #10 SFT ADD ,trace JSR
- .cube/v0 STHkr #10 SFT ADD .cube/v4 STHkr #10 SFT ADD ,trace JSR
- .cube/v4 STHkr #10 SFT ADD .cube/v4 STHr INC #03 AND #10 SFT ADD ,trace JSR
+ .cube/v0 STHkr DUP ADD ADD .cube/v0 STHkr INC #03 AND DUP ADD ADD ,trace JSR
+ .cube/v0 STHkr DUP ADD ADD .cube/v4 STHkr DUP ADD ADD ,trace JSR
+ .cube/v4 STHkr DUP ADD ADD .cube/v4 STHr INC #03 AND DUP ADD ADD ,trace JSR
INC GTHk ,&line-loop JCN
POP2
diff --git a/projects/examples/demos/drool.tal b/projects/examples/demos/drool.tal
@@ -22,7 +22,7 @@
#00 .DateTime/minute DEI #60 SFT2 EOR2
#00 .DateTime/hour DEI #c0 SFT2 EOR2 ;prng/x STA2
#00 .DateTime/hour DEI #04 SFT2
- #00 .DateTime/day DEI #10 SFT2 EOR2
+ #00 .DateTime/day DEI DUP2 ADD2 EOR2
#00 .DateTime/month DEI #60 SFT2 EOR2
.DateTime/year DEI2 #a0 SFT2 EOR2 ;prng/y STA2
;prng/x LDA2 ;prng/y LDA2 EOR2
@@ -160,7 +160,7 @@
( rabbit is in-between two frames )
#08 OVR SUB ,&from-weight STR
,&to-weight STR ( color n / frame )
- #00 SWP #10 SFT2 ;rabbits ADD2 #00c8 #00 STHr MUL2 ADD2 ( color from-addr* )
+ #00 SWP DUP2 ADD2 ;rabbits ADD2 #00c8 #00 STHr MUL2 ADD2 ( color from-addr* )
LDA2k STH2 #00c8 ADD2 LDA2
&draw ( color to-x to-y / from-x from-y )
STHr ,&mix JSR LIT2 &yoffset $2 ADD2 .Screen/y DEO2
@@ -181,7 +181,7 @@
&static ( color n counter / frame )
INCr
POP
- #00 SWP #10 SFT2 ;rabbits ADD2 #00c8 #00 STHr MUL2 ADD2
+ #00 SWP DUP2 ADD2 ;rabbits ADD2 #00c8 #00 STHr MUL2 ADD2
LDA2 STH2k
,&draw JMP
diff --git a/projects/examples/demos/life.tal b/projects/examples/demos/life.tal
@@ -168,7 +168,7 @@ JMP2r
LITr 00
#0800
&loop
- #00 OVR DUP2 ADD2 ;&mask ADD2 LDA2 [ LIT2 &origin $2 ]
+ #00 OVRk ADD2 ;&mask ADD2 LDA2 [ LIT2 &origin $2 ]
ROT ADD STH ADD STHr ;get-cell JSR2 STH ADDr
INC GTHk ,&loop JCN
POP2
@@ -187,11 +187,11 @@ JMP2r
#00 .Screen/auto DEO
#4000
&ver
- #00 OVR DUP2 ADD2 .anchor/y LDZ2 ADD2 .Screen/y DEO2
+ #00 OVRk ADD2 .anchor/y LDZ2 ADD2 .Screen/y DEO2
STHk
#4000
&hor
- #00 OVR DUP2 ADD2 .anchor/x LDZ2 ADD2 .Screen/x DEO2
+ #00 OVRk ADD2 .anchor/x LDZ2 ADD2 .Screen/x DEO2
DUP STHkr ;get-cell JSR2 INC .Screen/pixel DEO
INC GTHk ,&hor JCN
POP2
diff --git a/projects/examples/demos/wireworld.tal b/projects/examples/demos/wireworld.tal
@@ -217,8 +217,8 @@ JMP2r
( bl ) #0001 SUB2 LDAk #03 NEQ JMP INCr
( bc ) INC2 LDAk #03 NEQ JMP INCr
( br ) INC2 LDA #03 NEQ JMP INCr
- STHkr #02 EQU STHr #01 EQU #0000 GTH2
- #10 SFT INC JMP2r
+ STHkr #02 EQU STHr #01 EQU ORA
+ DUP ADD INC JMP2r
&no-cond
( unknown )
NIP NIP
diff --git a/projects/examples/devices/controller.tal b/projects/examples/devices/controller.tal
@@ -81,7 +81,7 @@ BRK
#03 STHkr #03 SFT #01 AND DUP ADD SUB .Screen/sprite DEO
( buttons )
- .center/y LDZ2 #0000 ADD2 .Screen/y DEO2
+ .center/y LDZ2 .Screen/y DEO2
.center/x LDZ2 #0018 ADD2 .Screen/x DEO2
;controller-icn/button .Screen/addr DEO2
#03 STHkr #01 SFT #01 AND SUB .Screen/sprite DEO
@@ -89,7 +89,7 @@ BRK
;font-hex #0058 ADD2 .Screen/addr DEO2
#03 .Screen/sprite DEO
- .center/y LDZ2 #0000 ADD2 .Screen/y DEO2
+ .center/y LDZ2 .Screen/y DEO2
.center/x LDZ2 #0024 ADD2 .Screen/x DEO2
;controller-icn/button .Screen/addr DEO2
#03 STHr #01 AND SUB .Screen/sprite DEO
diff --git a/projects/examples/exercises/primes.tal b/projects/examples/exercises/primes.tal
@@ -4,7 +4,7 @@
|0100 ( -> ) @reset
- #0000 #0001
+ #0000 INC2k
&loop
DUP2 ,is-prime JSR #00 EQU ,&skip JCN
( print ) DUP2 ,print/short JSR
diff --git a/projects/examples/exercises/subleq.tal b/projects/examples/exercises/subleq.tal
@@ -30,14 +30,14 @@ BRK
.a LDZ2 #ffff EQU2 ,&input JCN
.b LDZ2 #ffff EQU2 ,&output JCN
( SUBLEQ )
- .b LDZ2 STH2k ,&get JSR .a LDZ2 ,&get JSR SUB2 STH2r #10 SFT2 ;program ADD2 STA2
+ .b LDZ2 STH2k ,&get JSR .a LDZ2 ,&get JSR SUB2 STH2r DUP2 ADD2 ;program ADD2 STA2
( SET )
.b LDZ2 ,&get JSR #0001 SUB2 #8000 LTH2 ,&end JCN POP2 .c LDZ2 &end
JMP2r
&input ( -- ) JMP2r
&output ( -- ) .a LDZ2 ,&get JSR NIP #18 DEO JMP2r
- &get ( a* -- b* ) #10 SFT2 ;program ADD2 LDA2 JMP2r
+ &get ( a* -- b* ) DUP2 ADD2 ;program ADD2 LDA2 JMP2r
@program ( hello world )
000f 0011 ffff 0011 ffff ffff 0010 0001
diff --git a/projects/software/clock.tal b/projects/software/clock.tal
@@ -172,12 +172,12 @@ JMP2r
#3c00
&loop
( dots )
- #00 OVR DUP2 ADD2 ;table ADD2 LDA2
+ #00 OVRk ADD2 ;table ADD2 LDA2
#0018 ;circle JSR2
.Screen/x DEO2 .Screen/y DEO2 #01 .Screen/pixel DEO
( markers )
DUP #05 ;mod JSR2 ,&no-marker JCN
- #00 OVR DUP2 ADD2 ;table ADD2 LDA2
+ #00 OVRk ADD2 ;table ADD2 LDA2
STH2k #0018 ;circle JSR2 SWP2
STH2r #001c ;circle JSR2 SWP2
#01 ;draw-line JSR2
diff --git a/projects/software/neralie.tal b/projects/software/neralie.tal
@@ -207,7 +207,7 @@ JMP2r
.Screen/y .lines/addr STZ
&draw-line ( v1* v2* -- )
- OVR2 OVR2 LTH2 #01 JCN SWP2
+ LTH2k #01 JCN SWP2
STH2
&loop
@@ -231,7 +231,7 @@ JMP2r
JMP2r
@modf ( dividend* divisor* SUB2 remainder* quotient* )
- OVR2 OVR2 DIV2 STH2k MUL2 SUB2 STH2r JMP2r
+ DIV2k STH2k MUL2 SUB2 STH2r JMP2r
@mul2hi ( a* b* -- product-top-16-bits* )
(