General improvements to example files
This commit is contained in:
parent
8176ab93c8
commit
852e33e6f3
2
build.sh
2
build.sh
|
@ -117,7 +117,7 @@ echo "Assembling(asma).."
|
|||
if [ $norun = 1 ]; then exit; fi
|
||||
|
||||
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.."
|
||||
cd bin
|
||||
|
|
|
@ -130,11 +130,11 @@ JMP2r
|
|||
#00 EQU ,&dead JCN
|
||||
DUP #02 LTH ,&dies JCN
|
||||
DUP #03 GTH ,&dies JCN
|
||||
POP ,&save JSR JMP2r
|
||||
POP ;&save JSR2 JMP2r
|
||||
&dies POP POP2 JMP2r
|
||||
&dead
|
||||
DUP #03 EQU ,&birth JCN POP POP2 JMP2r
|
||||
&birth POP ,&save JSR JMP2r
|
||||
&birth POP ;&save JSR2
|
||||
|
||||
JMP2r
|
||||
&save ( x y -- )
|
||||
|
|
|
@ -54,7 +54,7 @@ BRK
|
|||
#81 .Screen/sprite DEO
|
||||
( eye/tail )
|
||||
#00 ,draw-eye JSR
|
||||
#00 ,draw-tail JSR
|
||||
#00 ;draw-tail JSR2
|
||||
|
||||
JMP2r
|
||||
|
||||
|
|
|
@ -56,17 +56,17 @@ BRK
|
|||
.frame/x0 LDZ2 #0010 ADD2 .Screen/x DEO2
|
||||
.frame/y0 LDZ2 #0010 ADD2 .Screen/y 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
|
||||
;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/x DEI2 #0008 SUB2 .Screen/x 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
|
||||
;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
|
||||
;controller-icn/dpad .Screen/addr DEO2
|
||||
#03 .Screen/sprite DEO
|
||||
|
@ -75,26 +75,26 @@ BRK
|
|||
.center/y LDZ2 #0009 ADD2 .Screen/y DEO2
|
||||
.center/x LDZ2 #0009 SUB2 .Screen/x 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
|
||||
;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 )
|
||||
.center/y LDZ2 #0000 ADD2 .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
|
||||
#03 STHkr #01 SFT #01 AND SUB .Screen/sprite DEO
|
||||
.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
|
||||
|
||||
.center/y LDZ2 #0000 ADD2 .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
|
||||
#03 STHr #01 AND SUB .Screen/sprite DEO
|
||||
.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
|
||||
|
||||
.center/x LDZ2 #0010 SUB2 .Screen/x DEO2
|
||||
|
|
|
@ -36,7 +36,7 @@ BRK
|
|||
.Mouse/y DEI2 DUP2 .pointer/y STZ2 .Screen/y DEO2
|
||||
#43 .Mouse/state DEI #00 NEQ DUP ADD SUB .Screen/sprite DEO
|
||||
( 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 )
|
||||
.Mouse/state DEI ,on-mouse-drag JCN
|
||||
.Mouse/state DEI .pointer/state STZ
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
( GUI Hover )
|
||||
|
||||
%RTN { JMP2r }
|
||||
%GTS2 { #8000 ADD2 SWP2 #8000 ADD2 LTH2 }
|
||||
|
||||
( 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 ]
|
||||
|90 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &wheel $1 ]
|
||||
|
@ -15,7 +10,6 @@
|
|||
|
||||
@color $1
|
||||
@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 ]
|
||||
@r2 [ &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 )
|
||||
|
||||
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
|
||||
SWP2
|
||||
( x < rect.x1 ) DUP2 STHkr LDZ2 LTH2 ,&skip JCN
|
||||
( x > rect.x2 ) DUP2 STHkr #04 ADD LDZ2 GTH2 ,&skip JCN
|
||||
POP2 POP2 POPr
|
||||
#01
|
||||
RTN
|
||||
JMP2r
|
||||
&skip
|
||||
POP2 POP2 POPr
|
||||
#00
|
||||
|
||||
RTN
|
||||
JMP2r
|
||||
|
||||
@line-rect ( x1* y1* x2* y2* color -- )
|
||||
|
||||
|
@ -119,7 +113,7 @@ RTN
|
|||
POP2 POP2
|
||||
POPr
|
||||
|
||||
RTN
|
||||
JMP2r
|
||||
|
||||
@pointer_icn [ 80c0 e0f0 f8e0 1000 ]
|
||||
@hand_icn [ 4040 4070 f8f8 f870 ]
|
||||
|
|
|
@ -1,13 +1,4 @@
|
|||
( Draw a 8x8 font )
|
||||
|
||||
%+ { ADD } %- { SUB } %* { MUL } %/ { DIV }
|
||||
%< { LTH } %> { GTH } %= { EQU } %! { NEQ }
|
||||
%++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 }
|
||||
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
|
||||
|
||||
%AUTO-X { #01 .Screen/auto DEO }
|
||||
|
||||
( devices )
|
||||
( GUI Monospace )
|
||||
|
||||
|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
|
||||
|
@ -39,10 +30,10 @@ BRK
|
|||
|
||||
@draw-uf1 ( string* color -- )
|
||||
|
||||
AUTO-X
|
||||
#01 .Screen/auto DEO
|
||||
STH
|
||||
&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
|
||||
INC2 LDAk ,&while JCN
|
||||
POPr
|
||||
|
@ -53,15 +44,15 @@ JMP2r
|
|||
@draw-uf1-linebreaks ( string* color -- )
|
||||
|
||||
.Screen/x DEI2 ,&anchor STR2
|
||||
AUTO-X
|
||||
#01 .Screen/auto DEO
|
||||
STH
|
||||
&while
|
||||
LDAk #0a ! ,&no-lb JCN
|
||||
LDAk #0a NEQ ,&no-lb JCN
|
||||
( 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
|
||||
&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
|
||||
&end
|
||||
INC2 LDAk ,&while JCN
|
||||
|
|
|
@ -1,15 +1,5 @@
|
|||
( 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
|
||||
|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 -- )
|
||||
|
||||
AUTO-XADDR
|
||||
#05 .Screen/auto DEO
|
||||
STH
|
||||
( set bounds ) ,&height STR ,&width STR .Screen/addr DEO2
|
||||
( set origin ) .Screen/x DEI2 ,&x STR2
|
||||
|
@ -50,11 +40,11 @@ BRK
|
|||
STHkr .Screen/sprite DEO
|
||||
INC GTHk ,&hor JCN
|
||||
POP2
|
||||
.Screen/y DEI2k #0008 ++ ROT DEO2
|
||||
.Screen/y DEI2k #0008 ADD2 ROT DEO2
|
||||
INC GTHk ,&ver JCN
|
||||
POP2
|
||||
POPr
|
||||
AUTO-NONE
|
||||
#00 .Screen/auto DEO
|
||||
|
||||
JMP2r
|
||||
|
||||
|
@ -64,7 +54,7 @@ JMP2r
|
|||
|
||||
STH
|
||||
.Screen/addr DEO2
|
||||
SWP #01 - #40 SFT #06 + .Screen/auto DEO
|
||||
SWP #01 SUB #40 SFT #06 ADD .Screen/auto DEO
|
||||
#00
|
||||
&loop
|
||||
STHkr .Screen/sprite DEO
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
( GUI Shapes )
|
||||
|
||||
%RTN { JMP2r }
|
||||
%8++ { #0008 ADD2 }
|
||||
%2** { #10 SFT2 }
|
||||
%4** { #20 SFT2 }
|
||||
%2// { #01 SFT2 }
|
||||
|
@ -10,10 +8,6 @@
|
|||
%LTS2 { #8000 ADD2 SWP2 #8000 ADD2 GTH2 }
|
||||
%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 }
|
||||
|
||||
( devices )
|
||||
|
@ -46,17 +40,17 @@
|
|||
.Screen/width DEI2 2// WIDTH 2// SUB2 #0008 ADD2
|
||||
.Screen/height DEI2 2// HEIGHT 2// SUB2 #0008 ADD2
|
||||
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/height DEI2 2// HEIGHT 2// SUB2
|
||||
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/height DEI2 2// HEIGHT 2// SUB2 #0008 ADD2
|
||||
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
|
||||
|
||||
|
@ -89,7 +83,7 @@ BRK
|
|||
|
||||
&end
|
||||
|
||||
RTN
|
||||
JMP2r
|
||||
|
||||
@line-rect ( x1* y1* x2* y2* color -- )
|
||||
|
||||
|
@ -116,7 +110,7 @@ RTN
|
|||
POP2 POP2
|
||||
POPr
|
||||
|
||||
RTN
|
||||
JMP2r
|
||||
|
||||
@fill-rect ( x1* y1* x2* y2* color -- )
|
||||
|
||||
|
@ -135,7 +129,7 @@ RTN
|
|||
OVR2 OVR2 GTS2 ,&ver JCN
|
||||
POP2 POP2 POP2 POP2
|
||||
|
||||
RTN
|
||||
JMP2r
|
||||
&color $1
|
||||
|
||||
@draw-circle ( xc yc r color -- )
|
||||
|
@ -155,7 +149,7 @@ RTN
|
|||
&end
|
||||
( draw ) ;&seg JSR2
|
||||
.circle/y LDZ2 .circle/x LDZ2 #0001 SUB2 GTS2 ,&loop JCN
|
||||
RTN
|
||||
JMP2r
|
||||
&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 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 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 -- )
|
||||
|
||||
|
@ -184,7 +178,7 @@ RTN
|
|||
POP2 POP2
|
||||
POPr
|
||||
|
||||
RTN
|
||||
JMP2r
|
||||
|
||||
@line-hor ( x0* x1* y* color -- )
|
||||
|
||||
|
@ -196,7 +190,7 @@ RTN
|
|||
INC2 GTH2k ,&loop JCN
|
||||
POP2 POP2 POPr
|
||||
|
||||
RTN
|
||||
JMP2r
|
||||
|
||||
@line-ver ( x* y0* y1* color -- )
|
||||
|
||||
|
@ -208,6 +202,6 @@ RTN
|
|||
INC2 GTH2k ,&loop JCN
|
||||
POP2 POP2 POPr
|
||||
|
||||
RTN
|
||||
JMP2r
|
||||
|
||||
@checker_icn [ f0f0 f0f0 0f0f 0f0f ]
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
( gui/terminal )
|
||||
|
||||
%+ { ADD } %- { SUB } %* { MUL } %/ { DIV }
|
||||
%< { LTH } %> { GTH } %= { EQU } %! { NEQ }
|
||||
%++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 }
|
||||
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
|
||||
( GUI Terminal )
|
||||
|
||||
( devices )
|
||||
|
||||
|
@ -24,7 +19,7 @@
|
|||
( theme )
|
||||
#0f0f .System/r DEO2
|
||||
#0ff0 .System/g DEO2
|
||||
#00ff .System/b DEO2
|
||||
#0fff .System/b DEO2
|
||||
|
||||
( vectors )
|
||||
;on-button .Controller/vector DEO2
|
||||
|
@ -39,22 +34,22 @@ BRK
|
|||
@on-button ( -> )
|
||||
|
||||
.Controller/key DEI
|
||||
DUP #00 ! ,&no-null JCN
|
||||
DUP #00 NEQ ,&no-null JCN
|
||||
POP BRK
|
||||
&no-null
|
||||
DUP #0d ! ,&no-enter JCN
|
||||
DUP #0d NEQ ,&no-enter JCN
|
||||
#00 ;draw-input JSR2
|
||||
;validate JSR2
|
||||
;buffer #0080 ;mclr JSR2
|
||||
#01 ;draw-input JSR2
|
||||
&no-enter
|
||||
DUP #08 ! ,&no-backspace JCN
|
||||
DUP #08 NEQ ,&no-backspace JCN
|
||||
#00 ;draw-input JSR2
|
||||
;buffer ;spop JSR2
|
||||
#01 ;draw-input JSR2
|
||||
&no-backspace
|
||||
DUP STHk #1f > STHr #7b < #0101 !! ,&no-valid JCN
|
||||
;buffer ;slen JSR2 #007f >> ,&no-valid JCN
|
||||
DUP STHk #1f GTH STHr #7b LTH #0101 NEQ2 ,&no-valid JCN
|
||||
;buffer ;slen JSR2 #007f GTH2 ,&no-valid JCN
|
||||
STHk ;buffer STHr ;sput JSR2
|
||||
#01 ;draw-input JSR2
|
||||
&no-valid
|
||||
|
@ -65,7 +60,7 @@ BRK
|
|||
@validate ( -- )
|
||||
|
||||
#0010 .Screen/x DEO2
|
||||
.Screen/height DEI2 #0040 -- .Screen/y DEO2
|
||||
.Screen/height DEI2 #0040 SUB2 .Screen/y DEO2
|
||||
|
||||
( clear )
|
||||
#8000
|
||||
|
@ -88,7 +83,7 @@ JMP2r
|
|||
|
||||
STH
|
||||
#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
|
||||
|
||||
|
@ -110,10 +105,10 @@ JMP2r
|
|||
@draw-char ( char color -- )
|
||||
|
||||
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/y DEI2 #0010 -- .Screen/y DEO2
|
||||
.Screen/x DEI2 #0008 ++ .Screen/x DEO2
|
||||
.Screen/y DEI2 #0010 SUB2 .Screen/y DEO2
|
||||
.Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
|
||||
|
||||
JMP2r
|
||||
|
||||
|
@ -121,13 +116,13 @@ JMP2r
|
|||
|
||||
@slen ( str* -- len* )
|
||||
|
||||
DUP2 ,scap JSR SWP2 --
|
||||
DUP2 ,scap JSR SWP2 SUB2
|
||||
|
||||
JMP2r
|
||||
|
||||
@scap ( str* -- str-end* )
|
||||
|
||||
( clamp ) LDAk #00 ! JMP JMP2r
|
||||
( clamp ) LDAk #00 NEQ JMP JMP2r
|
||||
&while INC2 LDAk ,&while JCN
|
||||
|
||||
JMP2r
|
||||
|
@ -140,14 +135,14 @@ JMP2r
|
|||
|
||||
@spop ( str* -- )
|
||||
|
||||
( clamp ) LDAk #00 ! JMP JMP2r
|
||||
#00 ROT ROT ,scap JSR #0001 -- STA
|
||||
( clamp ) LDAk #00 NEQ JMP JMP2r
|
||||
#00 ROT ROT ,scap JSR #0001 SUB2 STA
|
||||
|
||||
JMP2r
|
||||
|
||||
@mclr ( addr* len* -- )
|
||||
|
||||
OVR2 ++ SWP2
|
||||
OVR2 ADD2 SWP2
|
||||
&loop
|
||||
STH2k #00 STH2r STA
|
||||
INC2 GTH2k ,&loop JCN
|
||||
|
|
|
@ -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
|
||||
|
|
@ -545,7 +545,6 @@ JMP2r
|
|||
&no-blank
|
||||
DUP ,&zero STR
|
||||
&padded #30 SFT #00 SWP ;font-hex ADD2
|
||||
JMP2r
|
||||
|
||||
JMP2r
|
||||
&zero $1
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
( Clock )
|
||||
( simple graphical clock )
|
||||
|
||||
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|
||||
|10 @Console [ &vector $2 &read $1 &pad $5 &write $1 &error $1 ]
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
%MOD { DIVk MUL SUB }
|
||||
%MOD2 { DIV2k MUL2 SUB2 }
|
||||
|
||||
%AUTO-NONE { #00 .Screen/auto DEO }
|
||||
%AUTO-X { #01 .Screen/auto DEO }
|
||||
%AUTO-Y { #02 .Screen/auto DEO }
|
||||
%AUTO-XY { #03 .Screen/auto DEO }
|
||||
|
@ -127,7 +126,7 @@ BRK
|
|||
.Screen/y DEI2k #0008 ++ ROT DEO2
|
||||
INC GTHk ,&ver JCN
|
||||
POP2
|
||||
AUTO-NONE
|
||||
#00 .Screen/auto DEO
|
||||
|
||||
RTN
|
||||
&blank-icn 8000 0000 0000 0000
|
||||
|
|
|
@ -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
|
|
@ -1,30 +1,5 @@
|
|||
( 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
|
||||
|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
|
||||
|
@ -79,14 +54,14 @@
|
|||
#0010 .browser/y STZ2
|
||||
.Screen/height DEI2 #33 SFT2 #0011 SUB2 .browser/y2 STZ2
|
||||
|
||||
( theme support )
|
||||
;load-theme JSR2
|
||||
|
||||
( draw mascot )
|
||||
#0010 #0010 #0060 #0060 ;mascot-icn #01 ;draw-icn JSR2
|
||||
|
||||
;load-dir JSR2
|
||||
|
||||
( theme support )
|
||||
;load-theme JSR2
|
||||
|
||||
( force selection )
|
||||
#ff .browser/last STZ
|
||||
#00 ;select-file JSR2
|
||||
|
@ -129,7 +104,7 @@ BRK
|
|||
.Mouse/y DEI2 .browser/y2 LDZ2 #0010 SUB2 GTH2 ,&outside JCN
|
||||
( select choice )
|
||||
.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 )
|
||||
.Mouse/state DEI #00 EQU ,&no-click JCN
|
||||
.browser/sel LDZ ;run-file JSR2
|
||||
|
@ -187,17 +162,17 @@ BRK
|
|||
INC2 LDAk ,&while JCN
|
||||
POP2
|
||||
|
||||
RTN
|
||||
JMP2r
|
||||
|
||||
@select-file ( id -- )
|
||||
|
||||
( has changed )
|
||||
DUP .browser/last LDZ NEQ ,&has-changed JCN
|
||||
POP RTN
|
||||
POP JMP2r
|
||||
&has-changed
|
||||
( beyond )
|
||||
DUP .browser/lines LDZ LTH ,&valid JCN
|
||||
POP RTN
|
||||
POP JMP2r
|
||||
&valid
|
||||
|
||||
#00 ;draw-browser JSR2
|
||||
|
@ -208,23 +183,23 @@ RTN
|
|||
|
||||
( draw mascot )
|
||||
#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 position )
|
||||
AUTO-YADDR
|
||||
#06 .Screen/auto DEO
|
||||
#0010 .Screen/x DEO2
|
||||
#0080 .Screen/y DEO2
|
||||
.browser/sel LDZ #02 ;draw-byte JSR2
|
||||
LIT '/ #02 ;draw-char JSR2
|
||||
.browser/lines LDZ #01 SUB #02 ;draw-byte JSR2
|
||||
AUTO-NONE
|
||||
#00 .Screen/auto DEO
|
||||
|
||||
RTN
|
||||
JMP2r
|
||||
|
||||
@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
|
||||
.browser/scroll LDZ INC ,scroll-to JSR
|
||||
&no-down
|
||||
|
@ -233,25 +208,25 @@ RTN
|
|||
&no-up
|
||||
POP2
|
||||
|
||||
RTN
|
||||
JMP2r
|
||||
|
||||
@scroll-to ( line -- )
|
||||
|
||||
STH
|
||||
( 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
|
||||
POPr POP2 RTN
|
||||
POPr POP2 JMP2r
|
||||
&can-scroll
|
||||
( less than max scroll )
|
||||
SUB INC STHkr GTH ,&valid-scroll JCN
|
||||
POPr RTN
|
||||
POPr JMP2r
|
||||
&valid-scroll
|
||||
#00 ;draw-browser JSR2
|
||||
STHr .browser/scroll STZ
|
||||
#01 ;draw-browser JSR2
|
||||
|
||||
RTN
|
||||
JMP2r
|
||||
|
||||
@run-file ( id -- )
|
||||
|
||||
|
@ -270,13 +245,13 @@ RTN
|
|||
;&output-path ;asma-assemble-file JSR2
|
||||
;load-dir JSR2
|
||||
;redraw JSR2
|
||||
RTN
|
||||
JMP2r
|
||||
&no-tal
|
||||
POP2 RTN
|
||||
POP2 JMP2r
|
||||
&valid
|
||||
;load-rom JSR2
|
||||
|
||||
RTN
|
||||
JMP2r
|
||||
&tal-ext ".tal $1
|
||||
&rom-ext ".rom $1
|
||||
&output-path $20
|
||||
|
@ -287,7 +262,7 @@ RTN
|
|||
#ff .browser/last STZ
|
||||
#00 ;select-file JSR2
|
||||
|
||||
RTN
|
||||
JMP2r
|
||||
|
||||
@draw-browser ( mask -- )
|
||||
|
||||
|
@ -298,17 +273,17 @@ RTN
|
|||
|
||||
( draw hand )
|
||||
.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
|
||||
;hand-icn STHkr #02 MUL ;draw-icn JSR2
|
||||
;hand-icn STHkr #10 SFT ;draw-icn JSR2
|
||||
( draw files )
|
||||
LINES-COUNT #00
|
||||
.browser/y2 LDZ2 .browser/y LDZ2 SUB2 #04 SFT2 NIP #00
|
||||
&loop
|
||||
( reached end )
|
||||
DUP INC .browser/lines LDZ GTH ,&end JCN
|
||||
INCk .browser/lines LDZ GTH ,&end JCN
|
||||
( has file )
|
||||
.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
|
||||
DUP2 ;get-type JSR2 ;draw-type JSR2
|
||||
#01 STHkr MUL ;draw-str JSR2
|
||||
|
@ -318,7 +293,7 @@ RTN
|
|||
|
||||
POPr
|
||||
|
||||
RTN
|
||||
JMP2r
|
||||
|
||||
@draw-browser-empty ( mask -- )
|
||||
|
||||
|
@ -327,14 +302,14 @@ RTN
|
|||
.browser/y LDZ2 .Screen/y DEO2
|
||||
;&empty-txt #01 ;draw-str JSR2
|
||||
|
||||
RTN
|
||||
JMP2r
|
||||
&empty-txt "Empty 20 "Folder $1
|
||||
|
||||
@get-type ( line* -- type )
|
||||
|
||||
;scap JSR2 #0004 SUB2 ;&rom-ext ;scmp JSR2
|
||||
|
||||
RTN
|
||||
JMP2r
|
||||
&rom-ext ".rom $1
|
||||
|
||||
@get-entry ( id -- addr* )
|
||||
|
@ -344,7 +319,7 @@ RTN
|
|||
;dir/length LDA2 #0000
|
||||
&loop
|
||||
EQUkr STHr #00 EQU ,&no-reached JCN
|
||||
POP2r NIP2 ;dir/data ADD2 RTN
|
||||
POP2r NIP2 ;dir/data ADD2 JMP2r
|
||||
&no-reached
|
||||
DUP2 ;dir/data ADD2 LDA #00 NEQ ,&no-lb JCN
|
||||
INCr
|
||||
|
@ -354,12 +329,12 @@ RTN
|
|||
POP2r
|
||||
;dir/data
|
||||
|
||||
RTN
|
||||
JMP2r
|
||||
|
||||
@draw-type ( type -- )
|
||||
|
||||
STHk TOS 20** ;file-icns ADD2 .Screen/addr DEO2
|
||||
AUTO-XADDR
|
||||
STHk #00 SWP #50 SFT2 ;file-icns ADD2 .Screen/addr DEO2
|
||||
#05 .Screen/auto DEO
|
||||
#02 STHkr SUB .Screen/sprite DEOk DEO
|
||||
|
||||
.Screen/x DEI2k #0010 SUB2 ROT DEO2
|
||||
|
@ -369,13 +344,13 @@ RTN
|
|||
|
||||
.Screen/x DEI2k #0008 ADD2 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 -- )
|
||||
|
||||
AUTO-XADDR
|
||||
#05 .Screen/auto DEO
|
||||
( load ) STH .Screen/addr DEO2 ,&height STR2 ,&width STR2 ,&y STR2 ,&x STR2
|
||||
,&height LDR2 #0000
|
||||
&ver
|
||||
|
@ -389,14 +364,14 @@ RTN
|
|||
#0008 ADD2 GTH2k ,&ver JCN
|
||||
POP2 POP2
|
||||
POPr
|
||||
AUTO-NONE
|
||||
#00 .Screen/auto DEO
|
||||
|
||||
RTN
|
||||
JMP2r
|
||||
&x $2 &y $2 &width $2 &height $2
|
||||
|
||||
@draw-str ( text* color -- )
|
||||
|
||||
AUTO-YADDR
|
||||
#06 .Screen/auto DEO
|
||||
STH
|
||||
&while
|
||||
LDAk STHkr ,draw-char JSR
|
||||
|
@ -404,14 +379,7 @@ RTN
|
|||
POP2
|
||||
POPr
|
||||
|
||||
RTN
|
||||
|
||||
@draw-short ( short* color -- )
|
||||
|
||||
STH SWP STHkr ,draw-byte JSR
|
||||
STHr ,draw-byte JSR
|
||||
|
||||
RTN
|
||||
JMP2r
|
||||
|
||||
@draw-byte ( byte color -- )
|
||||
|
||||
|
@ -419,17 +387,16 @@ RTN
|
|||
DUP #04 SFT ,&parse JSR STHkr ,draw-char JSR
|
||||
#0f AND ,&parse JSR STHr ,draw-char JSR
|
||||
|
||||
RTN
|
||||
JMP2r
|
||||
&parse ( byte -- char ) DUP #09 GTH ,&above JCN #30 ADD JMP2r
|
||||
&above #57 ADD JMP2r
|
||||
|
||||
@draw-char ( char color -- )
|
||||
|
||||
SWP
|
||||
[ #20 SUB #00 SWP #40 SFT2 ;font ADD2 ] .Screen/addr DEO2
|
||||
.Screen/sprite DEOk DEO
|
||||
.Screen/x DEI2k #0008 ADD2 ROT DEO2
|
||||
.Screen/y DEI2k #0010 SUB2 ROT DEO2
|
||||
#15 .Screen/auto DEO
|
||||
#20 SUB #00 SWP #40 SFT2 ;font ADD2 .Screen/addr DEO2
|
||||
.Screen/sprite DEO
|
||||
|
||||
JMP2r
|
||||
|
||||
|
@ -448,68 +415,28 @@ JMP2r
|
|||
#fffc LDA2 .System/g DEO2
|
||||
#fffe LDA2 .System/b DEO2
|
||||
&ignore
|
||||
;redraw JSR2
|
||||
|
||||
RTN
|
||||
JMP2r
|
||||
|
||||
( 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 )
|
||||
|
||||
STH2
|
||||
&loop
|
||||
LDAk LDAkr STHr EQU ,¬-diff JCN
|
||||
POP2 POP2r #00 RTN
|
||||
¬-diff
|
||||
LDAk LDAkr STHr #0000 NEQ2 ,¬-end JCN
|
||||
POP2 POP2r #01 RTN
|
||||
LDAk LDAkr STHr NEQ ,&end JCN
|
||||
LDAk LDAkr STHr ORA ,¬-end JCN
|
||||
POP2 POP2r #01 JMP2r
|
||||
¬-end
|
||||
INC2 INC2r
|
||||
,&loop JMP
|
||||
INC2 INC2r ,&loop JMP
|
||||
&end
|
||||
POP2 POP2r #00
|
||||
|
||||
RTN
|
||||
JMP2r
|
||||
|
||||
@scat ( src* dst* -- )
|
||||
|
||||
DUP2 ,slen JSR ADD2 ,scpy JSR
|
||||
|
||||
JMP2r
|
||||
|
||||
@slen ( str* -- len* )
|
||||
|
||||
DUP2 ,scap JSR SWP2 SUB2
|
||||
|
||||
JMP2r
|
||||
|
||||
@scap ( str* -- end* )
|
||||
|
||||
LDAk #00 NEQ JMP JMP2r
|
||||
&while
|
||||
INC2 LDAk ,&while JCN
|
||||
|
||||
JMP2r
|
||||
DUP2 ,slen JSR ADD2
|
||||
|
||||
@scpy ( src* dst* -- )
|
||||
|
||||
|
@ -522,6 +449,19 @@ JMP2r
|
|||
|
||||
JMP2r
|
||||
|
||||
@slen ( str* -- len* )
|
||||
|
||||
DUP2 ,scap JSR SWP2 SUB2
|
||||
|
||||
JMP2r
|
||||
|
||||
@scap ( str* -- str-end* )
|
||||
|
||||
( clamp ) LDAk #00 NEQ JMP JMP2r
|
||||
&while INC2 LDAk ,&while JCN
|
||||
|
||||
JMP2r
|
||||
|
||||
@pointer-icn
|
||||
80c0 e0f0 f8e0 1000
|
||||
@hand-icn
|
||||
|
|
|
@ -59,7 +59,7 @@ JMP2r
|
|||
|
||||
@print ( short* -- )
|
||||
|
||||
&short ( short* -- ) SWP ,&byte JSR
|
||||
SWP ,&byte JSR
|
||||
&byte ( byte -- ) DUP #04 SFT ,&char JSR
|
||||
&char ( char -- ) #0f AND DUP #09 GTH #27 MUL ADD #30 ADD #18 DEO
|
||||
|
||||
|
|
|
@ -2,16 +2,6 @@
|
|||
converts a binary file to a proquints, identifiers that are readable, and pronounceable.
|
||||
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 )
|
||||
|
||||
|
@ -39,13 +29,13 @@ BRK
|
|||
#01 ,&trap STR
|
||||
&started
|
||||
( append )
|
||||
.Console/read DEI #20 < ,&validate JCN
|
||||
;src ;slen JSR2 #0030 == ,&validate JCN
|
||||
.Console/read DEI #20 LTH ,&validate JCN
|
||||
;src ;slen JSR2 #0030 EQU2 ,&validate JCN
|
||||
;src .Console/read DEI ;sput JSR2 BRK
|
||||
&validate
|
||||
( load )
|
||||
;src .File/name DEO2
|
||||
#fff0 ;data -- .File/length DEO2
|
||||
#fff0 ;data SUB2 .File/length DEO2
|
||||
;data .File/read DEO2
|
||||
( save length )
|
||||
.File/success DEI2 .length STZ2
|
||||
|
@ -56,12 +46,12 @@ BRK
|
|||
|
||||
@parse ( -- )
|
||||
|
||||
.length LDZ2 ;data ++ ;data
|
||||
.length LDZ2 ;data ADD2 ;data
|
||||
&loop
|
||||
LDA2k ,proquint JSR
|
||||
INC2 INC2 GTH2k ,&loop JCN
|
||||
POP2 POP2
|
||||
HALT
|
||||
#010f DEO
|
||||
|
||||
JMP2r
|
||||
|
||||
|
@ -72,23 +62,23 @@ JMP2r
|
|||
( c2 ) DUP2 #06 ,&emit-con JSR
|
||||
( v2 ) DUP2 #03 ,&emit-vow JSR
|
||||
( c3 ) #00 ,&emit-con JSR
|
||||
#20 EMIT
|
||||
#2018 DEO
|
||||
|
||||
JMP2r
|
||||
&emit-con SFT2 #000f AND2 ;&con ADD2 LDA EMIT JMP2r
|
||||
&emit-con SFT2 #000f AND2 ;&con ADD2 LDA #18 DEO JMP2r
|
||||
&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
|
||||
|
||||
@slen ( str* -- len* )
|
||||
|
||||
DUP2 ,scap JSR SWP2 --
|
||||
DUP2 ,scap JSR SWP2 SUB2
|
||||
|
||||
JMP2r
|
||||
|
||||
@scap ( str* -- end* )
|
||||
|
||||
LDAk #00 ! JMP JMP2r
|
||||
LDAk #00 NEQ JMP JMP2r
|
||||
&while
|
||||
INC2 LDAk ,&while JCN
|
||||
|
||||
|
@ -102,7 +92,7 @@ JMP2r
|
|||
|
||||
@mclr ( addr* len* -- )
|
||||
|
||||
OVR2 ++ SWP2
|
||||
OVR2 ADD2 SWP2
|
||||
&loop
|
||||
STH2k #00 STH2r STA
|
||||
INC2 GTH2k ,&loop JCN
|
||||
|
|
Loading…
Reference in New Issue