General improvements to example files

This commit is contained in:
Devine Lu Linvega 2022-05-31 13:25:41 -07:00
parent 8176ab93c8
commit 852e33e6f3
19 changed files with 136 additions and 338 deletions

View File

@ -117,7 +117,7 @@ echo "Assembling(asma).."
if [ $norun = 1 ]; then exit; fi if [ $norun = 1 ]; then exit; fi
echo "Assembling(piano).." echo "Assembling(piano).."
bin/uxncli bin/asma.rom projects/examples/demos/piano.tal bin/piano.rom 2> bin/piano.log bin/uxncli bin/asma.rom projects/software/piano.tal bin/piano.rom 2> bin/piano.log
echo "Running.." echo "Running.."
cd bin cd bin

View File

@ -130,11 +130,11 @@ JMP2r
#00 EQU ,&dead JCN #00 EQU ,&dead JCN
DUP #02 LTH ,&dies JCN DUP #02 LTH ,&dies JCN
DUP #03 GTH ,&dies JCN DUP #03 GTH ,&dies JCN
POP ,&save JSR JMP2r POP ;&save JSR2 JMP2r
&dies POP POP2 JMP2r &dies POP POP2 JMP2r
&dead &dead
DUP #03 EQU ,&birth JCN POP POP2 JMP2r DUP #03 EQU ,&birth JCN POP POP2 JMP2r
&birth POP ,&save JSR JMP2r &birth POP ;&save JSR2
JMP2r JMP2r
&save ( x y -- ) &save ( x y -- )

View File

@ -54,7 +54,7 @@ BRK
#81 .Screen/sprite DEO #81 .Screen/sprite DEO
( eye/tail ) ( eye/tail )
#00 ,draw-eye JSR #00 ,draw-eye JSR
#00 ,draw-tail JSR #00 ;draw-tail JSR2
JMP2r JMP2r

View File

@ -56,17 +56,17 @@ BRK
.frame/x0 LDZ2 #0010 ADD2 .Screen/x DEO2 .frame/x0 LDZ2 #0010 ADD2 .Screen/x DEO2
.frame/y0 LDZ2 #0010 ADD2 .Screen/y DEO2 .frame/y0 LDZ2 #0010 ADD2 .Screen/y DEO2
;controller-icn/dpad-up .Screen/addr DEO2 ;controller-icn/dpad-up .Screen/addr DEO2
#03 [ STHkr #04 SFT #01 AND DUP ADD SUB ] .Screen/sprite DEO #03 STHkr #04 SFT #01 AND DUP ADD SUB .Screen/sprite DEO
.Screen/y DEI2 #0010 ADD2 .Screen/y DEO2 .Screen/y DEI2 #0010 ADD2 .Screen/y DEO2
;controller-icn/dpad-down .Screen/addr DEO2 ;controller-icn/dpad-down .Screen/addr DEO2
#03 [ STHkr #05 SFT #01 AND DUP ADD SUB ] .Screen/sprite DEO #03 STHkr #05 SFT #01 AND DUP ADD SUB .Screen/sprite DEO
.Screen/y DEI2 #0008 SUB2 .Screen/y DEO2 .Screen/y DEI2 #0008 SUB2 .Screen/y DEO2
.Screen/x DEI2 #0008 SUB2 .Screen/x DEO2 .Screen/x DEI2 #0008 SUB2 .Screen/x DEO2
;controller-icn/dpad-left .Screen/addr DEO2 ;controller-icn/dpad-left .Screen/addr DEO2
#03 [ STHkr #06 SFT #01 AND DUP ADD SUB ] .Screen/sprite DEO #03 STHkr #06 SFT #01 AND DUP ADD SUB .Screen/sprite DEO
.Screen/x DEI2 #0010 ADD2 .Screen/x DEO2 .Screen/x DEI2 #0010 ADD2 .Screen/x DEO2
;controller-icn/dpad-right .Screen/addr DEO2 ;controller-icn/dpad-right .Screen/addr DEO2
#03 [ STHkr #07 SFT #01 AND DUP ADD SUB ] .Screen/sprite DEO #03 STHkr #07 SFT #01 AND DUP ADD SUB .Screen/sprite DEO
.Screen/x DEI2 #0008 SUB2 .Screen/x DEO2 .Screen/x DEI2 #0008 SUB2 .Screen/x DEO2
;controller-icn/dpad .Screen/addr DEO2 ;controller-icn/dpad .Screen/addr DEO2
#03 .Screen/sprite DEO #03 .Screen/sprite DEO
@ -75,26 +75,26 @@ BRK
.center/y LDZ2 #0009 ADD2 .Screen/y DEO2 .center/y LDZ2 #0009 ADD2 .Screen/y DEO2
.center/x LDZ2 #0009 SUB2 .Screen/x DEO2 .center/x LDZ2 #0009 SUB2 .Screen/x DEO2
;controller-icn/option .Screen/addr DEO2 ;controller-icn/option .Screen/addr DEO2
#03 [ STHkr #02 SFT #01 AND DUP ADD SUB ] .Screen/sprite DEO #03 STHkr #02 SFT #01 AND DUP ADD SUB .Screen/sprite DEO
.center/x LDZ2 #0004 ADD2 .Screen/x DEO2 .center/x LDZ2 #0004 ADD2 .Screen/x DEO2
;controller-icn/option .Screen/addr DEO2 ;controller-icn/option .Screen/addr DEO2
#03 [ STHkr #03 SFT #01 AND DUP ADD SUB ] .Screen/sprite DEO #03 STHkr #03 SFT #01 AND DUP ADD SUB .Screen/sprite DEO
( buttons ) ( buttons )
.center/y LDZ2 #0000 ADD2 .Screen/y DEO2 .center/y LDZ2 #0000 ADD2 .Screen/y DEO2
.center/x LDZ2 #0018 ADD2 .Screen/x DEO2 .center/x LDZ2 #0018 ADD2 .Screen/x DEO2
;controller-icn/button .Screen/addr DEO2 ;controller-icn/button .Screen/addr DEO2
#03 [ STHkr #01 SFT #01 AND SUB ] .Screen/sprite DEO #03 STHkr #01 SFT #01 AND SUB .Screen/sprite DEO
.Screen/y DEI2 #000a ADD2 .Screen/y DEO2 .Screen/y DEI2 #000a ADD2 .Screen/y DEO2
;font-hex #000b #30 SFT2 ADD2 .Screen/addr DEO2 ;font-hex #0058 ADD2 .Screen/addr DEO2
#03 .Screen/sprite DEO #03 .Screen/sprite DEO
.center/y LDZ2 #0000 ADD2 .Screen/y DEO2 .center/y LDZ2 #0000 ADD2 .Screen/y DEO2
.center/x LDZ2 #0024 ADD2 .Screen/x DEO2 .center/x LDZ2 #0024 ADD2 .Screen/x DEO2
;controller-icn/button .Screen/addr DEO2 ;controller-icn/button .Screen/addr DEO2
#03 [ STHr #01 AND SUB ] .Screen/sprite DEO #03 STHr #01 AND SUB .Screen/sprite DEO
.Screen/y DEI2 #000a ADD2 .Screen/y DEO2 .Screen/y DEI2 #000a ADD2 .Screen/y DEO2
;font-hex #000a #30 SFT2 ADD2 .Screen/addr DEO2 ;font-hex #0050 ADD2 .Screen/addr DEO2
#03 .Screen/sprite DEO #03 .Screen/sprite DEO
.center/x LDZ2 #0010 SUB2 .Screen/x DEO2 .center/x LDZ2 #0010 SUB2 .Screen/x DEO2

