Housekeeping on a few examples
This commit is contained in:
parent
c148f4da81
commit
982f0180e4
|
@ -217,7 +217,7 @@ JMP2r
|
|||
( z = a )
|
||||
,&a LDR DUP ,&z STR
|
||||
( a = z ^ t ^ (z >> 1) ^ (t << 1) )
|
||||
DUP #10 SFT EOR SWP DUP #01 SFT EOR EOR
|
||||
DUP DUP ADD EOR SWP DUP #01 SFT EOR EOR
|
||||
DUP ,&a STR
|
||||
|
||||
JMP2r
|
||||
|
|
|
@ -88,15 +88,15 @@ JMP2r
|
|||
( load ) STH ,&y STR2 ,&x STR2 .line/y STZ2 .line/x STZ2
|
||||
,&x LDR2 .line/x LDZ2 SUB2 ;abs2 JSR2 .line/dx STZ2
|
||||
#0000 ,&y LDR2 .line/y LDZ2 SUB2 ;abs2 JSR2 SUB2 .line/dy STZ2
|
||||
#ffff #00 .line/x LDZ2 ,&x LDR2 ;lts2 JSR2 #10 SFT2 ADD2 ,&sx STR2
|
||||
#ffff #00 .line/y LDZ2 ,&y LDR2 ;lts2 JSR2 #10 SFT2 ADD2 ,&sy STR2
|
||||
#ffff #00 .line/x LDZ2 ,&x LDR2 ;lts2 JSR2 DUP2 ADD2 ADD2 ,&sx STR2
|
||||
#ffff #00 .line/y LDZ2 ,&y LDR2 ;lts2 JSR2 DUP2 ADD2 ADD2 ,&sy STR2
|
||||
.line/dx LDZ2 .line/dy LDZ2 ADD2 .line/e1 STZ2
|
||||
&loop
|
||||
.line/x LDZ2 DUP2 .Screen/x DEO2 [ LIT2 &x $2 ] EQU2
|
||||
.line/y LDZ2 DUP2 .Screen/y DEO2 [ LIT2 &y $2 ] EQU2
|
||||
STHkr .Screen/pixel DEO
|
||||
AND ,&end JCN
|
||||
.line/e1 LDZ2 #10 SFT2 DUP2
|
||||
.line/e1 LDZ2 DUP2 ADD2 DUP2
|
||||
.line/dy LDZ2 ;lts2 JSR2 ,&skipy JCN
|
||||
.line/e1 LDZ2 .line/dy LDZ2 ADD2 .line/e1 STZ2
|
||||
.line/x LDZ2 [ LIT2 &sx $2 ] ADD2 .line/x STZ2
|
||||
|
|
|
@ -35,13 +35,13 @@ BRK
|
|||
STH2k #0000 EQU2 ,&flip-x JCN
|
||||
STH2kr [ LIT2 &hit-hor $2 ] EQU2 ,&flip-x JCN
|
||||
&no-x
|
||||
STH2r [ #00 .dvd/dx LDZ ] #10 SFT2 ADD2 #ffff ADD2 .dvd/x STZ2
|
||||
STH2r [ #00 .dvd/dx LDZ ] DUP2 ADD2 ADD2 #ffff ADD2 .dvd/x STZ2
|
||||
( y )
|
||||
.dvd/y LDZ2
|
||||
STH2k #0000 EQU2 ,&flip-y JCN
|
||||
STH2kr [ LIT2 &hit-ver $2 ] EQU2 ,&flip-y JCN
|
||||
&no-y
|
||||
STH2r [ #00 .dvd/dy LDZ ] #10 SFT2 ADD2 #ffff ADD2 .dvd/y STZ2
|
||||
STH2r [ #00 .dvd/dy LDZ ] DUP2 ADD2 ADD2 #ffff ADD2 .dvd/y STZ2
|
||||
#01 ,draw-dvd JSR
|
||||
|
||||
BRK
|
||||
|
|
|
@ -168,7 +168,7 @@ JMP2r
|
|||
LITr 00
|
||||
#0800
|
||||
&loop
|
||||
#00 OVR #10 SFT2 ;&mask ADD2 LDA2 [ LIT2 &origin $2 ]
|
||||
#00 OVR DUP2 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 #10 SFT2 .anchor/y LDZ2 ADD2 .Screen/y DEO2
|
||||
#00 OVR DUP2 ADD2 .anchor/y LDZ2 ADD2 .Screen/y DEO2
|
||||
STHk
|
||||
#4000
|
||||
&hor
|
||||
#00 OVR #10 SFT2 .anchor/x LDZ2 ADD2 .Screen/x DEO2
|
||||
#00 OVR DUP2 ADD2 .anchor/x LDZ2 ADD2 .Screen/x DEO2
|
||||
DUP STHkr ;get-cell JSR2 INC .Screen/pixel DEO
|
||||
INC GTHk ,&hor JCN
|
||||
POP2
|
||||
|
|
|
@ -30,7 +30,7 @@ BRK
|
|||
@on-frame ( -> )
|
||||
|
||||
.Controller/button DEI
|
||||
DUP #00 NEQ ,&continue JCN
|
||||
DUP ,&continue JCN
|
||||
POP BRK
|
||||
&continue
|
||||
( clear )
|
||||
|
|
|
@ -201,7 +201,7 @@ JMP2r
|
|||
|
||||
@transform ( xy cell -- cell )
|
||||
|
||||
DUP #00 NEQ ,&no-null JCN NIP NIP JMP2r &no-null
|
||||
DUP ,&no-null JCN NIP NIP JMP2r &no-null
|
||||
DUP #03 NEQ ,&no-head JCN POP POP2 #02 JMP2r &no-head
|
||||
DUP #02 NEQ ,&no-tail JCN POP POP2 #01 JMP2r &no-tail
|
||||
DUP #01 NEQ ,&no-cond JCN POP
|
||||
|
|
|
@ -118,7 +118,7 @@ JMP2r
|
|||
;selector-icn .Screen/addr DEO2
|
||||
STHkr .Screen/sprite DEO
|
||||
|
||||
.Screen/y DEI2 #0008 ADD2 .Screen/y DEO2
|
||||
.Screen/y DEI2k #0008 ADD2 ROT DEO2
|
||||
.selection LDZ GET-NOTE STHr ,draw-byte JSR
|
||||
|
||||
JMP2r
|
||||
|
|
|
@ -131,7 +131,7 @@ BRK
|
|||
|
||||
( y ) .modpad-frame/y LDZ2 SUB2 #24 SFT2 NIP STH
|
||||
( x ) .modpad-frame/x LDZ2 SUB2 #04 SFT2
|
||||
( lookup ) STHr ADD #10 SFT2 ;keypad/ops ADD2 LDA2 JSR2
|
||||
( lookup ) STHr ADD DUP2 ADD2 ;keypad/ops ADD2 LDA2 JSR2
|
||||
;draw-bitpad JSR2
|
||||
#00 .Mouse/state DEO POP2
|
||||
|
||||
|
@ -141,7 +141,7 @@ BRK
|
|||
|
||||
POP2
|
||||
.input-frame/x LDZ2 SUB2 #03 SFT2 NIP
|
||||
DUP #00 NEQ ,&no-push JCN
|
||||
DUP ,&no-push JCN
|
||||
;do-push JSR2 &no-push
|
||||
DUP #01 NEQ ,&no-pop JCN
|
||||
;do-pop JSR2 &no-pop
|
||||
|
@ -183,7 +183,7 @@ JMP2r
|
|||
|
||||
@push ( value* -- )
|
||||
|
||||
( store ) .stack/length LDZ #10 SFT .stack/items ADD STZ2
|
||||
( store ) .stack/length LDZ DUP ADD .stack/items ADD STZ2
|
||||
( INCZ ) .stack/length LDZk INC SWP STZ
|
||||
( reset ) #0000 .input/value STZ2
|
||||
#00 ;draw-input JSR2
|
||||
|
@ -193,8 +193,8 @@ JMP2r
|
|||
|
||||
@pop ( -- value* )
|
||||
|
||||
.stack/length LDZ #01 SUB #10 SFT .stack/items ADD LDZ2
|
||||
( clear ) #0000 [ .stack/length LDZ #01 SUB #10 SFT .stack/items ADD ] STZ2
|
||||
.stack/length LDZ #01 SUB DUP ADD .stack/items ADD LDZ2
|
||||
( clear ) #0000 [ .stack/length LDZ #01 SUB DUP ADD .stack/items ADD ] STZ2
|
||||
( DECZ ) .stack/length LDZk #01 SUB SWP STZ
|
||||
#01 ;draw-input JSR2
|
||||
;draw-stack JSR2
|
||||
|
@ -396,7 +396,7 @@ JMP2r
|
|||
.input-frame/x LDZ2 #0018 ADD2 .Screen/x DEO2
|
||||
#00 OVR #30 SFT2 .input-frame/y LDZ2 ADD2 #004c SUB2 .Screen/y DEO2
|
||||
( color ) DUP #08 .stack/length LDZ SUB #01 SUB GTH STH
|
||||
( value ) DUP #10 SFT .stack/items ADD [ #10 .stack/length LDZ #10 SFT SUB SUB ] LDZ2
|
||||
( value ) DUP DUP ADD .stack/items ADD [ #10 .stack/length LDZ DUP ADD SUB SUB ] LDZ2
|
||||
STHr ;draw-number JSR2
|
||||
INC GTHk ,&loop JCN
|
||||
POP2
|
||||
|
|
|
@ -144,15 +144,15 @@ JMP2r
|
|||
( load ) STH ,&y STR2 ,&x STR2 .line/y STZ2 .line/x STZ2
|
||||
,&x LDR2 .line/x LDZ2 SUB2 ;abs2 JSR2 .line/dx STZ2
|
||||
#0000 ,&y LDR2 .line/y LDZ2 SUB2 ;abs2 JSR2 SUB2 .line/dy STZ2
|
||||
#ffff #00 .line/x LDZ2 ,&x LDR2 ;lts2 JSR2 #10 SFT2 ADD2 ,&sx STR2
|
||||
#ffff #00 .line/y LDZ2 ,&y LDR2 ;lts2 JSR2 #10 SFT2 ADD2 ,&sy STR2
|
||||
#ffff #00 .line/x LDZ2 ,&x LDR2 ;lts2 JSR2 DUP2 ADD2 ADD2 ,&sx STR2
|
||||
#ffff #00 .line/y LDZ2 ,&y LDR2 ;lts2 JSR2 DUP2 ADD2 ADD2 ,&sy STR2
|
||||
.line/dx LDZ2 .line/dy LDZ2 ADD2 .line/e1 STZ2
|
||||
&loop
|
||||
.line/x LDZ2 DUP2 .Screen/x DEO2 [ LIT2 &x $2 ] EQU2
|
||||
.line/y LDZ2 DUP2 .Screen/y DEO2 [ LIT2 &y $2 ] EQU2
|
||||
STHkr .Screen/pixel DEO
|
||||
AND ,&end JCN
|
||||
.line/e1 LDZ2 #10 SFT2 DUP2
|
||||
.line/e1 LDZ2 DUP2 ADD2 DUP2
|
||||
.line/dy LDZ2 ;lts2 JSR2 ,&skipy JCN
|
||||
.line/e1 LDZ2 .line/dy LDZ2 ADD2 .line/e1 STZ2
|
||||
.line/x LDZ2 [ LIT2 &sx $2 ] ADD2 .line/x STZ2
|
||||
|
@ -172,12 +172,12 @@ JMP2r
|
|||
#3c00
|
||||
&loop
|
||||
( dots )
|
||||
#00 OVR #10 SFT2 ;table ADD2 LDA2
|
||||
#00 OVR DUP2 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 #10 SFT2 ;table ADD2 LDA2
|
||||
#00 OVR DUP2 ADD2 ;table ADD2 LDA2
|
||||
STH2k #0018 ;circle JSR2 SWP2
|
||||
STH2r #001c ;circle JSR2 SWP2
|
||||
#01 ;draw-line JSR2
|
||||
|
@ -189,14 +189,14 @@ JMP2r
|
|||
|
||||
@make-needles ( -- )
|
||||
|
||||
[ #00 .DateTime/second DEI #1e ADD #3c ;mod JSR2 ] #10 SFT2 ;table ADD2 LDA2
|
||||
[ #00 .DateTime/second DEI #1e ADD #3c ;mod JSR2 ] DUP2 ADD2 ;table ADD2 LDA2
|
||||
#00a0 ,circle JSR .needles/zx STZ2 .needles/zy STZ2
|
||||
[ #00 .DateTime/second DEI ] #10 SFT2 ;table ADD2 LDA2
|
||||
[ #00 .DateTime/second DEI ] DUP2 ADD2 ;table ADD2 LDA2
|
||||
#0020 ,circle JSR .needles/sx STZ2 .needles/sy STZ2
|
||||
[ #00 .DateTime/minute DEI ] #10 SFT2 ;table ADD2 LDA2
|
||||
[ #00 .DateTime/minute DEI ] DUP2 ADD2 ;table ADD2 LDA2
|
||||
#0022 ,circle JSR .needles/mx STZ2 .needles/my STZ2
|
||||
[ #00 .DateTime/hour DEI #0c ;mod JSR2 #20 SFTk NIP ADD ]
|
||||
( minute offset ) [ #00 .DateTime/minute DEI #0f DIV ADD2 ] #10 SFT2 ;table ADD2 LDA2
|
||||
( minute offset ) [ #00 .DateTime/minute DEI #0f DIV ADD2 ] DUP2 ADD2 ;table ADD2 LDA2
|
||||
#002a ,circle JSR .needles/hx STZ2 .needles/hy STZ2
|
||||
|
||||
JMP2r
|
||||
|
|
Loading…
Reference in New Issue