Improvement of examples

This commit is contained in:
neauoire 2021-08-17 19:17:47 -07:00
parent 511b2366ee
commit ddac370775
11 changed files with 102 additions and 89 deletions

View File

@ -54,9 +54,9 @@ then
fi fi
echo "Assembling.." echo "Assembling.."
./bin/uxnasm projects/examples/demos/life.tal bin/life.rom ./bin/uxnasm projects/examples/demos/piano.tal bin/piano.rom
echo "Running.." echo "Running.."
./bin/uxnemu bin/life.rom ./bin/uxnemu bin/piano.rom
echo "Done." echo "Done."

View File

@ -142,7 +142,7 @@
OVR #01 ;draw-pad JSR2 OVR #01 ;draw-pad JSR2
( draw mixer ) ( draw mixer )
OVR #04 / ;draw-mixer JSR2 OVR #04 / ;draw-mixer JSR2
( incr ) SWP #01 + SWP ( incr ) SWP INC SWP
LTHk ,&draw-pads JCN LTHk ,&draw-pads JCN
POP2 POP2
@ -166,7 +166,7 @@ BRK
( y ) .mix-view/y1 LDZ2 PAD-HEIGHT STHkr TOS ** ++ #0002 ++ ( y ) .mix-view/y1 LDZ2 PAD-HEIGHT STHkr TOS ** ++ #0002 ++
( output ) .Audio0/output STHr #40 SFT + DEI ( output ) .Audio0/output STHr #40 SFT + DEI
;draw-monitor JSR2 ;draw-monitor JSR2
( incr ) SWP #01 + SWP ( incr ) SWP INC SWP
LTHk ,&loop JCN LTHk ,&loop JCN
POP2 POP2
@ -178,15 +178,15 @@ BRK
.Mouse/state DEI #00 ! #01 JCN [ BRK ] .Mouse/state DEI #00 ! #01 JCN [ BRK ]
.Mouse/x DEI2 DUP2 .pad-view/x1 LDZ2 >> ROT ROT .pad-view/x2 LDZ2 #0001 ++ << #0101 == .Mouse/x DEI2 DUP2 .pad-view/x1 LDZ2 >> ROT ROT .pad-view/x2 LDZ2 INC2 << #0101 ==
.Mouse/y DEI2 DUP2 .pad-view/y1 LDZ2 >> ROT ROT .pad-view/y2 LDZ2 << #0101 == .Mouse/y DEI2 DUP2 .pad-view/y1 LDZ2 >> ROT ROT .pad-view/y2 LDZ2 << #0101 ==
#0101 == ;on-touch-pad JCN2 #0101 == ;on-touch-pad JCN2
.Mouse/x DEI2 DUP2 .mix-view/x1 LDZ2 >> ROT ROT .mix-view/x2 LDZ2 #0001 ++ << #0101 == .Mouse/x DEI2 DUP2 .mix-view/x1 LDZ2 >> ROT ROT .mix-view/x2 LDZ2 INC2 << #0101 ==
.Mouse/y DEI2 DUP2 .mix-view/y1 LDZ2 >> ROT ROT .mix-view/y2 LDZ2 << #0101 == .Mouse/y DEI2 DUP2 .mix-view/y1 LDZ2 >> ROT ROT .mix-view/y2 LDZ2 << #0101 ==
#0101 == ;on-touch-mix JCN2 #0101 == ;on-touch-mix JCN2
.Mouse/x DEI2 DUP2 .oct-view/x1 LDZ2 >> ROT ROT .oct-view/x2 LDZ2 #0001 ++ << #0101 == .Mouse/x DEI2 DUP2 .oct-view/x1 LDZ2 >> ROT ROT .oct-view/x2 LDZ2 INC2 << #0101 ==
.Mouse/y DEI2 DUP2 .oct-view/y1 LDZ2 >> ROT ROT .oct-view/y2 LDZ2 << #0101 == .Mouse/y DEI2 DUP2 .oct-view/y1 LDZ2 >> ROT ROT .oct-view/y2 LDZ2 << #0101 ==
#0101 == ;on-touch-oct JCN2 #0101 == ;on-touch-oct JCN2
@ -244,13 +244,13 @@ BRK
DUP #f0 AND STH #01 .Mouse/state DEI #10 = #0e * + + #0f AND STHr + DUP #f0 AND STH #01 .Mouse/state DEI #10 = #0e * + + #0f AND STHr +
.Audio0/adsr [ STHkr #40 SFT + ] DEO &no-d .Audio0/adsr [ STHkr #40 SFT + ] DEO &no-d
DUP #02 ! ,&no-s JCN DUP #02 ! ,&no-s JCN
.Audio0/adsr [ STHkr #40 SFT + ] #01 + DEI .Audio0/adsr [ STHkr #40 SFT + ] INC DEI
#10 .Mouse/state DEI #10 = #e0 * + + #10 .Mouse/state DEI #10 = #e0 * + +
.Audio0/adsr [ STHkr #40 SFT + ] #01 + DEO &no-s .Audio0/adsr [ STHkr #40 SFT + ] INC DEO &no-s
DUP #03 ! ,&no-r JCN DUP #03 ! ,&no-r JCN
.Audio0/adsr [ STHkr #40 SFT + ] #01 + DEI .Audio0/adsr [ STHkr #40 SFT + ] INC DEI
DUP #f0 AND STH #01 .Mouse/state DEI #10 = #0e * + + #0f AND STHr + DUP #f0 AND STH #01 .Mouse/state DEI #10 = #0e * + + #0f AND STHr +
.Audio0/adsr [ STHkr #40 SFT + ] #01 + DEO &no-r .Audio0/adsr [ STHkr #40 SFT + ] INC DEO &no-r
( modes ) ( modes )
DUP #04 ! ,&no-repeat JCN DUP #04 ! ,&no-repeat JCN
.modes [ STHkr + ] LDZ .modes [ STHkr + ] LDZ
@ -280,7 +280,7 @@ BRK
.Mouse/x DEI2 .oct-view/x1 LDZ2 -- 8// TOB #08 ! ,&no-mod JCN .Mouse/x DEI2 .oct-view/x1 LDZ2 -- 8// TOB #08 ! ,&no-mod JCN
.Mouse/y DEI2 .oct-view/y1 LDZ2 -- 8// TOB .Mouse/y DEI2 .oct-view/y1 LDZ2 -- 8// TOB
DUP #00 ! ,&no-incr JCN DUP #00 ! ,&no-incr JCN
.piano/octave LDZ #01 + .piano/octave STZ &no-incr .piano/octave LDZ INC .piano/octave STZ &no-incr
DUP #02 ! ,&no-decr JCN DUP #02 ! ,&no-decr JCN
.piano/octave LDZ #01 - .piano/octave STZ &no-decr .piano/octave LDZ #01 - .piano/octave STZ &no-decr
POP POP
@ -346,9 +346,9 @@ RTN
OVR TOS 10** [ DUP2r STH2r ] ++ LDA OVR TOS 10** [ DUP2r STH2r ] ++ LDA
#02 / #02 /
TOS 4// .wav-view/y1 LDZ2 ++ .Screen/y DEO2 TOS 4// .wav-view/y1 LDZ2 ++ .Screen/y DEO2
.Screen/x DEI2 #0001 ++ .Screen/x DEO2 .Screen/x DEI2 INC2 .Screen/x DEO2
( draw ) #02 .Screen/pixel DEO ( draw ) #02 .Screen/pixel DEO
( incr ) SWP #01 + SWP ( incr ) SWP INC SWP
LTHk ,&loop JCN LTHk ,&loop JCN
POP2 POP2
POP2r POP2r
@ -365,9 +365,9 @@ RTN
DUP2 .mix-view/x1 LDZ2 #0010 ++ SWP2 DUP2 .mix-view/x1 LDZ2 #0010 ++ SWP2
.Audio0/adsr [ STHkr #40 SFT + ] DEI #0f AND ;draw-knob JSR2 .Audio0/adsr [ STHkr #40 SFT + ] DEI #0f AND ;draw-knob JSR2
DUP2 .mix-view/x1 LDZ2 #0020 ++ SWP2 DUP2 .mix-view/x1 LDZ2 #0020 ++ SWP2
.Audio0/adsr [ STHkr #40 SFT + ] #01 + DEI #04 SFT ;draw-knob JSR2 .Audio0/adsr [ STHkr #40 SFT + ] INC DEI #04 SFT ;draw-knob JSR2
DUP2 .mix-view/x1 LDZ2 #0030 ++ SWP2 DUP2 .mix-view/x1 LDZ2 #0030 ++ SWP2
.Audio0/adsr [ STHkr #40 SFT + ] #01 + DEI #0f AND ;draw-knob JSR2 .Audio0/adsr [ STHkr #40 SFT + ] INC DEI #0f AND ;draw-knob JSR2
( once/repeat ) ( once/repeat )
DUP2 .mix-view/x1 LDZ2 #0040 ++ SWP2 DUP2 .mix-view/x1 LDZ2 #0040 ++ SWP2
.modes [ STHkr + ] LDZ ;draw-switch JSR2 .modes [ STHkr + ] LDZ ;draw-switch JSR2
@ -460,12 +460,12 @@ RTN
#00 #0f #00 #0f
&loop &loop
OVR #10 SWP - STHkr #0f AND < #01 + .Screen/pixel DEO OVR #10 SWP - STHkr #0f AND < INC .Screen/pixel DEO
.Screen/x DEI2 #0002 ++ .Screen/x DEO2 .Screen/x DEI2 #0002 ++ .Screen/x DEO2
OVR #10 SWP - STHkr #04 SFT < #01 + .Screen/pixel DEO OVR #10 SWP - STHkr #04 SFT < INC .Screen/pixel DEO
.Screen/x DEI2 #0002 -- .Screen/x DEO2 .Screen/x DEI2 #0002 -- .Screen/x DEO2
.Screen/y DEI2 #0002 ++ .Screen/y DEO2 .Screen/y DEI2 #0002 ++ .Screen/y DEO2
( incr ) SWP #01 + SWP ( incr ) SWP INC SWP
LTHk ,&loop JCN LTHk ,&loop JCN
POP2 POP2
@ -552,21 +552,21 @@ RTN
@line-rect ( x1* y1* x2* y2* color -- ) @line-rect ( x1* y1* x2* y2* color -- )
( load ) .color STZ DUP2 STH2 .rect/y2 STZ2 .rect/x2 STZ2 DUP2 STH2 .rect/y1 STZ2 .rect/x1 STZ2 ( load ) .color STZ DUP2 STH2 .rect/y2 STZ2 .rect/x2 STZ2 DUP2 STH2 .rect/y1 STZ2 .rect/x1 STZ2
STH2r #0001 ++ STH2r STH2r INC2 STH2r
&ver &ver
( save ) OVR2 .Screen/y DEO2 ( save ) OVR2 .Screen/y DEO2
( draw ) .rect/x1 LDZ2 .Screen/x DEO2 .color LDZ DUP .Screen/pixel DEO ( draw ) .rect/x1 LDZ2 .Screen/x DEO2 .color LDZ DUP .Screen/pixel DEO
( draw ) .rect/x2 LDZ2 .Screen/x DEO2 .Screen/pixel DEO ( draw ) .rect/x2 LDZ2 .Screen/x DEO2 .Screen/pixel DEO
( incr ) SWP2 #0001 ++ SWP2 ( incr ) SWP2 INC2 SWP2
OVR2 OVR2 LTS2 ,&ver JCN OVR2 OVR2 LTS2 ,&ver JCN
POP2 POP2 POP2 POP2
.rect/x1 LDZ2 #0001 ++ .rect/x2 LDZ2 #0001 -- .rect/x1 LDZ2 INC2 .rect/x2 LDZ2 #0001 --
&hor &hor
( save ) OVR2 .Screen/x DEO2 ( save ) OVR2 .Screen/x DEO2
( draw ) .rect/y1 LDZ2 .Screen/y DEO2 .color LDZ DUP .Screen/pixel DEO ( draw ) .rect/y1 LDZ2 .Screen/y DEO2 .color LDZ DUP .Screen/pixel DEO
( draw ) .rect/y2 LDZ2 .Screen/y DEO2 .Screen/pixel DEO ( draw ) .rect/y2 LDZ2 .Screen/y DEO2 .Screen/pixel DEO
( incr ) SWP2 #0001 ++ SWP2 ( incr ) SWP2 INC2 SWP2
OVR2 OVR2 #0001 ++ LTS2 ,&hor JCN OVR2 OVR2 INC2 LTS2 ,&hor JCN
POP2 POP2 POP2 POP2
RTN RTN
@ -576,11 +576,11 @@ RTN
( load ) STH STH2 .Screen/y DEO2 .Screen/x DEO2 ( load ) STH STH2 .Screen/y DEO2 .Screen/x DEO2
STH2r STH2r
&loop &loop
DUP2 LDA #00 SWP #0030 -- 8** ;font-num-uc ++ .Screen/addr DEO2 LDAk #00 SWP #0030 -- 8** ;font-num-uc ++ .Screen/addr DEO2
( draw ) STHkr .Screen/sprite DEO ( draw ) STHkr .Screen/sprite DEO
( incr ) #0001 ++ ( incr ) INC2
( incr ) .Screen/x DEI2 #0008 ++ .Screen/x DEO2 ( incr ) .Screen/x DEI2 #0008 ++ .Screen/x DEO2
DUP2 LDA #00 ! ,&loop JCN LDAk #00 ! ,&loop JCN
POP2 POP2
POPr POPr
@ -596,10 +596,10 @@ RTN
&hor &hor
( save ) OVR2 .Screen/x DEO2 ( save ) OVR2 .Screen/x DEO2
( draw ) .color LDZ .Screen/pixel DEO ( draw ) .color LDZ .Screen/pixel DEO
( incr ) SWP2 #0001 ++ SWP2 ( incr ) SWP2 INC2 SWP2
OVR2 OVR2 LTS2 ,&hor JCN OVR2 OVR2 LTS2 ,&hor JCN
POP2 POP2 STH2r STH2r POP2 POP2 STH2r STH2r
( incr ) SWP2 #0001 ++ SWP2 ( incr ) SWP2 INC2 SWP2
OVR2 OVR2 LTS2 ,&ver JCN OVR2 OVR2 LTS2 ,&ver JCN
POP2 POP2 POP2 POP2 POP2 POP2 POP2 POP2

View File

@ -452,10 +452,10 @@ RTN
( load ) .label/addr STZ2 .label/color STZ .Screen/y DEO2 .Screen/x DEO2 ( load ) .label/addr STZ2 .label/color STZ .Screen/y DEO2 .Screen/x DEO2
.label/addr LDZ2 .label/addr LDZ2
&loop &loop
( draw ) DUP2 LDA #00 SWP 8** ;font ADD2 .Screen/addr DEO2 .label/color LDZ .Screen/sprite DEO ( draw ) LDAk #00 SWP 8** ;font ADD2 .Screen/addr DEO2 .label/color LDZ .Screen/sprite DEO
( incr ) ++ ( incr ) ++
( incr ) .Screen/x DEI2 8++ .Screen/x DEO2 ( incr ) .Screen/x DEI2 8++ .Screen/x DEO2
DUP2 LDA ,&loop JCN LDAk ,&loop JCN
POP2 POP2
RTN RTN

View File

@ -11,6 +11,7 @@
%MOD { DUP2 / * - } %MOD { DUP2 / * - }
%LTS2 { #8000 ++ SWP2 #8000 ++ >> } %LTS2 { #8000 ++ SWP2 #8000 ++ >> }
%GTS2 { #8000 ++ SWP2 #8000 ++ << } %GTS2 { #8000 ++ SWP2 #8000 ++ << }
%2/ { #01 SFT }
%2// { #01 SFT2 } %2// { #01 SFT2 }
%4// { #02 SFT2 } %4// { #02 SFT2 }
%8// { #03 SFT2 } %8// { #03 SFT2 }
@ -102,7 +103,7 @@ BRK
.adsr-view/x2 LDZ2 #003a -- #0002 ++ .Screen/x DEO2 .adsr-view/x2 LDZ2 #003a -- #0002 ++ .Screen/x DEO2
#10 OVR - .Audio0/output DEI #04 SFT < .Screen/pixel DEO #10 OVR - .Audio0/output DEI #04 SFT < .Screen/pixel DEO
.Screen/y DEI2 #0002 ++ .Screen/y DEO2 .Screen/y DEI2 #0002 ++ .Screen/y DEO2
#01 + GTHk ,&loop JCN INC GTHk ,&loop JCN
POP2 POP2
BRK BRK
@ -140,7 +141,7 @@ BRK
DUP #04 SFT #01 AND #01 ! ,&no-up JCN DUP #04 SFT #01 AND #01 ! ,&no-up JCN
( move ) .Audio0/addr DEI2 #0001 -- .Audio0/addr DEO2 &no-up ( move ) .Audio0/addr DEI2 #0001 -- .Audio0/addr DEO2 &no-up
DUP #05 SFT #01 AND #01 ! ,&no-down JCN DUP #05 SFT #01 AND #01 ! ,&no-down JCN
( move ) .Audio0/addr DEI2 #0001 ++ .Audio0/addr DEO2 &no-down ( move ) .Audio0/addr DEI2 INC2 .Audio0/addr DEO2 &no-down
DUP #06 SFT #01 AND #01 ! ,&no-left JCN DUP #06 SFT #01 AND #01 ! ,&no-left JCN
( move ) .Audio0/addr DEI2 #0010 -- .Audio0/addr DEO2 &no-left ( move ) .Audio0/addr DEI2 #0010 -- .Audio0/addr DEO2 &no-left
DUP #07 SFT #01 AND #01 ! ,&no-right JCN DUP #07 SFT #01 AND #01 ! ,&no-right JCN
@ -188,7 +189,7 @@ BRK
.Mouse/y DEI2 .octave-view/y1 LDZ2 -- 8// NIP .Mouse/y DEI2 .octave-view/y1 LDZ2 -- 8// NIP
[ #00 ] !~ ,&no-incr JCN [ #00 ] !~ ,&no-incr JCN
.octave LDZ #03 = ,&no-incr JCN .octave LDZ #03 = ,&no-incr JCN
.octave LDZ #01 + .octave STZ &no-incr .octave LDZ INC .octave STZ &no-incr
[ #02 ] !~ ,&no-decr JCN [ #02 ] !~ ,&no-decr JCN
.octave LDZ #ff = ,&no-decr JCN .octave LDZ #ff = ,&no-decr JCN
.octave LDZ #01 - .octave STZ &no-decr .octave LDZ #01 - .octave STZ &no-decr
@ -218,13 +219,13 @@ BRK
DUP #f0 AND STH #01 .Mouse/state DEI #10 = #0e * + + #0f AND STHr + DUP #f0 AND STH #01 .Mouse/state DEI #10 = #0e * + + #0f AND STHr +
.Audio0/adsr DEO &no-d .Audio0/adsr DEO &no-d
[ #02 ] !~ ,&no-s JCN [ #02 ] !~ ,&no-s JCN
.Audio0/adsr #01 + DEI .Audio0/adsr INC DEI
#10 .Mouse/state DEI #10 = #e0 * + + #10 .Mouse/state DEI #10 = #e0 * + +
.Audio0/adsr #01 + DEO &no-s .Audio0/adsr INC DEO &no-s
[ #03 ] !~ ,&no-r JCN [ #03 ] !~ ,&no-r JCN
.Audio0/adsr #01 + DEI .Audio0/adsr INC DEI
DUP #f0 AND STH #01 .Mouse/state DEI #10 = #0e * + + #0f AND STHr + DUP #f0 AND STH #01 .Mouse/state DEI #10 = #0e * + + #0f AND STHr +
.Audio0/adsr #01 + DEO &no-r .Audio0/adsr INC DEO &no-r
[ #05 ] !~ ,&no-left JCN [ #05 ] !~ ,&no-left JCN
.Audio0/volume DEI .Audio0/volume DEI
#10 .Mouse/state DEI #10 = #e0 * + + #10 .Mouse/state DEI #10 = #e0 * + +
@ -317,10 +318,10 @@ RTN
.Audio0/adsr DEI #0f AND .Audio0/adsr DEI #0f AND
;draw-knob JSR2 ;draw-knob JSR2
.adsr-view/x1 LDZ2 #0030 ++ .adsr-view/y1 LDZ2 .adsr-view/x1 LDZ2 #0030 ++ .adsr-view/y1 LDZ2
.Audio0/adsr #01 + DEI #04 SFT .Audio0/adsr INC DEI #04 SFT
;draw-knob JSR2 ;draw-knob JSR2
.adsr-view/x1 LDZ2 #0048 ++ .adsr-view/y1 LDZ2 .adsr-view/x1 LDZ2 #0048 ++ .adsr-view/y1 LDZ2
.Audio0/adsr #01 + DEI #0f AND .Audio0/adsr INC DEI #0f AND
;draw-knob JSR2 ;draw-knob JSR2
( volume ) ( volume )
.adsr-view/x2 LDZ2 #0028 -- .adsr-view/y1 LDZ2 .adsr-view/x2 LDZ2 #0028 -- .adsr-view/y1 LDZ2
@ -337,7 +338,7 @@ RTN
( clear ) ( clear )
.wave-view/x1 LDZ2 .wave-view/x1 LDZ2
.wave-view/y1 LDZ2 .wave-view/y1 LDZ2
.wave-view/x2 LDZ2 #0001 ++ .wave-view/x2 LDZ2 INC2
.wave-view/y2 LDZ2 .wave-view/y2 LDZ2
#00 ;fill-rect JSR2 #00 ;fill-rect JSR2
@ -354,13 +355,13 @@ RTN
#03 .Screen/pixel DEO #03 .Screen/pixel DEO
&no-dot &no-dot
DUP TOS .Audio0/addr DEI2 ++ LDA DUP TOS .Audio0/addr DEI2 ++ LDA
#02 / 2/
TOS 4// .wave-view/y1 LDZ2 ++ .Screen/y DEO2 TOS 4// .wave-view/y1 LDZ2 ++ .Screen/y DEO2
.Screen/x DEI2 #0001 ++ .Screen/x DEO2 .Screen/x DEI2 INC2 .Screen/x DEO2
( draw ) DUP ( draw ) DUP
.Audio0/length DEI2 NIP > .Audio0/length DEI2 NIP >
.Audio0/length DEI2 #0100 !! #0101 == DUP ADD #01 + .Screen/pixel DEO .Audio0/length DEI2 #0100 !! #0101 == DUP ADD INC .Screen/pixel DEO
#01 + GTHk ,&loop JCN INC GTHk ,&loop JCN
POP2 POP2
( range ) ( range )
@ -380,7 +381,7 @@ RTN
&loop &loop
DUP2 .Screen/y DEO2 DUP2 .Screen/y DEO2
( draw ) STHkr .Screen/pixel DEO ( draw ) STHkr .Screen/pixel DEO
#0001 ++ GTH2k ,&loop JCN INC2 GTH2k ,&loop JCN
POP2 POP2 POP2 POP2
POPr POPr
@ -438,10 +439,10 @@ RTN
&hor &hor
( save ) DUP2 .Screen/x DEO2 ( save ) DUP2 .Screen/x DEO2
( draw ) ,&color LDR .Screen/pixel DEO ( draw ) ,&color LDR .Screen/pixel DEO
( incr ) #0001 ++ ( incr ) INC2
OVR2 OVR2 GTS2 ,&hor JCN OVR2 OVR2 GTS2 ,&hor JCN
POP2 POP2 STH2r STH2r POP2 POP2 STH2r STH2r
( incr ) #0001 ++ ( incr ) INC2
OVR2 OVR2 GTS2 ,&ver JCN OVR2 OVR2 GTS2 ,&ver JCN
POP2 POP2 POP2 POP2 POP2 POP2 POP2 POP2

View File

@ -52,7 +52,7 @@ BRK
@on-frame ( -> ) @on-frame ( -> )
.cat/timer LDZ #01 ADD [ DUP ] .cat/timer STZ .cat/timer LDZ INC [ DUP ] .cat/timer STZ
DUP ,&skip0 JCN #0000 ;draw-tail JSR2 &skip0 DUP ,&skip0 JCN #0000 ;draw-tail JSR2 &skip0
[ #10 ] !~ ,&skip1 JCN #0001 ;draw-tail JSR2 &skip1 [ #10 ] !~ ,&skip1 JCN #0001 ;draw-tail JSR2 &skip1
[ #20 ] !~ ,&skip2 JCN #0002 ;draw-tail JSR2 &skip2 [ #20 ] !~ ,&skip2 JCN #0002 ;draw-tail JSR2 &skip2
@ -126,13 +126,13 @@ RTN
.cat/x LDZ2 #0010 SUB2 .Screen/x DEO2 .cat/x LDZ2 #0010 SUB2 .Screen/x DEO2
;ground .Screen/addr DEO2 ;ground .Screen/addr DEO2
#00 #10 #10 #00
&loop &loop
( draw ) #01 .Screen/sprite DEO ( draw ) #01 .Screen/sprite DEO
( sety ) .Screen/addr DEI2 #0008 ADD2 .Screen/addr DEO2 ( sety ) .Screen/addr DEI2 #0008 ADD2 .Screen/addr DEO2
( setx ) .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2 ( setx ) .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
( incr ) SWP #01 ADD SWP ( incr ) INC
LTHk ,&loop JCN GTHk ,&loop JCN
POP2 POP2
RTN RTN

View File

@ -327,12 +327,12 @@ RTN
.Screen/x DEO2 .Screen/x DEO2
STH2r STH2r
&loop &loop
DUP2 LDA #00 SWP 8** LDAk #00 SWP 8**
;font ADD2 .Screen/addr DEO2 ;font ADD2 .Screen/addr DEO2
( draw ) STHkr .Screen/sprite DEO ( draw ) STHkr .Screen/sprite DEO
( incr ) ++ ( incr ) ++
( incr ) .Screen/x DEI2 8+ .Screen/x DEO2 ( incr ) .Screen/x DEI2 8+ .Screen/x DEO2
DUP2 LDA ,&loop JCN LDAk ,&loop JCN
POP2 POPr POP2 POPr
RTN RTN

View File

@ -33,9 +33,9 @@ BRK
@print ( addr* -- ) @print ( addr* -- )
&loop &loop
( send ) DUP2 LDA .Console/write DEO ( send ) LDAk .Console/write DEO
( incr ) #0001 ADD2 ( incr ) #0001 ADD2
( loop ) DUP2 LDA ,&loop JCN ( loop ) LDAk ,&loop JCN
POP2 POP2
RTN RTN

View File

@ -52,19 +52,19 @@ BRK
( stash ) STH ( stash ) STH
;dvd_icn .Screen/addr DEO2 ;dvd_icn .Screen/addr DEO2
.dvd/y LDZ2 [ .dvd/y LDZ2 #0010 ADD2 ] [ .dvd/y LDZ2 #0010 ADD2 ] .dvd/y LDZ2
&ver &ver
OVR2 .Screen/y DEO2 DUP2 .Screen/y DEO2
.dvd/x LDZ2 [ .dvd/x LDZ2 #0020 ADD2 ] [ .dvd/x LDZ2 #0020 ADD2 ] .dvd/x LDZ2
&hor &hor
OVR2 .Screen/x DEO2 DUP2 .Screen/x DEO2
( draw ) STHkr .Screen/sprite DEO ( draw ) STHkr .Screen/sprite DEO
( next ) .Screen/addr DEI2 #0008 ADD2 .Screen/addr DEO2 ( next ) .Screen/addr DEI2 #0008 ADD2 .Screen/addr DEO2
( incr ) SWP2 #0008 ADD2 SWP2 ( incr ) #0008 ADD2
LTH2k ,&hor JCN GTH2k ,&hor JCN
POP2 POP2 POP2 POP2
( incr ) SWP2 #0008 ADD2 SWP2 ( incr ) #0008 ADD2
LTH2k ,&ver JCN GTH2k ,&ver JCN
POP2 POP2 POP2 POP2
( destroy ) POPr ( destroy ) POPr

View File

@ -1,6 +1,11 @@
( GUI Hover ) ( GUI Hover )
%+ { ADD } %- { SUB }
%< { LTH } %> { GTH } %= { EQU } %! { NEQ }
%++ { ADD2 } %-- { SUB2 }
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
%RTN { JMP2r } %RTN { JMP2r }
%GTS2 { #8000 ++ SWP2 #8000 ++ << }
( devices ) ( devices )
@ -12,7 +17,7 @@
|0000 |0000
@color [ &byte $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 ] @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 ]
@ -34,28 +39,27 @@
@on-mouse @on-mouse
( defaults )
;pointer_icn .pointer/sprite STZ2 ;pointer_icn .pointer/sprite STZ2
#01 .color STZ #01 .color STZ
.Mouse/x DEI2 .Mouse/y DEI2 .r1 ;within-rect JSR2 #00 EQU ,&draw1 JCN .Mouse/x DEI2 .Mouse/y DEI2 .r1 ;within-rect JSR2 #00 EQU ,&draw1 JCN
#02 .color STZ #02 .color STZ
;hand_icn .pointer/sprite STZ2 ;hand_icn .pointer/sprite STZ2
&draw1 &draw1
.r1/x1 LDZ2 .r1/y1 LDZ2 .r1/x2 LDZ2 .r1/y2 LDZ2 .color LDZ ;line-rect JSR2 .r1/x1 LDZ2 .r1/y1 LDZ2 .r1/x2 LDZ2 .r1/y2 LDZ2 .color LDZ ;line-rect JSR2
#01 .color STZ #01 .color STZ
.Mouse/x DEI2 .Mouse/y DEI2 .r2 ;within-rect JSR2 #00 EQU ,&draw2 JCN .Mouse/x DEI2 .Mouse/y DEI2 .r2 ;within-rect JSR2 #00 EQU ,&draw2 JCN
#03 .color STZ #03 .color STZ
;hand_icn .pointer/sprite STZ2 ;hand_icn .pointer/sprite STZ2
&draw2 &draw2
.r2/x1 LDZ2 .r2/y1 LDZ2 .r2/x2 LDZ2 .r2/y2 LDZ2 .color LDZ ;line-rect JSR2 .r2/x1 LDZ2 .r2/y1 LDZ2 .r2/x2 LDZ2 .r2/y2 LDZ2 .color LDZ ;line-rect JSR2
#01 .color STZ #01 .color STZ
.Mouse/x DEI2 .Mouse/y DEI2 .r3 ;within-rect JSR2 #00 EQU ,&draw3 JCN .Mouse/x DEI2 .Mouse/y DEI2 .r3 ;within-rect JSR2 #00 EQU ,&draw3 JCN
#02 .color STZ #02 .color STZ
;hand_icn .pointer/sprite STZ2 ;hand_icn .pointer/sprite STZ2
&draw3 &draw3
.r3/x1 LDZ2 .r3/y1 LDZ2 .r3/x2 LDZ2 .r3/y2 LDZ2 .color LDZ ;line-rect JSR2 .r3/x1 LDZ2 .r3/y1 LDZ2 .r3/x2 LDZ2 .r3/y2 LDZ2 .color LDZ ;line-rect JSR2
;draw-cursor JSR2 ;draw-cursor JSR2
@ -99,18 +103,25 @@ RTN
@line-rect ( x1* y1* x2* y2* color -- ) @line-rect ( x1* y1* x2* y2* color -- )
( load ) .color STZ .rect/y2 STZ2 .rect/x2 STZ2 DUP2 .Screen/y DEO2 .rect/y1 STZ2 DUP2 .Screen/x DEO2 .rect/x1 STZ2 ( load ) .color STZ
&hor STH2k .rect/y2 STZ2 .rect/x2 STZ2
( incr ) .Screen/x DEI2 #0001 ADD2 .Screen/x DEO2 STH2k .rect/y1 STZ2 .rect/x1 STZ2
( draw ) .rect/y1 LDZ2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO STH2r STH2r SWP2
( draw ) .rect/y2 LDZ2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO
.Screen/x DEI2 .rect/x2 LDZ2 LTH2 ,&hor JCN
.rect/y1 LDZ2 .Screen/y DEO2
&ver &ver
( draw ) .rect/x1 LDZ2 .Screen/x DEO2 .color LDZ .Screen/pixel DEO ( save ) DUP2 .Screen/y DEO2
( draw ) .rect/x2 LDZ2 .Screen/x DEO2 .color LDZ .Screen/pixel DEO ( draw ) .rect/x1 LDZ2 .Screen/x DEO2 .color LDZ DUP .Screen/pixel DEO
( incr ) .Screen/y DEI2 #0001 ADD2 .Screen/y DEO2 ( draw ) .rect/x2 LDZ2 .Screen/x DEO2 .Screen/pixel DEO
.Screen/y DEI2 .rect/y2 LDZ2 #0001 ADD2 LTH2 ,&ver JCN ( incr ) INC2
OVR2 OVR2 GTS2 ,&ver JCN
POP2 POP2
.rect/x1 LDZ2 .rect/x2 LDZ2 SWP2
&hor
( save ) DUP2 .Screen/x DEO2
( draw ) .rect/y1 LDZ2 .Screen/y DEO2 .color LDZ DUP .Screen/pixel DEO
( draw ) .rect/y2 LDZ2 .Screen/y DEO2 .Screen/pixel DEO
( incr ) INC2
OVR2 OVR2 GTS2 ,&hor JCN
POP2 POP2
RTN RTN

View File

@ -52,10 +52,10 @@ RTN
( load ) .label/addr STZ2 .label/color STZ .Screen/y DEO2 .Screen/x DEO2 ( load ) .label/addr STZ2 .label/color STZ .Screen/y DEO2 .Screen/x DEO2
.label/addr LDZ2 .label/addr LDZ2
&loop &loop
( draw ) DUP2 LDA #00 SWP 8** ;font ADD2 .Screen/addr DEO2 .label/color LDZ .Screen/sprite DEO ( draw ) LDAk #00 SWP 8** ;font ADD2 .Screen/addr DEO2 .label/color LDZ .Screen/sprite DEO
( incr ) #0001 ADD2 ( incr ) #0001 ADD2
( incr ) .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2 ( incr ) .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
DUP2 LDA ,&loop JCN LDAk ,&loop JCN
POP2 POP2
RTN RTN
@ -66,10 +66,10 @@ RTN
( align ) .label/addr LDZ2 ;get-text-length JSR2 8** 2// SUB2 .Screen/x DEO2 ( align ) .label/addr LDZ2 ;get-text-length JSR2 8** 2// SUB2 .Screen/x DEO2
.label/addr LDZ2 .label/addr LDZ2
&loop &loop
( draw ) DUP2 LDA #00 SWP 8** ;font ADD2 .Screen/addr DEO2 .label/color LDZ .Screen/sprite DEO ( draw ) LDAk #00 SWP 8** ;font ADD2 .Screen/addr DEO2 .label/color LDZ .Screen/sprite DEO
( incr ) #0001 ADD2 ( incr ) #0001 ADD2
( incr ) .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2 ( incr ) .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
DUP2 LDA ,&loop JCN LDAk ,&loop JCN
POP2 POP2
RTN RTN
@ -80,10 +80,10 @@ RTN
( align ) .label/addr LDZ2 ;get-text-length JSR2 8** SUB2 .Screen/x DEO2 ( align ) .label/addr LDZ2 ;get-text-length JSR2 8** SUB2 .Screen/x DEO2
.label/addr LDZ2 .label/addr LDZ2
&loop &loop
( draw ) DUP2 LDA #00 SWP 8** ;font ADD2 .Screen/addr DEO2 .label/color LDZ .Screen/sprite DEO ( draw ) LDAk #00 SWP 8** ;font ADD2 .Screen/addr DEO2 .label/color LDZ .Screen/sprite DEO
( incr ) #0001 ADD2 ( incr ) #0001 ADD2
( incr ) .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2 ( incr ) .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
DUP2 LDA ,&loop JCN LDAk ,&loop JCN
POP2 POP2
RTN RTN

View File

@ -21,7 +21,7 @@
|0100 |0100
( theme ) #037a .System/r DEO2 #032a .System/g DEO2 #052a .System/b DEO2 ( theme ) #f07a .System/r DEO2 #f02a .System/g DEO2 #f02a .System/b DEO2
( background ) ;checker_icn #02 ;cover-pattern JSR2 ( background ) ;checker_icn #02 ;cover-pattern JSR2
@ -37,6 +37,7 @@
( load ) ;chr2_path .File/name DEO2 #0900 .File/length DEO2 ;image .File/load DEO2 ( load ) ;chr2_path .File/name DEO2 #0900 .File/length DEO2 ;image .File/load DEO2
( draw ) #0088 #0088 #0060 #0060 #81 ;image ;draw-chr JSR2 ( draw ) #0088 #0088 #0060 #0060 #81 ;image ;draw-chr JSR2
BRK BRK
@draw-icn ( x y width height color addr -- ) @draw-icn ( x y width height color addr -- )
@ -79,9 +80,9 @@ RTN
RTN RTN
@cover-pattern ( addr color -- ) @cover-pattern ( addr* color -- )
( load ) .color STZ .Screen/addr DEO2 ( load ) .color/byte STZ .Screen/addr DEO2
#0000 .Screen/height DEI2 #0000 .Screen/height DEI2
&ver &ver
( save ) OVR2 .Screen/y DEO2 ( save ) OVR2 .Screen/y DEO2