View File

@ -36,7 +36,7 @@ BRK
.Mouse/y DEI2 DUP2 .pointer/y STZ2 .Screen/y DEO2 .Mouse/y DEI2 DUP2 .pointer/y STZ2 .Screen/y DEO2
#43 .Mouse/state DEI #00 NEQ DUP ADD SUB .Screen/sprite DEO #43 .Mouse/state DEI #00 NEQ DUP ADD SUB .Screen/sprite DEO
( on down ) ( on down )
.Mouse/state DEI #00 NEQ .pointer/state LDZ #00 EQU #0101 EQU2 ,on-mouse-down JCN .Mouse/state DEI #00 NEQ .pointer/state LDZ #00 EQU AND ,on-mouse-down JCN
( on drag ) ( on drag )
.Mouse/state DEI ,on-mouse-drag JCN .Mouse/state DEI ,on-mouse-drag JCN
.Mouse/state DEI .pointer/state STZ .Mouse/state DEI .pointer/state STZ

View File

@ -1,10 +1,5 @@
( GUI Hover ) ( GUI Hover )
%RTN { JMP2r }
%GTS2 { #8000 ADD2 SWP2 #8000 ADD2 LTH2 }
( devices )
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ] |00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ] |20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
|90 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &wheel $1 ] |90 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &wheel $1 ]
@ -15,7 +10,6 @@
@color $1 @color $1
@pointer [ &x $2 &y $2 &sprite $2 ] @pointer [ &x $2 &y $2 &sprite $2 ]
@rect [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ]
@r1 [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ] @r1 [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ]
@r2 [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ] @r2 [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ]
@r3 [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ] @r3 [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ]
@ -80,19 +74,19 @@ BRK
@within-rect ( x* y* rect -- flag ) @within-rect ( x* y* rect -- flag )
STH STH
( y < rect.y1 ) DUP2 STHkr #02 ADD LDZ2 LTH2 ,&skip JCN ( y < rect.y1 ) DUP2 STHkr INC INC LDZ2 LTH2 ,&skip JCN
( y > rect.y2 ) DUP2 STHkr #06 ADD LDZ2 GTH2 ,&skip JCN ( y > rect.y2 ) DUP2 STHkr #06 ADD LDZ2 GTH2 ,&skip JCN
SWP2 SWP2
( x < rect.x1 ) DUP2 STHkr LDZ2 LTH2 ,&skip JCN ( x < rect.x1 ) DUP2 STHkr LDZ2 LTH2 ,&skip JCN
( x > rect.x2 ) DUP2 STHkr #04 ADD LDZ2 GTH2 ,&skip JCN ( x > rect.x2 ) DUP2 STHkr #04 ADD LDZ2 GTH2 ,&skip JCN
POP2 POP2 POPr POP2 POP2 POPr
#01 #01
RTN JMP2r
&skip &skip
POP2 POP2 POPr POP2 POP2 POPr
#00 #00
RTN JMP2r
@line-rect ( x1* y1* x2* y2* color -- ) @line-rect ( x1* y1* x2* y2* color -- )
@ -119,7 +113,7 @@ RTN
POP2 POP2 POP2 POP2
POPr POPr
RTN JMP2r
@pointer_icn [ 80c0 e0f0 f8e0 1000 ] @pointer_icn [ 80c0 e0f0 f8e0 1000 ]
@hand_icn [ 4040 4070 f8f8 f870 ] @hand_icn [ 4040 4070 f8f8 f870 ]

View File

