Housekeeping on some of the example files

This commit is contained in:
Devine Lu Linvega 2022-07-22 11:57:45 -07:00
parent 861c8494a8
commit b94d0204c2
10 changed files with 24 additions and 24 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -4,7 +4,7 @@
|0100 ( -> ) @reset
#0000 #0001
#0000 INC2k
&loop
DUP2 ,is-prime JSR #00 EQU ,&skip JCN
( print ) DUP2 ,print/short JSR

View File

@ -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

View File

@ -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

View File

@ -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* )
(