@ -1,13 +1,4 @@
( Draw a 8x8 font ) ( GUI Monospace )
%+ { ADD } %- { SUB } %* { MUL } %/ { DIV }
%< { LTH } %> { GTH } %= { EQU } %! { NEQ }
%++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 }
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
%AUTO-X { #01 .Screen/auto DEO }
( devices )
|00 @System &vector $2 &wst $1 &rst $1 &eaddr $2 &ecode $1 &pad $1 &r $2 &g $2 &b $2 &debug $1 &halt $1 |00 @System &vector $2 &wst $1 &rst $1 &eaddr $2 &ecode $1 &pad $1 &r $2 &g $2 &b $2 &debug $1 &halt $1
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 |20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
@ -39,10 +30,10 @@ BRK
@draw-uf1 ( string* color -- ) @draw-uf1 ( string* color -- )
AUTO-X #01 .Screen/auto DEO
STH STH
&while &while
( get sprite ) LDAk #20 - #00 SWP #30 SFT2 ;font ++ .Screen/addr DEO2 ( get sprite ) LDAk #20 SUB #00 SWP #30 SFT2 ;font ADD2 .Screen/addr DEO2
( draw ) STHkr .Screen/sprite DEO ( draw ) STHkr .Screen/sprite DEO
INC2 LDAk ,&while JCN INC2 LDAk ,&while JCN
POPr POPr
@ -53,15 +44,15 @@ JMP2r
@draw-uf1-linebreaks ( string* color -- ) @draw-uf1-linebreaks ( string* color -- )
.Screen/x DEI2 ,&anchor STR2 .Screen/x DEI2 ,&anchor STR2
AUTO-X #01 .Screen/auto DEO
STH STH
&while &while
LDAk #0a ! ,&no-lb JCN LDAk #0a NEQ ,&no-lb JCN
( rewind ) LIT2 &anchor $2 .Screen/x DEO2 ( rewind ) LIT2 &anchor $2 .Screen/x DEO2
( skip line ) .Screen/y DEI2k #0008 ++ ROT DEO2 ( skip line ) .Screen/y DEI2k #0008 ADD2 ROT DEO2
,&end JMP ,&end JMP
&no-lb &no-lb
( get sprite ) LDAk #20 - #00 SWP #30 SFT2 ;font ++ .Screen/addr DEO2 ( get sprite ) LDAk #20 SUB #00 SWP #30 SFT2 ;font ADD2 .Screen/addr DEO2
( draw ) STHkr .Screen/sprite DEO ( draw ) STHkr .Screen/sprite DEO
&end &end
INC2 LDAk ,&while JCN INC2 LDAk ,&while JCN

View File

@ -1,15 +1,5 @@
( GUI Picture ) ( GUI Picture )
%+ { ADD } %- { SUB } %* { MUL } %/ { DIV }
%< { LTH } %> { GTH } %= { EQU } %! { NEQ }
%++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 }
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
%AUTO-NONE { #00 .Screen/auto DEO }
%AUTO-XADDR { #05 .Screen/auto DEO }
( devices )
|00 @System &vector $2 &wst $1 &rst $1 &eaddr $2 &ecode $1 &pad $1 &r $2 &g $2 &b $2 &debug $1 &halt $1 |00 @System &vector $2 &wst $1 &rst $1 &eaddr $2 &ecode $1 &pad $1 &r $2 &g $2 &b $2 &debug $1 &halt $1
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 |20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
@ -38,7 +28,7 @@ BRK
@draw-icn ( addr* width height color -- ) @draw-icn ( addr* width height color -- )
AUTO-XADDR #05 .Screen/auto DEO
STH STH
( set bounds ) ,&height STR ,&width STR .Screen/addr DEO2 ( set bounds ) ,&height STR ,&width STR .Screen/addr DEO2
( set origin ) .Screen/x DEI2 ,&x STR2 ( set origin ) .Screen/x DEI2 ,&x STR2
@ -50,11 +40,11 @@ BRK
STHkr .Screen/sprite DEO STHkr .Screen/sprite DEO
INC GTHk ,&hor JCN INC GTHk ,&hor JCN
POP2 POP2
.Screen/y DEI2k #0008 ++ ROT DEO2 .Screen/y DEI2k #0008 ADD2 ROT DEO2
INC GTHk ,&ver JCN INC GTHk ,&ver JCN
POP2 POP2
POPr POPr
AUTO-NONE #00 .Screen/auto DEO
JMP2r JMP2r
@ -64,7 +54,7 @@ JMP2r
STH STH
.Screen/addr DEO2 .Screen/addr DEO2
SWP #01 - #40 SFT #06 + .Screen/auto DEO SWP #01 SUB #40 SFT #06 ADD .Screen/auto DEO
#00 #00
&loop &loop
STHkr .Screen/sprite DEO STHkr .Screen/sprite DEO

View File

@ -1,7 +1,5 @@
( GUI Shapes ) ( GUI Shapes )
%RTN { JMP2r }
%8++ { #0008 ADD2 }
%2** { #10 SFT2 } %2** { #10 SFT2 }
%4** { #20 SFT2 } %4** { #20 SFT2 }
%2// { #01 SFT2 } %2// { #01 SFT2 }
@ -10,10 +8,6 @@
%LTS2 { #8000 ADD2 SWP2 #8000 ADD2 GTH2 } %LTS2 { #8000 ADD2 SWP2 #8000 ADD2 GTH2 }
%GTS2 { #8000 ADD2 SWP2 #8000 ADD2 LTH2 } %GTS2 { #8000 ADD2 SWP2 #8000 ADD2 LTH2 }
%SIZE-TO-RECT {
STH2 STH2 OVR2 STH2r ADD2 OVR2 STH2r ADD2
} ( x y w h -- x1 y1 x2 y2 )
%WIDTH { #0100 } %HEIGHT { #00a0 } %WIDTH { #0100 } %HEIGHT { #00a0 }
( devices ) ( devices )
@ -46,17 +40,17 @@
.Screen/width DEI2 2// WIDTH 2// SUB2 #0008 ADD2 .Screen/width DEI2 2// WIDTH 2// SUB2 #0008 ADD2
.Screen/height DEI2 2// HEIGHT 2// SUB2 #0008 ADD2 .Screen/height DEI2 2// HEIGHT 2// SUB2 #0008 ADD2
WIDTH HEIGHT WIDTH HEIGHT
SIZE-TO-RECT #02 ;fill-rect JSR2 STH2 STH2 OVR2 STH2r ADD2 OVR2 STH2r ADD2 #02 ;fill-rect JSR2
.Screen/width DEI2 2// WIDTH 2// SUB2 .Screen/width DEI2 2// WIDTH 2// SUB2
.Screen/height DEI2 2// HEIGHT 2// SUB2 .Screen/height DEI2 2// HEIGHT 2// SUB2
WIDTH HEIGHT WIDTH HEIGHT
SIZE-TO-RECT #01 ;fill-rect JSR2 STH2 STH2 OVR2 STH2r ADD2 OVR2 STH2r ADD2 #01 ;fill-rect JSR2
.Screen/width DEI2 2// WIDTH 2// SUB2 #0008 ADD2 .Screen/width DEI2 2// WIDTH 2// SUB2 #0008 ADD2
.Screen/height DEI2 2// HEIGHT 2// SUB2 #0008 ADD2 .Screen/height DEI2 2// HEIGHT 2// SUB2 #0008 ADD2
WIDTH #0010 SUB2 HEIGHT #0010 SUB2 WIDTH #0010 SUB2 HEIGHT #0010 SUB2
SIZE-TO-RECT #03 ;line-rect JSR2 STH2 STH2 OVR2 STH2r ADD2 OVR2 STH2r ADD2 #03 ;line-rect JSR2
.Screen/width DEI2 2// .Screen/height DEI2 2// WIDTH 4// #02 ;draw-circle JSR2 .Screen/width DEI2 2// .Screen/height DEI2 2// WIDTH 4// #02 ;draw-circle JSR2
@ -89,7 +83,7 @@ BRK
&end &end
RTN JMP2r
@line-rect ( x1* y1* x2* y2* color -- ) @line-rect ( x1* y1* x2* y2* color -- )
@ -116,7 +110,7 @@ RTN
POP2 POP2 POP2 POP2
POPr POPr
RTN JMP2r
@fill-rect ( x1* y1* x2* y2* color -- ) @fill-rect ( x1* y1* x2* y2* color -- )
@ -135,7 +129,7 @@ RTN
OVR2 OVR2 GTS2 ,&ver JCN OVR2 OVR2 GTS2 ,&ver JCN
POP2 POP2 POP2 POP2 POP2 POP2 POP2 POP2
RTN JMP2r
&color $1 &color $1
@draw-circle ( xc yc r color -- ) @draw-circle ( xc yc r color -- )
@ -155,7 +149,7 @@ RTN
&end &end
( draw ) ;&seg JSR2 ( draw ) ;&seg JSR2
.circle/y LDZ2 .circle/x LDZ2 #0001 SUB2 GTS2 ,&loop JCN .circle/y LDZ2 .circle/x LDZ2 #0001 SUB2 GTS2 ,&loop JCN
RTN JMP2r
&seg &seg
.circle/xc LDZ2 .circle/x LDZ2 ADD2 .Screen/x DEO2 .circle/yc LDZ2 .circle/y LDZ2 ADD2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO .circle/xc LDZ2 .circle/x LDZ2 ADD2 .Screen/x DEO2 .circle/yc LDZ2 .circle/y LDZ2 ADD2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO
.circle/xc LDZ2 .circle/x LDZ2 SUB2 .Screen/x DEO2 .circle/yc LDZ2 .circle/y LDZ2 ADD2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO .circle/xc LDZ2 .circle/x LDZ2 SUB2 .Screen/x DEO2 .circle/yc LDZ2 .circle/y LDZ2 ADD2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO
@ -166,7 +160,7 @@ RTN
.circle/xc LDZ2 .circle/y LDZ2 ADD2 .Screen/x DEO2 .circle/yc LDZ2 .circle/x LDZ2 SUB2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO .circle/xc LDZ2 .circle/y LDZ2 ADD2 .Screen/x DEO2 .circle/yc LDZ2 .circle/x LDZ2 SUB2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO
.circle/xc LDZ2 .circle/y LDZ2 SUB2 .Screen/x DEO2 .circle/yc LDZ2 .circle/x LDZ2 SUB2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO .circle/xc LDZ2 .circle/y LDZ2 SUB2 .Screen/x DEO2 .circle/yc LDZ2 .circle/x LDZ2 SUB2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO
RTN JMP2r
@cover-pattern ( addr* color -- ) @cover-pattern ( addr* color -- )
@ -184,7 +178,7 @@ RTN
POP2 POP2 POP2 POP2
POPr POPr
RTN JMP2r
@line-hor ( x0* x1* y* color -- ) @line-hor ( x0* x1* y* color -- )
@ -196,7 +190,7 @@ RTN
INC2 GTH2k ,&loop JCN INC2 GTH2k ,&loop JCN
POP2 POP2 POPr POP2 POP2 POPr
RTN JMP2r
@line-ver ( x* y0* y1* color -- ) @line-ver ( x* y0* y1* color -- )
@ -208,6 +202,6 @@ RTN
INC2 GTH2k ,&loop JCN INC2 GTH2k ,&loop JCN
POP2 POP2 POPr POP2 POP2 POPr
RTN JMP2r
@checker_icn [ f0f0 f0f0 0f0f 0f0f ] @checker_icn [ f0f0 f0f0 0f0f 0f0f ]

View File

@ -1,9 +1,4 @@
( gui/terminal ) ( GUI Terminal )
%+ { ADD } %- { SUB } %* { MUL } %/ { DIV }
%< { LTH } %> { GTH } %= { EQU } %! { NEQ }
%++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 }
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
( devices ) ( devices )
@ -24,7 +19,7 @@
( theme ) ( theme )
#0f0f .System/r DEO2 #0f0f .System/r DEO2
#0ff0 .System/g DEO2 #0ff0 .System/g DEO2
#00ff .System/b DEO2 #0fff .System/b DEO2
( vectors ) ( vectors )
;on-button .Controller/vector DEO2 ;on-button .Controller/vector DEO2
@ -39,22 +34,22 @@ BRK
@on-button ( -> ) @on-button ( -> )
.Controller/key DEI .Controller/key DEI
DUP #00 ! ,&no-null JCN DUP #00 NEQ ,&no-null JCN
POP BRK POP BRK
&no-null &no-null
DUP #0d ! ,&no-enter JCN DUP #0d NEQ ,&no-enter JCN
#00 ;draw-input JSR2 #00 ;draw-input JSR2
;validate JSR2 ;validate JSR2
;buffer #0080 ;mclr JSR2 ;buffer #0080 ;mclr JSR2
#01 ;draw-input JSR2 #01 ;draw-input JSR2
&no-enter &no-enter
DUP #08 ! ,&no-backspace JCN DUP #08 NEQ ,&no-backspace JCN
#00 ;draw-input JSR2 #00 ;draw-input JSR2
;buffer ;spop JSR2 ;buffer ;spop JSR2
#01 ;draw-input JSR2 #01 ;draw-input JSR2
&no-backspace &no-backspace
DUP STHk #1f > STHr #7b < #0101 !! ,&no-valid JCN DUP STHk #1f GTH STHr #7b LTH #0101 NEQ2 ,&no-valid JCN
;buffer ;slen JSR2 #007f >> ,&no-valid JCN ;buffer ;slen JSR2 #007f GTH2 ,&no-valid JCN
STHk ;buffer STHr ;sput JSR2 STHk ;buffer STHr ;sput JSR2
#01 ;draw-input JSR2 #01 ;draw-input JSR2
&no-valid &no-valid
@ -65,7 +60,7 @@ BRK
@validate ( -- ) @validate ( -- )
#0010 .Screen/x DEO2 #0010 .Screen/x DEO2
.Screen/height DEI2 #0040 -- .Screen/y DEO2 .Screen/height DEI2 #0040 SUB2 .Screen/y DEO2
( clear ) ( clear )
#8000 #8000
@ -88,7 +83,7 @@ JMP2r
STH STH
#0010 .Screen/x DEO2 #0010 .Screen/x DEO2
.Screen/height DEI2 #0020 -- .Screen/y DEO2 .Screen/height DEI2 #0020 SUB2 .Screen/y DEO2
( marker ) LIT '> #03 ;draw-char JSR2 ( marker ) LIT '> #03 ;draw-char JSR2
@ -110,10 +105,10 @@ JMP2r
@draw-char ( char color -- ) @draw-char ( char color -- )
SWP SWP
[ #20 - #00 SWP #40 SFT2 ;font ++ ] .Screen/addr DEO2 [ #20 SUB #00 SWP #40 SFT2 ;font ADD2 ] .Screen/addr DEO2
.Screen/sprite DEOk DEO .Screen/sprite DEOk DEO
.Screen/y DEI2 #0010 -- .Screen/y DEO2 .Screen/y DEI2 #0010 SUB2 .Screen/y DEO2
.Screen/x DEI2 #0008 ++ .Screen/x DEO2 .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
JMP2r JMP2r
@ -121,13 +116,13 @@ JMP2r
@slen ( str* -- len* ) @slen ( str* -- len* )
DUP2 ,scap JSR SWP2 -- DUP2 ,scap JSR SWP2 SUB2
JMP2r JMP2r
@scap ( str* -- str-end* ) @scap ( str* -- str-end* )
( clamp ) LDAk #00 ! JMP JMP2r ( clamp ) LDAk #00 NEQ JMP JMP2r
&while INC2 LDAk ,&while JCN &while INC2 LDAk ,&while JCN
JMP2r JMP2r
@ -140,14 +135,14 @@ JMP2r
@spop ( str* -- ) @spop ( str* -- )
( clamp ) LDAk #00 ! JMP JMP2r ( clamp ) LDAk #00 NEQ JMP JMP2r
#00 ROT ROT ,scap JSR #0001 -- STA #00 ROT ROT ,scap JSR #0001 SUB2 STA
JMP2r JMP2r
@mclr ( addr* len* -- ) @mclr ( addr* len* -- )
OVR2 ++ SWP2 OVR2 ADD2 SWP2
&loop &loop
STH2k #00 STH2r STA STH2k #00 STH2r STA
INC2 GTH2k ,&loop JCN INC2 GTH2k ,&loop JCN

View File

@ -1,63 +0,0 @@
( devices )
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
( variables )
|0000
@scroll [ &x $2 &y $2 &wait $1 ]
|0100 ( -> )
#90ff .System/r DEO2 #9000 .System/g DEO2 #900f .System/b DEO2
#08e0 .Screen/width DEI2 #01 SFT2 SUB2 .scroll/x STZ2
#09b0 .scroll/y STZ2
;frame .Screen/vector DEO2
#30 .scroll/wait STZ
BRK
@frame ( -> )
#ffff
&loop
DUP2 ,row JSR
INC2
DUP2 .Screen/height DEI2 LTH2 ,&loop JCN
POP2
.scroll/wait LDZ ,&noscroll JCN
.scroll/y LDZ2 INC2 .scroll/y STZ2
BRK
&noscroll
.scroll/wait LDZ #01 SUB .scroll/wait STZ
BRK
@row ( y* -- )
DUP2 .Screen/y DEO2
.scroll/y LDZ2 ADD2
.Screen/width DEI2
&loop
#0001 SUB2
OVR2 OVR2 .scroll/x LDZ2 ADD2 EOR2 DUP2 #0013 DIV2 #0013 MUL2 SUB2
DUP #00 EQU ,&draw JCN
DUP #05 EQU ,&draw JCN
POP2
&rest
DUP2 ORA ,&loop JCN
POP2 POP2
JMP2r
#15 .Screen/pixel DEO
JMP2r
&draw
OVR2 .Screen/x DEO2
#05 ADD .Screen/pixel DEO
.Screen/y DEI2
DUP2 INC2 .Screen/y DEO2
#00 .Screen/pixel DEO
.Screen/y DEO2
POP
,&rest JMP

View File

@ -545,7 +545,6 @@ JMP2r
&no-blank &no-blank
DUP ,&zero STR DUP ,&zero STR
&padded #30 SFT #00 SWP ;font-hex ADD2 &padded #30 SFT #00 SWP ;font-hex ADD2
JMP2r
JMP2r JMP2r
&zero $1 &zero $1

View File

@ -1,4 +1,4 @@
( Clock ) ( simple graphical clock )
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ] |00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|10 @Console [ &vector $2 &read $1 &pad $5 &write $1 &error $1 ] |10 @Console [ &vector $2 &read $1 &pad $5 &write $1 &error $1 ]

View File

@ -25,7 +25,6 @@
%MOD { DIVk MUL SUB } %MOD { DIVk MUL SUB }
%MOD2 { DIV2k MUL2 SUB2 } %MOD2 { DIV2k MUL2 SUB2 }
%AUTO-NONE { #00 .Screen/auto DEO }
%AUTO-X { #01 .Screen/auto DEO } %AUTO-X { #01 .Screen/auto DEO }
%AUTO-Y { #02 .Screen/auto DEO } %AUTO-Y { #02 .Screen/auto DEO }
%AUTO-XY { #03 .Screen/auto DEO } %AUTO-XY { #03 .Screen/auto DEO }
@ -127,7 +126,7 @@ BRK
.Screen/y DEI2k #0008 ++ ROT DEO2 .Screen/y DEI2k #0008 ++ ROT DEO2
INC GTHk ,&ver JCN INC GTHk ,&ver JCN
POP2 POP2
AUTO-NONE #00 .Screen/auto DEO
RTN RTN
&blank-icn 8000 0000 0000 0000 &blank-icn 8000 0000 0000 0000

View File

@ -1,31 +0,0 @@
( hexes
A small utility that prints incoming console messages as hex values. )
%RTN { JMP2r }
|10 @Console [ &vector $2 &read $1 &pad $5 &write $1 ]
( init )
|0100 ( -> )
;on-message .Console/vector DEO2
BRK
@on-message ( -> )
.Console/read DEI ,print-hex JSR
BRK
@print-hex ( value -- )
STHk #04 SFT ,&parse JSR .Console/write DEO
STHr #0f AND ,&parse JSR .Console/write DEO
RTN
&parse ( value -- char )
DUP #09 GTH ,&above JCN #30 ADD RTN &above #09 SUB #60 ADD RTN
RTN

View File

@ -1,30 +1,5 @@
( launcher ) ( launcher )
%2* { #10 SFT } %2/ { #01 SFT } %2** { #10 SFT2 } %2// { #01 SFT2 }
%4* { #20 SFT } %4/ { #02 SFT } %4** { #20 SFT2 } %4// { #02 SFT2 }
%8* { #30 SFT } %8/ { #03 SFT } %8** { #30 SFT2 } %8// { #03 SFT2 }
%10* { #40 SFT } %10/ { #04 SFT } %10** { #40 SFT2 } %10// { #04 SFT2 }
%20* { #50 SFT } %20/ { #05 SFT } %20** { #50 SFT2 } %20// { #05 SFT2 }
%40** { #60 SFT2 }
%RTN { JMP2r }
%TOS { #00 SWP }
%AUTO-NONE { #00 .Screen/auto DEO }
%AUTO-XADDR { #05 .Screen/auto DEO }
%AUTO-YADDR { #06 .Screen/auto DEO }
%HALT { #010f DEO }
%EMIT { #18 DEO }
%PRINT { ;print-str JSR2 #0a EMIT }
%DEBUG { ;print-hex/byte JSR2 #0a EMIT }
%DEBUG2 { ;print-hex JSR2 #0a EMIT }
%LINES-COUNT { .browser/y2 LDZ2 .browser/y LDZ2 SUB2 10// NIP }
( devices )
|00 @System &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1 |00 @System &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1
|10 @Console &vector $2 &read $1 &pad $5 &write $1 &error $1 |10 @Console &vector $2 &read $1 &pad $5 &write $1 &error $1
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 |20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
@ -79,14 +54,14 @@
#0010 .browser/y STZ2 #0010 .browser/y STZ2
.Screen/height DEI2 #33 SFT2 #0011 SUB2 .browser/y2 STZ2 .Screen/height DEI2 #33 SFT2 #0011 SUB2 .browser/y2 STZ2
( theme support )
;load-theme JSR2
( draw mascot ) ( draw mascot )
#0010 #0010 #0060 #0060 ;mascot-icn #01 ;draw-icn JSR2 #0010 #0010 #0060 #0060 ;mascot-icn #01 ;draw-icn JSR2
;load-dir JSR2 ;load-dir JSR2
( theme support )
;load-theme JSR2
( force selection ) ( force selection )
#ff .browser/last STZ #ff .browser/last STZ
#00 ;select-file JSR2 #00 ;select-file JSR2
@ -129,7 +104,7 @@ BRK
.Mouse/y DEI2 .browser/y2 LDZ2 #0010 SUB2 GTH2 ,&outside JCN .Mouse/y DEI2 .browser/y2 LDZ2 #0010 SUB2 GTH2 ,&outside JCN
( select choice ) ( select choice )
.Mouse/y DEI2 .browser/y LDZ2 SUB2 .Mouse/y DEI2 .browser/y LDZ2 SUB2
10// NIP .browser/scroll LDZ ADD ;select-file JSR2 #04 SFT2 NIP .browser/scroll LDZ ADD ;select-file JSR2
( run choice ) ( run choice )
.Mouse/state DEI #00 EQU ,&no-click JCN .Mouse/state DEI #00 EQU ,&no-click JCN
.browser/sel LDZ ;run-file JSR2 .browser/sel LDZ ;run-file JSR2
@ -187,17 +162,17 @@ BRK
INC2 LDAk ,&while JCN INC2 LDAk ,&while JCN
POP2 POP2
RTN JMP2r
@select-file ( id -- ) @select-file ( id -- )
( has changed ) ( has changed )
DUP .browser/last LDZ NEQ ,&has-changed JCN DUP .browser/last LDZ NEQ ,&has-changed JCN
POP RTN POP JMP2r
&has-changed &has-changed
( beyond ) ( beyond )
DUP .browser/lines LDZ LTH ,&valid JCN DUP .browser/lines LDZ LTH ,&valid JCN
POP RTN POP JMP2r
&valid &valid
#00 ;draw-browser JSR2 #00 ;draw-browser JSR2
@ -208,23 +183,23 @@ RTN
( draw mascot ) ( draw mascot )
#0010 #0010 #0060 #0060 #0010 #0010 #0060 #0060
;mascot-icn [ .browser/sel LDZ #03 AND TOS #0480 MUL2 ADD2 ] #01 ;mascot-icn .browser/sel LDZ #03 AND #00 SWP #0480 MUL2 ADD2 #01
;draw-icn JSR2 ;draw-icn JSR2
( draw position ) ( draw position )
AUTO-YADDR #06 .Screen/auto DEO
#0010 .Screen/x DEO2 #0010 .Screen/x DEO2
#0080 .Screen/y DEO2 #0080 .Screen/y DEO2
.browser/sel LDZ #02 ;draw-byte JSR2 .browser/sel LDZ #02 ;draw-byte JSR2
LIT '/ #02 ;draw-char JSR2 LIT '/ #02 ;draw-char JSR2
.browser/lines LDZ #01 SUB #02 ;draw-byte JSR2 .browser/lines LDZ #01 SUB #02 ;draw-byte JSR2
AUTO-NONE #00 .Screen/auto DEO
RTN JMP2r
@follow-selection ( -- ) @follow-selection ( -- )
LINES-COUNT .browser/sel LDZ .browser/scroll LDZ SUB .browser/y2 LDZ2 .browser/y LDZ2 SUB2 #04 SFT2 NIP .browser/sel LDZ .browser/scroll LDZ SUB
DUP2 GTH ,&no-down JCN DUP2 GTH ,&no-down JCN
.browser/scroll LDZ INC ,scroll-to JSR .browser/scroll LDZ INC ,scroll-to JSR
&no-down &no-down
@ -233,25 +208,25 @@ RTN
&no-up &no-up
POP2 POP2
RTN JMP2r
@scroll-to ( line -- ) @scroll-to ( line -- )
STH STH
( more lines than visible ) ( more lines than visible )
.browser/lines LDZ LINES-COUNT .browser/lines LDZ .browser/y2 LDZ2 .browser/y LDZ2 SUB2 #04 SFT2 NIP
DUP2 GTH ,&can-scroll JCN DUP2 GTH ,&can-scroll JCN
POPr POP2 RTN POPr POP2 JMP2r
&can-scroll &can-scroll
( less than max scroll ) ( less than max scroll )
SUB INC STHkr GTH ,&valid-scroll JCN SUB INC STHkr GTH ,&valid-scroll JCN
POPr RTN POPr JMP2r
&valid-scroll &valid-scroll
#00 ;draw-browser JSR2 #00 ;draw-browser JSR2
STHr .browser/scroll STZ STHr .browser/scroll STZ
#01 ;draw-browser JSR2 #01 ;draw-browser JSR2
RTN JMP2r
@run-file ( id -- ) @run-file ( id -- )
@ -270,13 +245,13 @@ RTN
;&output-path ;asma-assemble-file JSR2 ;&output-path ;asma-assemble-file JSR2
;load-dir JSR2 ;load-dir JSR2
;redraw JSR2 ;redraw JSR2
RTN JMP2r
&no-tal &no-tal
POP2 RTN POP2 JMP2r
&valid &valid
;load-rom JSR2 ;load-rom JSR2
RTN JMP2r
&tal-ext ".tal $1 &tal-ext ".tal $1
&rom-ext ".rom $1 &rom-ext ".rom $1
&output-path $20 &output-path $20
@ -287,7 +262,7 @@ RTN
#ff .browser/last STZ #ff .browser/last STZ
#00 ;select-file JSR2 #00 ;select-file JSR2
RTN JMP2r
@draw-browser ( mask -- ) @draw-browser ( mask -- )
@ -298,17 +273,17 @@ RTN
( draw hand ) ( draw hand )
.browser/x LDZ2 #0018 SUB2 .browser/y LDZ2 .browser/x LDZ2 #0018 SUB2 .browser/y LDZ2
.browser/sel LDZ .browser/scroll LDZ SUB TOS 10** ADD2 .browser/sel LDZ .browser/scroll LDZ SUB #00 SWP #40 SFT2 ADD2
#0010 #0010 #0010 #0010
;hand-icn STHkr #02 MUL ;draw-icn JSR2 ;hand-icn STHkr #10 SFT ;draw-icn JSR2
( draw files ) ( draw files )
LINES-COUNT #00 .browser/y2 LDZ2 .browser/y LDZ2 SUB2 #04 SFT2 NIP #00
&loop &loop
( reached end ) ( reached end )
DUP INC .browser/lines LDZ GTH ,&end JCN INCk .browser/lines LDZ GTH ,&end JCN
( has file ) ( has file )
.browser/x LDZ2 .Screen/x DEO2 .browser/x LDZ2 .Screen/x DEO2
#00 OVR 10** .browser/y LDZ2 ADD2 .Screen/y DEO2 #00 OVR #40 SFT2 .browser/y LDZ2 ADD2 .Screen/y DEO2
DUP .browser/scroll LDZ ADD ;get-entry JSR2 DUP .browser/scroll LDZ ADD ;get-entry JSR2
DUP2 ;get-type JSR2 ;draw-type JSR2 DUP2 ;get-type JSR2 ;draw-type JSR2
#01 STHkr MUL ;draw-str JSR2 #01 STHkr MUL ;draw-str JSR2
@ -318,7 +293,7 @@ RTN
POPr POPr
RTN JMP2r
@draw-browser-empty ( mask -- ) @draw-browser-empty ( mask -- )
@ -327,14 +302,14 @@ RTN
.browser/y LDZ2 .Screen/y DEO2 .browser/y LDZ2 .Screen/y DEO2
;&empty-txt #01 ;draw-str JSR2 ;&empty-txt #01 ;draw-str JSR2
RTN JMP2r
&empty-txt "Empty 20 "Folder $1 &empty-txt "Empty 20 "Folder $1
@get-type ( line* -- type ) @get-type ( line* -- type )
;scap JSR2 #0004 SUB2 ;&rom-ext ;scmp JSR2 ;scap JSR2 #0004 SUB2 ;&rom-ext ;scmp JSR2
RTN JMP2r
&rom-ext ".rom $1 &rom-ext ".rom $1
@get-entry ( id -- addr* ) @get-entry ( id -- addr* )
@ -344,7 +319,7 @@ RTN
;dir/length LDA2 #0000 ;dir/length LDA2 #0000
&loop &loop
EQUkr STHr #00 EQU ,&no-reached JCN EQUkr STHr #00 EQU ,&no-reached JCN
POP2r NIP2 ;dir/data ADD2 RTN POP2r NIP2 ;dir/data ADD2 JMP2r
&no-reached &no-reached
DUP2 ;dir/data ADD2 LDA #00 NEQ ,&no-lb JCN DUP2 ;dir/data ADD2 LDA #00 NEQ ,&no-lb JCN
INCr INCr
@ -354,12 +329,12 @@ RTN
POP2r POP2r
;dir/data ;dir/data
RTN JMP2r
@draw-type ( type -- ) @draw-type ( type -- )
STHk TOS 20** ;file-icns ADD2 .Screen/addr DEO2 STHk #00 SWP #50 SFT2 ;file-icns ADD2 .Screen/addr DEO2
AUTO-XADDR #05 .Screen/auto DEO
#02 STHkr SUB .Screen/sprite DEOk DEO #02 STHkr SUB .Screen/sprite DEOk DEO
.Screen/x DEI2k #0010 SUB2 ROT DEO2 .Screen/x DEI2k #0010 SUB2 ROT DEO2
@ -369,13 +344,13 @@ RTN
.Screen/x DEI2k #0008 ADD2 ROT DEO2 .Screen/x DEI2k #0008 ADD2 ROT DEO2
.Screen/y DEI2k #0008 SUB2 ROT DEO2 .Screen/y DEI2k #0008 SUB2 ROT DEO2
AUTO-NONE #00 .Screen/auto DEO
RTN JMP2r
@draw-icn ( x* y* width* height* addr* color -- ) @draw-icn ( x* y* width* height* addr* color -- )
AUTO-XADDR #05 .Screen/auto DEO
( load ) STH .Screen/addr DEO2 ,&height STR2 ,&width STR2 ,&y STR2 ,&x STR2 ( load ) STH .Screen/addr DEO2 ,&height STR2 ,&width STR2 ,&y STR2 ,&x STR2
,&height LDR2 #0000 ,&height LDR2 #0000
&ver &ver
@ -389,14 +364,14 @@ RTN
#0008 ADD2 GTH2k ,&ver JCN #0008 ADD2 GTH2k ,&ver JCN
POP2 POP2 POP2 POP2
POPr POPr
AUTO-NONE #00 .Screen/auto DEO
RTN JMP2r
&x $2 &y $2 &width $2 &height $2 &x $2 &y $2 &width $2 &height $2
@draw-str ( text* color -- ) @draw-str ( text* color -- )
AUTO-YADDR #06 .Screen/auto DEO
STH STH
&while &while
LDAk STHkr ,draw-char JSR LDAk STHkr ,draw-char JSR
@ -404,14 +379,7 @@ RTN
POP2 POP2
POPr POPr
RTN JMP2r
@draw-short ( short* color -- )
STH SWP STHkr ,draw-byte JSR
STHr ,draw-byte JSR
RTN
@draw-byte ( byte color -- ) @draw-byte ( byte color -- )
@ -419,17 +387,16 @@ RTN
DUP #04 SFT ,&parse JSR STHkr ,draw-char JSR DUP #04 SFT ,&parse JSR STHkr ,draw-char JSR
#0f AND ,&parse JSR STHr ,draw-char JSR #0f AND ,&parse JSR STHr ,draw-char JSR
RTN JMP2r
&parse ( byte -- char ) DUP #09 GTH ,&above JCN #30 ADD JMP2r &parse ( byte -- char ) DUP #09 GTH ,&above JCN #30 ADD JMP2r
&above #57 ADD JMP2r &above #57 ADD JMP2r
@draw-char ( char color -- ) @draw-char ( char color -- )
SWP SWP
[ #20 SUB #00 SWP #40 SFT2 ;font ADD2 ] .Screen/addr DEO2 #15 .Screen/auto DEO
.Screen/sprite DEOk DEO #20 SUB #00 SWP #40 SFT2 ;font ADD2 .Screen/addr DEO2
.Screen/x DEI2k #0008 ADD2 ROT DEO2 .Screen/sprite DEO
.Screen/y DEI2k #0010 SUB2 ROT DEO2
JMP2r JMP2r
@ -448,52 +415,37 @@ JMP2r
#fffc LDA2 .System/g DEO2 #fffc LDA2 .System/g DEO2
#fffe LDA2 .System/b DEO2 #fffe LDA2 .System/b DEO2
&ignore &ignore
;redraw JSR2
RTN JMP2r
( helpers ) ( helpers )
@print-str ( string* -- )
#0001 SUB2
&while
INC2 LDAk DUP #18 DEO ,&while JCN
POP2
JMP2r
@print-hex ( value* -- )
SWP ,&byte JSR
&byte ( byte -- )
STHk #04 SFT ,&parse JSR #18 DEO
STHr #0f AND ,&parse JSR #18 DEO
JMP2r
&parse ( byte -- char ) DUP #09 GTH ,&above JCN #30 ADD JMP2r
&above #57 ADD JMP2r
JMP2r
@scmp ( a* b* -- flag ) @scmp ( a* b* -- flag )
STH2 STH2
&loop &loop
LDAk LDAkr STHr EQU ,&not-diff JCN LDAk LDAkr STHr NEQ ,&end JCN
POP2 POP2r #00 RTN LDAk LDAkr STHr ORA ,&not-end JCN
&not-diff POP2 POP2r #01 JMP2r
LDAk LDAkr STHr #0000 NEQ2 ,&not-end JCN
POP2 POP2r #01 RTN
&not-end &not-end
INC2 INC2r INC2 INC2r ,&loop JMP
,&loop JMP &end
POP2 POP2r #00 POP2 POP2r #00
RTN JMP2r
@scat ( src* dst* -- ) @scat ( src* dst* -- )
DUP2 ,slen JSR ADD2 ,scpy JSR DUP2 ,slen JSR ADD2
@scpy ( src* dst* -- )
STH2
&while
LDAk STH2kr STA INC2r
INC2 LDAk ,&while JCN
POP2
#00 STH2r STA
JMP2r JMP2r
@ -503,22 +455,10 @@ JMP2r
JMP2r JMP2r
@scap ( str* -- end* ) @scap ( str* -- str-end* )
LDAk #00 NEQ JMP JMP2r ( clamp ) LDAk #00 NEQ JMP JMP2r
&while &while INC2 LDAk ,&while JCN
INC2 LDAk ,&while JCN
JMP2r
@scpy ( src* dst* -- )
STH2
&while
LDAk STH2kr STA INC2r
INC2 LDAk ,&while JCN
POP2
#00 STH2r STA
JMP2r JMP2r

View File

@ -59,7 +59,7 @@ JMP2r
@print ( short* -- ) @print ( short* -- )
&short ( short* -- ) SWP ,&byte JSR SWP ,&byte JSR
&byte ( byte -- ) DUP #04 SFT ,&char JSR &byte ( byte -- ) DUP #04 SFT ,&char JSR
&char ( char -- ) #0f AND DUP #09 GTH #27 MUL ADD #30 ADD #18 DEO &char ( char -- ) #0f AND DUP #09 GTH #27 MUL ADD #30 ADD #18 DEO

View File

@ -2,16 +2,6 @@
converts a binary file to a proquints, identifiers that are readable, and pronounceable. converts a binary file to a proquints, identifiers that are readable, and pronounceable.
usage: uxncli proquints.rom file.bin ) usage: uxncli proquints.rom file.bin )
%+ { ADD } %- { SUB } %* { MUL } %/ { DIV }
%< { LTH } %> { GTH } %= { EQU } %! { NEQ }
%++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 }
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
%HALT { #010f DEO }
%EMIT { #18 DEO }
%PRINT { ;print-str JSR2 #0a EMIT }
%DEBUG { ;print-hex/byte JSR2 #0a EMIT }
%DEBUG2 { ;print-hex JSR2 #0a EMIT }
( devices ) ( devices )
@ -39,13 +29,13 @@ BRK
#01 ,&trap STR #01 ,&trap STR
&started &started
( append ) ( append )
.Console/read DEI #20 < ,&validate JCN .Console/read DEI #20 LTH ,&validate JCN
;src ;slen JSR2 #0030 == ,&validate JCN ;src ;slen JSR2 #0030 EQU2 ,&validate JCN
;src .Console/read DEI ;sput JSR2 BRK ;src .Console/read DEI ;sput JSR2 BRK
&validate &validate
( load ) ( load )
;src .File/name DEO2 ;src .File/name DEO2
#fff0 ;data -- .File/length DEO2 #fff0 ;data SUB2 .File/length DEO2
;data .File/read DEO2 ;data .File/read DEO2
( save length ) ( save length )
.File/success DEI2 .length STZ2 .File/success DEI2 .length STZ2
@ -56,12 +46,12 @@ BRK
@parse ( -- ) @parse ( -- )
.length LDZ2 ;data ++ ;data .length LDZ2 ;data ADD2 ;data
&loop &loop
LDA2k ,proquint JSR LDA2k ,proquint JSR
INC2 INC2 GTH2k ,&loop JCN INC2 INC2 GTH2k ,&loop JCN
POP2 POP2 POP2 POP2
HALT #010f DEO
JMP2r JMP2r
@ -72,23 +62,23 @@ JMP2r
( c2 ) DUP2 #06 ,&emit-con JSR ( c2 ) DUP2 #06 ,&emit-con JSR
( v2 ) DUP2 #03 ,&emit-vow JSR ( v2 ) DUP2 #03 ,&emit-vow JSR
( c3 ) #00 ,&emit-con JSR ( c3 ) #00 ,&emit-con JSR
#20 EMIT #2018 DEO
JMP2r JMP2r
&emit-con SFT2 #000f AND2 ;&con ADD2 LDA EMIT JMP2r &emit-con SFT2 #000f AND2 ;&con ADD2 LDA #18 DEO JMP2r
&con "bdfghjklmnprstvz &con "bdfghjklmnprstvz
&emit-vow SFT2 #0003 AND2 ;&vow ADD2 LDA EMIT JMP2r &emit-vow SFT2 #0003 AND2 ;&vow ADD2 LDA #18 DEO JMP2r
&vow "aiou &vow "aiou
@slen ( str* -- len* ) @slen ( str* -- len* )
DUP2 ,scap JSR SWP2 -- DUP2 ,scap JSR SWP2 SUB2
JMP2r JMP2r
@scap ( str* -- end* ) @scap ( str* -- end* )
LDAk #00 ! JMP JMP2r LDAk #00 NEQ JMP JMP2r
&while &while
INC2 LDAk ,&while JCN INC2 LDAk ,&while JCN
@ -102,7 +92,7 @@ JMP2r
@mclr ( addr* len* -- ) @mclr ( addr* len* -- )
OVR2 ++ SWP2 OVR2 ADD2 SWP2
&loop &loop
STH2k #00 STH2r STA STH2k #00 STH2r STA
INC2 GTH2k ,&loop JCN INC2 GTH2k ,&loop JCN