JNZ is now JCN

This commit is contained in:
neauoire 2021-05-11 11:12:07 -07:00
parent d360fa43b2
commit 8630028e97
33 changed files with 609 additions and 732 deletions

View File

@ -43,7 +43,7 @@ BRK
&loop
( send ) DUP2 LDA .Console/char DEO
( incr ) #0001 ADD2
( loop ) DUP2 LDA #00 NEQ ,&loop JNZ
( loop ) DUP2 LDA #00 NEQ ,&loop JCN
POP2
RTN

View File

@ -34,7 +34,7 @@ else
fi
echo "Assembling.."
./bin/assembler projects/demos/polycat.usm bin/boot.rom
./bin/assembler projects/demos/piano.usm bin/boot.rom
echo "Running.."
if [ "${2}" = '--cli' ];

View File

@ -53,7 +53,7 @@ BRK
@on-frame ( -> )
( only draw once per second )
.DateTime/second DEI .last PEK NEQ #01 JNZ [ BRK ]
.DateTime/second DEI .last PEK NEQ #01 JCN [ BRK ]
.DateTime/second DEI .last POK
@ -65,7 +65,7 @@ BRK
;draw-cursor JSR2
.Mouse/state DEI #00 EQU ,&no-touch JNZ
.Mouse/state DEI #00 EQU ,&no-touch JCN
( incr ) .style PEK INC #03 MOD .style POK
( bg ) ;tiles .style PEK #10 MUL TOS ADD2 ;cover-pattern JSR2
( fg ) ;redraw JSR2
@ -117,7 +117,7 @@ RTN
.Screen/addr DEO2
( draw ) #21 .Screen/color DEO
( incr ) SWP INC SWP
DUP2 LTH ,&loop JNZ
DUP2 LTH ,&loop JCN
POP2
POPr
@ -134,10 +134,10 @@ RTN
( save ) OVR2 .Screen/x DEO2
( draw ) #21 .Screen/color DEO
( incr ) SWP2 8+ SWP2
OVR2 OVR2 LTH2 ,&hor JNZ
OVR2 OVR2 LTH2 ,&hor JCN
POP2 POP2
( incr ) SWP2 8+ SWP2
OVR2 OVR2 LTH2 ,&ver JNZ
OVR2 OVR2 LTH2 ,&ver JCN
POP2 POP2
RTN

View File

@ -93,7 +93,7 @@ BRK
@on_frame ( -> )
;f_count LDA #01 ADD DUP ;f_count STA ( increase frame counter )
;ani_speedmask LDA ( mask with animation speed mask )
AND #00 EQU ,update_frame JNZ ( jump to update if it's time )
AND #00 EQU ,update_frame JCN ( jump to update if it's time )
BRK
@update_frame
@ -133,7 +133,7 @@ BRK
#01 ADD
DUP2
NEQ ,&rocks_loop JNZ
NEQ ,&rocks_loop JCN
POP2
( clear character )
@ -169,7 +169,7 @@ JMP2r
#01 ADD
DUP2
NEQ ,&rocks_loop JNZ
NEQ ,&rocks_loop JCN
POP2
( draw character )
@ -180,10 +180,10 @@ JMP2r
#00 ;c_speed/x STA
#00 ;c_speed/y STA
.Controller/button DEI #07 is_bit_n_set ,&der JNZ
.Controller/button DEI #06 is_bit_n_set ,&izq JNZ
.Controller/button DEI #05 is_bit_n_set ,&aba JNZ
.Controller/button DEI #04 is_bit_n_set ,&arr JNZ
.Controller/button DEI #07 is_bit_n_set ,&der JCN
.Controller/button DEI #06 is_bit_n_set ,&izq JCN
.Controller/button DEI #05 is_bit_n_set ,&aba JCN
.Controller/button DEI #04 is_bit_n_set ,&arr JCN
rst_animate
@ -256,17 +256,17 @@ JMP2r
,&src_x LDR ,&rock_x LDR ,&range_x LDR ADD LTH ( if sx < rx + 8 )
,&src_y LDR ,&rock_y LDR ,&range_y LDR SUB GTH ( if sy > ry - 8 )
,&src_y LDR ,&rock_y LDR ,&range_y LDR ADD LTH ( if sy < ry + 8 )
ADD ADD ADD #04 EQU ,&found JNZ
ADD ADD ADD #04 EQU ,&found JCN
#01 ADD nrocks_mask AND
DUP2
NEQ ,&rocks_loop JNZ
NEQ ,&rocks_loop JCN
POP2
#ff
JMP2r
&found
SWP POP ( remove loop limit )
DUP ;&src_i LDA NEQ ,&end JNZ ( check if result is the same as index )
DUP ;&src_i LDA NEQ ,&end JCN ( check if result is the same as index )
POP #ff
JMP2r
@ -293,8 +293,8 @@ JMP2r
&check_x
( check collision with borders )
,&new_x LDR minposx EQU ;&noup_x JNZ2
,&new_x LDR maxposx EQU ;&noup_x JNZ2
,&new_x LDR minposx EQU ;&noup_x JCN2
,&new_x LDR maxposx EQU ;&noup_x JCN2
( check collision with rocks )
@ -302,7 +302,7 @@ JMP2r
;collision_rocks/run JSR2
( if it is colliding with rock, check further )
DUP #ff NEQ ,&check_x_collision JNZ
DUP #ff NEQ ,&check_x_collision JCN
POP
,&update_x JMP
@ -322,13 +322,13 @@ JMP2r
( DUP DEBUG )
( if it is colliding, then skip adding x )
DUP #ff NEQ ,&check_y JNZ
DUP #ff NEQ ,&check_y JCN
POP
( if not, check for borders )
;&rock_x LDA minposx EQU ;&noup_x JNZ2
;&rock_x LDA maxposx EQU ;&noup_x JNZ2
;&rock_x LDA minposx EQU ;&noup_x JCN2
;&rock_x LDA maxposx EQU ;&noup_x JCN2
( move rock with same speed as c )
;&rock_x LDA ;c_speed/x LDA ADD
@ -345,15 +345,15 @@ JMP2r
&check_y
( check collision with borders )
;&new_y LDA minposy EQU ;&noup_y JNZ2
;&new_y LDA maxposy EQU ;&noup_y JNZ2
;&new_y LDA minposy EQU ;&noup_y JCN2
;&new_y LDA maxposy EQU ;&noup_y JCN2
( check collision with rocks )
;&new_x LDA ;&new_y LDA index_norock #06 #09
;collision_rocks/run JSR2
( if it is colliding with rock, check further )
DUP #ff NEQ ,&check_y_collision JNZ
DUP #ff NEQ ,&check_y_collision JCN
POP
,&update_y JMP
@ -372,12 +372,12 @@ JMP2r
( DUP DEBUG )
( if it is colliding, then skip adding y )
DUP #ff NEQ ,&noup_y JNZ
DUP #ff NEQ ,&noup_y JCN
POP
( if not, check for borders )
;&rock_y LDA minposx EQU ;&noup_y JNZ2
;&rock_y LDA maxposx EQU ;&noup_y JNZ2
;&rock_y LDA minposx EQU ;&noup_y JCN2
;&rock_y LDA maxposx EQU ;&noup_y JCN2
( if not colliding, then move rock with same speed as c )
;&rock_y LDA ;c_speed/y LDA ADD
@ -402,7 +402,7 @@ JMP2r
;collision_rocks/run JSR2
( if it is colliding with rock, check if it needs to change state )
DUP #ff NEQ ,&change_state JNZ
DUP #ff NEQ ,&change_state JCN
( DUP DEBUG )
@ -414,7 +414,7 @@ JMP2r
&change_state
( DUP DEBUG )
,&rock_i STR
;tog/state LDA ,&done JNZ ( don't toggle if state is active )
;tog/state LDA ,&done JCN ( don't toggle if state is active )
;r_color #00 ,&rock_i LDR ADD2 DUP2 STH2
LDA #01 EOR STH2r STA
@ -425,7 +425,7 @@ JMP2r
@animate_c
( is bit0 -animate- on? )
;c_state LDA DUP #00 get_bit_n #01 NEQ ,&s_no_animate JNZ
;c_state LDA DUP #00 get_bit_n #01 NEQ ,&s_no_animate JCN
( increment and save animation pointer )
&s_animate
@ -474,13 +474,13 @@ JMP2r
#23 .Screen/color DEO
#0008 ADD2 DUP2 STH2
GTH2 ,&horizontal0loop JNZ
GTH2 ,&horizontal0loop JCN
STH2r POP2 POP2
#0008 ADD2 DUP2 STH2
GTH2 ,&vertical0loop JNZ
GTH2 ,&vertical0loop JCN
STH2r
POP2 POP2
@ -504,11 +504,11 @@ JMP2r
#20 .Screen/color DEO
#0008 ADD2 DUP2 STH2
GTH2 ,&horizontal0loop_clear JNZ
GTH2 ,&horizontal0loop_clear JCN
STH2r POP2 POP2
#0008 ADD2 DUP2 STH2 GTH2 ,&vertical0loop_clear JNZ
#0008 ADD2 DUP2 STH2 GTH2 ,&vertical0loop_clear JCN
STH2r
POP2 POP2

View File

@ -142,7 +142,7 @@
( draw mixer )
OVR #04 / ;draw-mixer JSR2
( incr ) SWP #01 + SWP
DUP2 < ,&draw-pads JNZ
DUP2 < ,&draw-pads JCN
POP2
;draw-octave JSR2
@ -160,7 +160,7 @@ BRK
( output ) .Audio0/output STHr #10 * + DEI
;draw-monitor JSR2
( incr ) SWP #01 + SWP
DUP2 < ,&loop JNZ
DUP2 < ,&loop JCN
POP2
BRK
@ -169,28 +169,28 @@ BRK
;draw-cursor JSR2
.Mouse/state DEI #00 ! #01 JNZ [ BRK ]
.Mouse/state DEI #00 ! #01 JCN [ BRK ]
.Mouse/x DEI2 DUP2 .pad-view/x1 PEK2 >> ROT ROT .pad-view/x2 PEK2 #0001 ++ << #0101 ==
.Mouse/y DEI2 DUP2 .pad-view/y1 PEK2 >> ROT ROT .pad-view/y2 PEK2 << #0101 ==
#0101 == ;on-touch-pad JNZ2
#0101 == ;on-touch-pad JCN2
.Mouse/x DEI2 DUP2 .mix-view/x1 PEK2 >> ROT ROT .mix-view/x2 PEK2 #0001 ++ << #0101 ==
.Mouse/y DEI2 DUP2 .mix-view/y1 PEK2 >> ROT ROT .mix-view/y2 PEK2 << #0101 ==
#0101 == ;on-touch-mix JNZ2
#0101 == ;on-touch-mix JCN2
.Mouse/x DEI2 DUP2 .oct-view/x1 PEK2 >> ROT ROT .oct-view/x2 PEK2 #0001 ++ << #0101 ==
.Mouse/y DEI2 DUP2 .oct-view/y1 PEK2 >> ROT ROT .oct-view/y2 PEK2 << #0101 ==
#0101 == ;on-touch-oct JNZ2
#0101 == ;on-touch-oct JCN2
BRK
@on-midi ( -> )
.Midi/note DEI #00 ! #01 JNZ [ BRK ]
.Midi/note DEI #00 ! #01 JCN [ BRK ]
( drums )
.Midi/channel DEI #90 ! ,&no-drum JNZ
.Midi/channel DEI #90 ! ,&no-drum JCN
.Midi/note DEI #10 MOD ;play-pad JSR2
BRK
&no-drum
@ -204,25 +204,25 @@ BRK
@on-control ( -> )
.Controller/key DEI #00 ! #01 JNZ [ BRK ]
.Controller/key DEI #00 ! #01 JCN [ BRK ]
.Controller/key DEI
DUP #31 ! ,&no-0 JNZ #00 ;play-pad JSR2 &no-0
DUP #32 ! ,&no-1 JNZ #01 ;play-pad JSR2 &no-1
DUP #33 ! ,&no-2 JNZ #02 ;play-pad JSR2 &no-2
DUP #34 ! ,&no-3 JNZ #03 ;play-pad JSR2 &no-3
DUP #71 ! ,&no-4 JNZ #04 ;play-pad JSR2 &no-4
DUP #77 ! ,&no-5 JNZ #05 ;play-pad JSR2 &no-5
DUP #65 ! ,&no-6 JNZ #06 ;play-pad JSR2 &no-6
DUP #72 ! ,&no-7 JNZ #07 ;play-pad JSR2 &no-7
DUP #61 ! ,&no-8 JNZ #08 ;play-pad JSR2 &no-8
DUP #73 ! ,&no-9 JNZ #09 ;play-pad JSR2 &no-9
DUP #64 ! ,&no-a JNZ #0a ;play-pad JSR2 &no-a
DUP #66 ! ,&no-b JNZ #0b ;play-pad JSR2 &no-b
DUP #7a ! ,&no-c JNZ #0c ;play-pad JSR2 &no-c
DUP #78 ! ,&no-d JNZ #0d ;play-pad JSR2 &no-d
DUP #63 ! ,&no-e JNZ #0e ;play-pad JSR2 &no-e
DUP #76 ! ,&no-f JNZ #0f ;play-pad JSR2 &no-f
DUP #31 ! ,&no-0 JCN #00 ;play-pad JSR2 &no-0
DUP #32 ! ,&no-1 JCN #01 ;play-pad JSR2 &no-1
DUP #33 ! ,&no-2 JCN #02 ;play-pad JSR2 &no-2
DUP #34 ! ,&no-3 JCN #03 ;play-pad JSR2 &no-3
DUP #71 ! ,&no-4 JCN #04 ;play-pad JSR2 &no-4
DUP #77 ! ,&no-5 JCN #05 ;play-pad JSR2 &no-5
DUP #65 ! ,&no-6 JCN #06 ;play-pad JSR2 &no-6
DUP #72 ! ,&no-7 JCN #07 ;play-pad JSR2 &no-7
DUP #61 ! ,&no-8 JCN #08 ;play-pad JSR2 &no-8
DUP #73 ! ,&no-9 JCN #09 ;play-pad JSR2 &no-9
DUP #64 ! ,&no-a JCN #0a ;play-pad JSR2 &no-a
DUP #66 ! ,&no-b JCN #0b ;play-pad JSR2 &no-b
DUP #7a ! ,&no-c JCN #0c ;play-pad JSR2 &no-c
DUP #78 ! ,&no-d JCN #0d ;play-pad JSR2 &no-d
DUP #63 ! ,&no-e JCN #0e ;play-pad JSR2 &no-e
DUP #76 ! ,&no-f JCN #0f ;play-pad JSR2 &no-f
POP
BRK
@ -245,33 +245,33 @@ BRK
( channel ) .Mouse/y DEI2 .mix-view/y1 PEK2 -- PAD-HEIGHT // TOB STH
( knob ) .Mouse/x DEI2 .mix-view/x1 PEK2 -- #0010 // TOB
( adsr )
DUP #00 ! ,&no-a JNZ
DUP #00 ! ,&no-a JCN
.Audio0/adsr [ DUPr STHr #10 * + ] DEI
#10 .Mouse/state DEI #10 = #e0 * + +
.Audio0/adsr [ DUPr STHr #10 * + ] DEO &no-a
DUP #01 ! ,&no-d JNZ
DUP #01 ! ,&no-d JCN
.Audio0/adsr [ DUPr STHr #10 * + ] DEI
DUP #f0 AND STH #01 .Mouse/state DEI #10 = #0e * + + #0f AND STHr +
.Audio0/adsr [ DUPr STHr #10 * + ] DEO &no-d
DUP #02 ! ,&no-s JNZ
DUP #02 ! ,&no-s JCN
.Audio0/adsr [ DUPr STHr #10 * + ] #01 + DEI
#10 .Mouse/state DEI #10 = #e0 * + +
.Audio0/adsr [ DUPr STHr #10 * + ] #01 + DEO &no-s
DUP #03 ! ,&no-r JNZ
DUP #03 ! ,&no-r JCN
.Audio0/adsr [ DUPr STHr #10 * + ] #01 + DEI
DUP #f0 AND STH #01 .Mouse/state DEI #10 = #0e * + + #0f AND STHr +
.Audio0/adsr [ DUPr STHr #10 * + ] #01 + DEO &no-r
( modes )
DUP #04 ! ,&no-repeat JNZ
DUP #04 ! ,&no-repeat JCN
.modes [ DUPr STHr + ] PEK
#00 =
.modes [ DUPr STHr + ] POK &no-repeat
( volume )
DUP #05 ! ,&no-left JNZ
DUP #05 ! ,&no-left JCN
.Audio0/volume [ DUPr STHr #10 * + ] DEI
#10 .Mouse/state DEI #10 = #e0 * + +
.Audio0/volume [ DUPr STHr #10 * + ] DEO &no-left
DUP #06 ! ,&no-right JNZ
DUP #06 ! ,&no-right JCN
.Audio0/volume [ DUPr STHr #10 * + ] DEI
DUP #f0 AND STH #01 .Mouse/state DEI #10 = #0e * + + #0f AND STHr +
.Audio0/volume [ DUPr STHr #10 * + ] DEO &no-right
@ -287,11 +287,11 @@ BRK
@on-touch-oct ( -> )
.Mouse/x DEI2 .oct-view/x1 PEK2 -- #0008 // TOB #08 ! ,&no-mod JNZ
.Mouse/x DEI2 .oct-view/x1 PEK2 -- #0008 // TOB #08 ! ,&no-mod JCN
.Mouse/y DEI2 .oct-view/y1 PEK2 -- #0008 // TOB
DUP #00 ! ,&no-incr JNZ
DUP #00 ! ,&no-incr JCN
.piano/octave PEK #01 + .piano/octave POK &no-incr
DUP #02 ! ,&no-decr JNZ
DUP #02 ! ,&no-decr JCN
.piano/octave PEK #01 - .piano/octave POK &no-decr
POP
( release ) #00 .Mouse/state DEO
@ -299,7 +299,7 @@ BRK
BRK
&no-mod
.Mouse/x DEI2 .oct-view/x1 PEK2 -- #0008 // TOB #06 GTH ,&no-key JNZ
.Mouse/x DEI2 .oct-view/x1 PEK2 -- #0008 // TOB #06 GTH ,&no-key JCN
.Mouse/x DEI2 .oct-view/x1 PEK2 -- #0008 //
( set pitch of pad )
DUP2 ;notes ++ LDA .pads/last PEK SWP .piano/octave PEK #02 - #0c * +
@ -349,7 +349,7 @@ RTN
#00 #e8
&loop
( dotted line )
OVR #01 AND ,&no-dot JNZ
OVR #01 AND ,&no-dot JCN
.wav-view/y1 PEK2 #0010 ++ .Screen/y DEO2
#01 .Screen/color DEO
&no-dot
@ -359,7 +359,7 @@ RTN
.Screen/x DEI2 #0001 ++ .Screen/x DEO2
( draw ) #02 .Screen/color DEO
( incr ) SWP #01 + SWP
DUP2 < ,&loop JNZ
DUP2 < ,&loop JCN
POP2
POP2r
@ -476,7 +476,7 @@ RTN
.Screen/x DEI2 #0002 -- .Screen/x DEO2
.Screen/y DEI2 #0002 ++ .Screen/y DEO2
( incr ) SWP #01 + SWP
DUP2 < ,&loop JNZ
DUP2 < ,&loop JCN
POP2
POPr
@ -494,7 +494,7 @@ RTN
( draw ) DUPr STHr .Screen/color DEO
( incr ) .Screen/addr DEI2 #0008 ++ .Screen/addr DEO2
( incr ) SWP2 #0008 ++ SWP2
OVR2 OVR2 << ,&loop JNZ
OVR2 OVR2 << ,&loop JCN
POP2 POP2
POPr
@ -571,7 +571,7 @@ RTN
( draw ) .rect/x1 PEK2 .Screen/x DEO2 .color PEK DUP .Screen/color DEO
( draw ) .rect/x2 PEK2 .Screen/x DEO2 .Screen/color DEO
( incr ) SWP2 #0001 ++ SWP2
OVR2 OVR2 LTS2 ,&ver JNZ
OVR2 OVR2 LTS2 ,&ver JCN
POP2 POP2
.rect/x1 PEK2 #0001 ++ .rect/x2 PEK2 #0001 --
&hor
@ -579,7 +579,7 @@ RTN
( draw ) .rect/y1 PEK2 .Screen/y DEO2 .color PEK DUP .Screen/color DEO
( draw ) .rect/y2 PEK2 .Screen/y DEO2 .Screen/color DEO
( incr ) SWP2 #0001 ++ SWP2
OVR2 OVR2 #0001 ++ LTS2 ,&hor JNZ
OVR2 OVR2 #0001 ++ LTS2 ,&hor JCN
POP2 POP2
RTN
@ -593,7 +593,7 @@ RTN
( draw ) DUPr STHr .Screen/color DEO
( incr ) #0001 ++
( incr ) .Screen/x DEI2 #0008 ++ .Screen/x DEO2
DUP2 LDA #00 ! ,&loop JNZ
DUP2 LDA #00 ! ,&loop JCN
POP2
POPr
@ -610,10 +610,10 @@ RTN
( save ) OVR2 .Screen/x DEO2
( draw ) .color PEK .Screen/color DEO
( incr ) SWP2 #0001 ++ SWP2
OVR2 OVR2 LTS2 ,&hor JNZ
OVR2 OVR2 LTS2 ,&hor JCN
POP2 POP2 STH2r STH2r
( incr ) SWP2 #0001 ++ SWP2
OVR2 OVR2 LTS2 ,&ver JNZ
OVR2 OVR2 LTS2 ,&ver JCN
POP2 POP2 POP2 POP2
RTN

View File

@ -64,20 +64,20 @@ BRK
@on-frame ( -> )
.Mouse/state DEI #00 = #01 JNZ [ BRK ]
.world/paused PEK #00 ! #01 JNZ [ BRK ]
.Mouse/state DEI #00 = #01 JCN [ BRK ]
.world/paused PEK #00 ! #01 JCN [ BRK ]
( incr frame ) .world/frame PEK INCR [ DUP ] .world/frame POK
( reset count ) #0000 .world/count POK2
#10 MOD #00 ! #01 JNZ [ BRK ]
#10 MOD #00 ! #01 JCN [ BRK ]
( clear buffer )
BANK2 DUP2 GET-SIZE ++
&clear-loop
OVR2 #0000 SWP2 STA2
SWP2 #0002 ++ SWP2
OVR2 OVR2 !! ,&clear-loop JNZ
OVR2 OVR2 !! ,&clear-loop JCN
POP2 POP2
;run-grid JSR2
@ -88,7 +88,7 @@ BRK
OVR2 DUP2 LDA2
SWP2 #2000 -- STA2
SWP2 #0002 ++ SWP2
OVR2 OVR2 !! ,&copy-loop JNZ
OVR2 OVR2 !! ,&copy-loop JCN
POP2 POP2
;draw-grid JSR2
@ -119,11 +119,11 @@ BRK
( colorize on state )
#32 [ .Mouse/state DEI #00 ! ] + .Screen/color DEO
.Mouse/state DEI #00 ! #01 JNZ [ BRK ]
.Mouse/state DEI #00 ! #01 JCN [ BRK ]
.Mouse/x DEI2 DUP2 .anchor/x PEK2 >> ROT ROT .anchor/x PEK2 WIDTH #02 * TOS ++ #0001 ++ << #0101 ==
.Mouse/y DEI2 DUP2 .anchor/y PEK2 >> ROT ROT .anchor/y PEK2 HEIGHT #02 * TOS ++ << #0101 ==
#0101 == #01 JNZ [ BRK ]
#0101 == #01 JCN [ BRK ]
.Mouse/x DEI2 .anchor/x PEK2 SUB2 #02 / TOB
.Mouse/y DEI2 .anchor/y PEK2 SUB2 #02 / TOB
@ -135,9 +135,9 @@ BRK
@on-control ( -> )
.Controller/key DEI #00 ! #01 JNZ [ BRK ]
.Controller/key DEI #00 ! #01 JCN [ BRK ]
.Controller/key DEI #20 ! ,&no-toggle JNZ
.Controller/key DEI #20 ! ,&no-toggle JCN
.world/paused PEK #01 ! .world/paused POK
&no-toggle
@ -154,10 +154,10 @@ BRK
OVR TOS #0002 ** .anchor/x PEK2 ++ .Screen/x DEO2
OVR DUPr STHr ,get-cell JSR INCR .Screen/color DEO
SWP INCR SWP
DUP2 ! ,&hor JNZ
DUP2 ! ,&hor JCN
POP2 POPr
SWP INCR SWP
DUP2 ! ,&ver JNZ
DUP2 ! ,&ver JCN
POP2
RTN
@ -214,24 +214,24 @@ RTN
( state ) STH2r ;get-cell JSR2
,run-cell JSR
SWP INCR SWP
DUP2 ! ,&hor JNZ
DUP2 ! ,&hor JCN
POP2 POPr
SWP INCR SWP
DUP2 ! ,&ver JNZ
DUP2 ! ,&ver JCN
POP2
RTN
@run-cell ( x y neighbours state -- )
#00 = ,&dead JNZ
#00 = ,&dead JCN
&alive
DUP #02 < ,&dies JNZ
DUP #03 > ,&dies JNZ
DUP #02 < ,&dies JCN
DUP #03 > ,&dies JCN
&lives POP ,save-cell JSR RTN
&dies POP POP2 RTN
&dead
DUP #03 = ,&birth JNZ POP POP2 RTN
DUP #03 = ,&birth JCN POP POP2 RTN
&birth POP ,save-cell JSR RTN
RTN

View File

@ -1,123 +0,0 @@
( a blank file )
%+ { ADD } %- { SUB } %* { MUL } %/ { DIV }
%< { LTH } %> { GTH } %= { EQU } %! { NEQ }
%++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 }
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
( fixed-point )
%RESF { #0008 }
%TO2F { RESF #0040 SFT2 SFT2 }
%MUL2F { MUL2 RESF SFT2 }
%DIV2F { SWP2 TO2F SWP2 DIV2 }
%RTN { JMP2r }
%TOB { SWP POP }
%MOD2 { OVR2 OVR2 DIV2 MUL2 SUB2 }
%MOD { DUP2 / * - }
%SFL2 { #0040 SFT2 SFT2 }
%DEBUG { .Console/byte DEO #0a .Console/char DEO }
%DEBUG2 { .Console/short DEO2 #0a .Console/char DEO }
%WIDTH { #0080 }
%HEIGHT { #0080 }
( devices )
|00 @System [ &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 ]
|10 @Console [ &pad $8 &char $1 &byte $1 &short $2 &string $2 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &color $1 ]
|30 @Audio0 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ]
|40 @Audio1 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ]
|50 @Audio2 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ]
|60 @Audio3 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ]
|70 @Midi [ &vector $2 &channel $1 &note $1 &velocity $1 ]
|80 @Controller [ &vector $2 &button $1 &key $1 ]
|90 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &chord $1 ]
|a0 @File [ &vector $2 &success $2 &offset $2 &pad $2 &name $2 &length $2 &load $2 &save $2 ]
|b0 @DateTime [ &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 ]
( variables )
|0000
@zoom $1
@iter $1
@fractal [ &c_re $2 &c_im $2 &x $2 &y $2 ]
( program )
|0100 ( -> )
( theme )
#f840 .System/r DEO2
#f840 .System/g DEO2
#f840 .System/b DEO2
#20 .iter POK
#04 .zoom POK
#0000 #0080
&ver
( col ) OVR2 .Screen/y DEO2
#0000 #0080
&hor
( row ) OVR2 .Screen/x DEO2
,mandelbrot JSR
( incr ) SWP2 #0001 ++ SWP2
OVR2 OVR2 LTH2 ,&hor JNZ
POP2 POP2
( incr ) SWP2 #0001 ++ SWP2
OVR2 OVR2 LTH2 ,&ver JNZ
POP2 POP2
BRK
@mandelbrot ( -- )
(
.Screen/x DEI2
.Screen/y DEI2 )
(
double c_re = [col - width/2.0]*4.0/width;
double c_im = [row - height/2.0]*4.0/width;
double x = 0, y = 0;
int iteration = 0;
while [x*x+y*y <= 4 && iteration < max] {
double x_new = x*x - y*y + c_re;
y = 2*x*y + c_im;
x = x_new;
iteration++;
}
if [iteration < max] putpixel[col, row, white];
else putpixel[col, row, black];
)
( c_re = [col - width / 2.0] * 4.0 / width )
(
.Screen/x DEI2 TO2F
WIDTH TO2F
#0002 TO2F
DIV2F
SUB2
#0002 TO2F
WIDTH TO2F
DIV2F
MUL2F
.fractal/c_re POK2
)
#01 .Screen/color DEO
RTN

View File

@ -79,7 +79,7 @@ BRK
;move-head JSR2
;draw-vu JSR2
.head/pos PEK #08 MOD #00 NEQ ,&skip JNZ
.head/pos PEK #08 MOD #00 NEQ ,&skip JCN
;bang JSR2
&skip
@ -87,16 +87,16 @@ BRK
@on-mouse ( -> )
.Mouse/state DEI #00 EQU ;&click-end JNZ2
.Mouse/state DEI #00 EQU ;&click-end JCN2
.Mouse/x DEI2 .trkframe/x1 PEK2 GTH2 .Mouse/x DEI2 .trkframe/x2 PEK2 LTH2 #0101 EQU2
.Mouse/y DEI2 .trkframe/y1 PEK2 GTH2 .Mouse/y DEI2 .trkframe/y2 PEK2 LTH2 #0101 EQU2
#0101 EQU2 ;touch-trk JNZ2
#0101 EQU2 ;touch-trk JCN2
.Mouse/x DEI2 .chnframe/x1 PEK2 GTH2 .Mouse/x DEI2 .chnframe/x2 PEK2 LTH2 #0101 EQU2
.Mouse/y DEI2 .chnframe/y1 PEK2 8+ GTH2 .Mouse/y DEI2 .chnframe/y2 PEK2 8- LTH2 #0101 EQU2
#0101 EQU2 ;touch-chn JNZ2
#0101 EQU2 ;touch-chn JCN2
.Mouse/x DEI2 .ctlframe/x1 PEK2 GTH2 .Mouse/x DEI2 .ctlframe/x2 PEK2 LTH2 #0101 EQU2
.Mouse/y DEI2 .ctlframe/y1 PEK2 8+ GTH2 .Mouse/y DEI2 .ctlframe/y2 PEK2 8- LTH2 #0101 EQU2
#0101 EQU2 ;touch-ctl JNZ2
#0101 EQU2 ;touch-ctl JCN2
&click-end
;draw-cursor JSR2
@ -106,21 +106,21 @@ BRK
@on-button ( -> )
.Controller/key DEI
DUP #61 NEQ ,&no-c JNZ
DUP #61 NEQ ,&no-c JCN
;notes LDA ;play JSR2 &no-c
DUP #73 NEQ ,&no-d JNZ
DUP #73 NEQ ,&no-d JCN
;notes #0001 ADD2 LDA ;play JSR2 &no-d
DUP #64 NEQ ,&no-e JNZ
DUP #64 NEQ ,&no-e JCN
;notes #0002 ADD2 LDA ;play JSR2 &no-e
DUP #66 NEQ ,&no-f JNZ
DUP #66 NEQ ,&no-f JCN
;notes #0003 ADD2 LDA ;play JSR2 &no-f
DUP #67 NEQ ,&no-g JNZ
DUP #67 NEQ ,&no-g JCN
;notes #0004 ADD2 LDA ;play JSR2 &no-g
DUP #68 NEQ ,&no-a JNZ
DUP #68 NEQ ,&no-a JCN
;notes #0005 ADD2 LDA ;play JSR2 &no-a
DUP #6a NEQ ,&no-b JNZ
DUP #6a NEQ ,&no-b JCN
;notes #0006 ADD2 LDA ;play JSR2 &no-b
DUP #6b NEQ ,&no-c2 JNZ
DUP #6b NEQ ,&no-c2 JCN
;notes #0007 ADD2 LDA ;play JSR2 &no-c2
POP
@ -137,7 +137,7 @@ RTN
;clear-notes JSR2
( get note )
#0e .Mouse/y DEI2 .trkframe/y1 PEK2 SUB2 SWP POP #08 DIV SUB
.Mouse/state DEI #10 NEQ ,&no-erase JNZ POP #00 &no-erase
.Mouse/state DEI #10 NEQ ,&no-erase JCN POP #00 &no-erase
( edit note )
TRACK #00 .Mouse/x DEI2 .trkframe/x1 PEK2 SUB2 SWP POP #08 DIV ADD2 STA
( release ) #00 .Mouse/state DEO
@ -159,27 +159,27 @@ BRK
@touch-ctl ( -- )
.Mouse/x DEI2 .ctlframe/x1 PEK2 SUB2 8- 8/ SWP POP #02 DIV
DUP #00 NEQ ,&no-a JNZ
DUP #00 NEQ ,&no-a JCN
.Audio0/adsr .track/active PEK #10 MUL ADD DEI
#10 .Mouse/state DEI #10 EQU #e0 MUL ADD ADD
.Audio0/adsr .track/active PEK #10 MUL ADD DEO &no-a
DUP #01 NEQ ,&no-d JNZ
DUP #01 NEQ ,&no-d JCN
.Audio0/adsr .track/active PEK #10 MUL ADD DEI
DUP #f0 AND STH #01 .Mouse/state DEI #10 EQU #0e MUL ADD ADD #0f AND STHr ADD
.Audio0/adsr .track/active PEK #10 MUL ADD DEO &no-d
DUP #02 NEQ ,&no-s JNZ
DUP #02 NEQ ,&no-s JCN
.Audio0/adsr .track/active PEK #10 MUL ADD #01 ADD DEI
#10 .Mouse/state DEI #10 EQU #e0 MUL ADD ADD
.Audio0/adsr .track/active PEK #10 MUL ADD #01 ADD DEO &no-s
DUP #03 NEQ ,&no-r JNZ
DUP #03 NEQ ,&no-r JCN
.Audio0/adsr .track/active PEK #10 MUL ADD #01 ADD DEI
DUP #f0 AND STH #01 .Mouse/state DEI #10 EQU #0e MUL ADD ADD #0f AND STHr ADD
.Audio0/adsr .track/active PEK #10 MUL ADD #01 ADD DEO &no-r
DUP #05 NEQ ,&no-left JNZ
DUP #05 NEQ ,&no-left JCN
.Audio0/volume .track/active PEK #10 MUL ADD DEI
#10 .Mouse/state DEI #10 EQU #e0 MUL ADD ADD
.Audio0/volume .track/active PEK #10 MUL ADD DEO &no-left
DUP #06 NEQ ,&no-right JNZ
DUP #06 NEQ ,&no-right JCN
.Audio0/volume .track/active PEK #10 MUL ADD DEI
DUP #f0 AND STH #01 .Mouse/state DEI #10 EQU #0e MUL ADD ADD #0f AND STHr ADD
.Audio0/volume .track/active PEK #10 MUL ADD DEO &no-right
@ -193,28 +193,28 @@ BRK
;track/ch1 #00 .head/pos PEK #08 DIV ADD2 LDA
#01 SUB
DUP #ff NEQ ,&skip1 JNZ
DUP #ff NEQ ,&skip1 JCN
POP ,&listen2 JMP
&skip1
#00 SWP ;notes ADD2 LDA .Audio0/pitch DEO
&listen2
;track/ch2 #00 .head/pos PEK #08 DIV ADD2 LDA
#01 SUB
DUP #ff NEQ ,&skip2 JNZ
DUP #ff NEQ ,&skip2 JCN
POP ,&listen3 JMP
&skip2
#00 SWP ;notes ADD2 LDA .Audio1/pitch DEO
&listen3
;track/ch3 #00 .head/pos PEK #08 DIV ADD2 LDA
#01 SUB
DUP #ff NEQ ,&skip3 JNZ
DUP #ff NEQ ,&skip3 JCN
POP ,&listen4 JMP
&skip3
#00 SWP ;notes ADD2 LDA .Audio2/pitch DEO
&listen4
;track/ch4 #00 .head/pos PEK #08 DIV ADD2 LDA
#01 SUB
DUP #ff NEQ ,&skip4 JNZ
DUP #ff NEQ ,&skip4 JCN
POP ,&end JMP
&skip4
#00 SWP ;notes ADD2 LDA #80 ORA .Audio3/pitch DEO
@ -243,11 +243,11 @@ RTN
( load ) OVR #00 SWP TRACK ADD2 LDA
DUP STH #00 SWP #0e SWP SUB 8* .trkframe/y1 PEK2 ADD2 .Screen/y DEO2
OVR #00 SWP 8* .trkframe/x1 PEK2 ADD2 .Screen/x DEO2
STHr #00 EQU ,&skip JNZ
STHr #00 EQU ,&skip JCN
#20 .Screen/color DEO
&skip
( incr ) SWP #01 ADD SWP
DUP2 LTH ,&loop JNZ
DUP2 LTH ,&loop JCN
POP2
RTN
@ -260,11 +260,11 @@ RTN
DUP STH #00 SWP #0e SWP SUB 8* .trkframe/y1 PEK2 ADD2 .Screen/y DEO2
OVR #00 SWP 8* .trkframe/x1 PEK2 ADD2 .Screen/x DEO2
;note_icn .Screen/addr DEO2
STHr #00 EQU ,&skip JNZ
STHr #00 EQU ,&skip JCN
#25 .Screen/color DEO
&skip
( incr ) SWP #01 ADD SWP
DUP2 LTH ,&notes-loop JNZ
DUP2 LTH ,&notes-loop JCN
POP2
;draw-bars JSR2
@ -279,7 +279,7 @@ RTN
;font_hex .Screen/addr DEO2
#0000 #0100
&loop
OVR2 SWP POP #02 DIV #0f AND #00 NEQ ,&skip JNZ
OVR2 SWP POP #02 DIV #0f AND #00 NEQ ,&skip JCN
OVR2 .trkframe/x1 PEK2 ADD2 .Screen/x DEO2
.trkframe/y1 PEK2 #0010 SUB2 .Screen/y DEO2
#22 .Screen/color DEO
@ -288,7 +288,7 @@ RTN
&skip
OVR2 .trkframe/x1 PEK2 ADD2 .trkframe/y1 PEK2 .trkframe/y2 PEK2 #01 ;line-vertical-dotted JSR2
SWP2 8+ SWP2
OVR2 OVR2 LTH2 ,&loop JNZ
OVR2 OVR2 LTH2 ,&loop JCN
POP2
POP2
@ -311,7 +311,7 @@ RTN
.Screen/addr DEI2 8+ .Screen/addr DEO2
.Screen/x DEI2 8- .Screen/x DEO2
SWP2 8+ SWP2
OVR2 OVR2 LTH2 ,&loop JNZ
OVR2 OVR2 LTH2 ,&loop JCN
POP2
POP2
@ -346,7 +346,7 @@ RTN
RTN
@draw-knob ( x* y* value -- )
.track/active PEK #03 EQU ;&blank JNZ2
.track/active PEK #03 EQU ;&blank JCN2
&force
( load ) .knob/value POK .knob/y POK2 .knob/x POK2
@ -456,7 +456,7 @@ RTN
( draw ) DUP2 LDA #00 SWP 8* ;font ADD2 .Screen/addr DEO2 .label/color PEK .Screen/color DEO
( incr ) ++
( incr ) .Screen/x DEI2 8+ .Screen/x DEO2
DUP2 LDA #00 NEQ ,&loop JNZ
DUP2 LDA #00 NEQ ,&loop JCN
POP2
RTN
@ -467,7 +467,7 @@ RTN
&draw-ver
( draw ) .color PEK .Screen/color DEO
( incr ) SWP2 #0002 ADD2 DUP2 .Screen/y DEO2 SWP2
OVR2 OVR2 LTH2 ,&draw-ver JNZ
OVR2 OVR2 LTH2 ,&draw-ver JCN
POP2 POP2
RTN
@ -478,7 +478,7 @@ RTN
&draw-hor
( draw ) .color PEK .Screen/color DEO
( incr ) SWP2 #0002 ADD2 DUP2 .Screen/x DEO2 SWP2
OVR2 OVR2 LTH2 ,&draw-hor JNZ
OVR2 OVR2 LTH2 ,&draw-hor JCN
POP2 POP2
RTN
@ -490,13 +490,13 @@ RTN
( incr ) .Screen/x DEI2 ++ .Screen/x DEO2
( draw ) .rect/y1 PEK2 .Screen/y DEO2 .color PEK .Screen/color DEO
( draw ) .rect/y2 PEK2 .Screen/y DEO2 .color PEK .Screen/color DEO
.Screen/x DEI2 .rect/x2 PEK2 LTH2 ,&hor JNZ
.Screen/x DEI2 .rect/x2 PEK2 LTH2 ,&hor JCN
.rect/y1 PEK2 .Screen/y DEO2
&ver
( draw ) .rect/x1 PEK2 .Screen/x DEO2 .color PEK .Screen/color DEO
( draw ) .rect/x2 PEK2 .Screen/x DEO2 .color PEK .Screen/color DEO
( incr ) .Screen/y DEI2 ++ .Screen/y DEO2
.Screen/y DEI2 .rect/y2 PEK2 ++ LTH2 ,&ver JNZ
.Screen/y DEI2 .rect/y2 PEK2 ++ LTH2 ,&ver JCN
RTN

View File

@ -108,14 +108,14 @@ BRK
OVR #10 SWP - .Audio0/output DEI #04 SFT < .Screen/color DEO
.Screen/y DEI2 #0002 ++ .Screen/y DEO2
( incr ) SWP #01 + SWP
DUP2 < ,&loop JNZ
DUP2 < ,&loop JCN
POP2
BRK
@on-midi ( -> )
.Midi/note DEI #00 ! #01 JNZ [ BRK ]
.Midi/note DEI #00 ! #01 JCN [ BRK ]
.Midi/note DEI .Audio0/pitch .Midi/channel DEI #04 MOD #10 * + DEO
BRK
@ -123,19 +123,19 @@ BRK
@on-mouse ( -> )
;draw-cursor JSR2
.Mouse/state DEI #00 ! #01 JNZ [ BRK ]
.Mouse/state DEI #00 ! #01 JCN [ BRK ]
( wave-view )
.Mouse/x DEI2 DUP2 .wave-view/x1 PEK2 >> ROT ROT .wave-view/x2 PEK2 #0001 ++ << #0101 ==
.Mouse/y DEI2 DUP2 .wave-view/y1 PEK2 >> ROT ROT .wave-view/y2 PEK2 << #0101 ==
#0101 == ;on-touch-wave-view JNZ2
#0101 == ;on-touch-wave-view JCN2
( adsr-view )
.Mouse/x DEI2 DUP2 .adsr-view/x1 PEK2 >> ROT ROT .adsr-view/x2 PEK2 << #0101 ==
.Mouse/y DEI2 DUP2 .adsr-view/y1 PEK2 >> ROT ROT .adsr-view/y2 PEK2 << #0101 ==
#0101 == ;on-touch-adsr-view JNZ2
#0101 == ;on-touch-adsr-view JCN2
( octave-view )
.Mouse/x DEI2 DUP2 .octave-view/x1 PEK2 >> ROT ROT .octave-view/x2 PEK2 << #0101 ==
.Mouse/y DEI2 DUP2 .octave-view/y1 PEK2 >> ROT ROT .octave-view/y2 PEK2 << #0101 ==
#0101 == ;on-touch-octave-view JNZ2
#0101 == ;on-touch-octave-view JCN2
BRK
@ -149,11 +149,11 @@ BRK
@on-touch-octave-view ( -> )
.Mouse/x DEI2 .octave-view/x1 PEK2 -- #0008 // SWP POP #09 ! ,&no-mod JNZ
.Mouse/x DEI2 .octave-view/x1 PEK2 -- #0008 // SWP POP #09 ! ,&no-mod JCN
.Mouse/y DEI2 .octave-view/y1 PEK2 -- #0008 // SWP POP
DUP #00 ! ,&no-incr JNZ
DUP #00 ! ,&no-incr JCN
.octave PEK #01 + .octave POK &no-incr
DUP #02 ! ,&no-decr JNZ
DUP #02 ! ,&no-decr JCN
.octave PEK #01 - .octave POK &no-decr
POP
( release ) #00 .Mouse/state DEO
@ -161,7 +161,7 @@ BRK
BRK
&no-mod
.Mouse/x DEI2 .octave-view/x1 PEK2 -- #0008 // SWP POP #06 > ,&no-key JNZ
.Mouse/x DEI2 .octave-view/x1 PEK2 -- #0008 // SWP POP #06 > ,&no-key JCN
.Mouse/x DEI2 .octave-view/x1 PEK2 -- #0008 // DUP2 SWP POP .last-note POK ;notes ++ LDA ;play JSR2
( release ) #00 .Mouse/state DEO
;draw-octave JSR2
@ -172,27 +172,27 @@ BRK
@on-touch-adsr-view ( -> )
.Mouse/x DEI2 .adsr-view/x1 PEK2 -- #0008 // SWP POP #03 /
DUP #00 ! ,&no-a JNZ
DUP #00 ! ,&no-a JCN
.Audio0/adsr DEI
#10 .Mouse/state DEI #10 = #e0 * + +
.Audio0/adsr DEO &no-a
DUP #01 ! ,&no-d JNZ
DUP #01 ! ,&no-d JCN
.Audio0/adsr DEI
DUP #f0 AND STH #01 .Mouse/state DEI #10 = #0e * + + #0f AND STHr +
.Audio0/adsr DEO &no-d
DUP #02 ! ,&no-s JNZ
DUP #02 ! ,&no-s JCN
.Audio0/adsr #01 + DEI
#10 .Mouse/state DEI #10 = #e0 * + +
.Audio0/adsr #01 + DEO &no-s
DUP #03 ! ,&no-r JNZ
DUP #03 ! ,&no-r JCN
.Audio0/adsr #01 + DEI
DUP #f0 AND STH #01 .Mouse/state DEI #10 = #0e * + + #0f AND STHr +
.Audio0/adsr #01 + DEO &no-r
DUP #05 ! ,&no-left JNZ
DUP #05 ! ,&no-left JCN
.Audio0/volume DEI
#10 .Mouse/state DEI #10 = #e0 * + +
.Audio0/volume DEO &no-left
DUP #06 ! ,&no-right JNZ
DUP #06 ! ,&no-right JCN
.Audio0/volume DEI
DUP #f0 AND STH #01 .Mouse/state DEI #10 = #0e * + + #0f AND STHr +
.Audio0/volume DEO &no-right
@ -213,32 +213,32 @@ BRK
#30 .Screen/color DEO
.Controller/key DEI
DUP #61 ! ,&no-c JNZ
DUP #61 ! ,&no-c JCN
#00 .last-note POK ;notes LDA ;play JSR2 &no-c
DUP #73 ! ,&no-d JNZ
DUP #73 ! ,&no-d JCN
#01 .last-note POK ;notes #0001 ++ LDA ;play JSR2 &no-d
DUP #64 ! ,&no-e JNZ
DUP #64 ! ,&no-e JCN
#02 .last-note POK ;notes #0002 ++ LDA ;play JSR2 &no-e
DUP #66 ! ,&no-f JNZ
DUP #66 ! ,&no-f JCN
#03 .last-note POK ;notes #0003 ++ LDA ;play JSR2 &no-f
DUP #67 ! ,&no-g JNZ
DUP #67 ! ,&no-g JCN
#04 .last-note POK ;notes #0004 ++ LDA ;play JSR2 &no-g
DUP #68 ! ,&no-a JNZ
DUP #68 ! ,&no-a JCN
#05 .last-note POK ;notes #0005 ++ LDA ;play JSR2 &no-a
DUP #6a ! ,&no-b JNZ
DUP #6a ! ,&no-b JCN
#06 .last-note POK ;notes #0006 ++ LDA ;play JSR2 &no-b
DUP #6b ! ,&no-c2 JNZ
DUP #6b ! ,&no-c2 JCN
#07 .last-note POK ;notes #0007 ++ LDA ;play JSR2 &no-c2
POP
.Controller/button DEI #f0 AND
DUP #04 SFT #01 AND #01 ! ,&no-up JNZ
DUP #04 SFT #01 AND #01 ! ,&no-up JCN
( move ) .Audio0/addr DEI2 #0001 -- .Audio0/addr DEO2 &no-up
DUP #05 SFT #01 AND #01 ! ,&no-down JNZ
DUP #05 SFT #01 AND #01 ! ,&no-down JCN
( move ) .Audio0/addr DEI2 #0001 ++ .Audio0/addr DEO2 &no-down
DUP #06 SFT #01 AND #01 ! ,&no-left JNZ
DUP #06 SFT #01 AND #01 ! ,&no-left JCN
( move ) .Audio0/addr DEI2 #0010 -- .Audio0/addr DEO2 &no-left
DUP #07 SFT #01 AND #01 ! ,&no-right JNZ
DUP #07 SFT #01 AND #01 ! ,&no-right JCN
( move ) .Audio0/addr DEI2 #0010 ++ .Audio0/addr DEO2 &no-right
POP
@ -310,7 +310,7 @@ RTN
( draw ) DUPr STHr .Screen/color DEO
( incr ) .Screen/addr DEI2 #0008 ++ .Screen/addr DEO2
( incr ) SWP2 #0008 ++ SWP2
OVR2 OVR2 << ,&loop JNZ
OVR2 OVR2 << ,&loop JCN
POP2 POP2
POPr
@ -358,7 +358,7 @@ RTN
#00 #ff
&loop
( dotted line )
OVR #01 AND ,&no-dot JNZ
OVR #01 AND ,&no-dot JCN
.wave-view/y1 PEK2 #0010 ++ .Screen/y DEO2
#03 .Screen/color DEO
&no-dot
@ -368,7 +368,7 @@ RTN
.Screen/x DEI2 #0001 ++ .Screen/x DEO2
( draw ) OVR .Audio0/length DEI2 SWP POP > #02 * #01 + .Screen/color DEO
( incr ) SWP #01 + SWP
DUP2 < ,&loop JNZ
DUP2 < ,&loop JCN
POP2
( range )
@ -389,7 +389,7 @@ RTN
OVR2 .Screen/y DEO2
( draw ) DUPr STHr .Screen/color DEO
( incr ) SWP2 #0001 ++ SWP2
OVR2 OVR2 << ,&loop JNZ
OVR2 OVR2 << ,&loop JCN
POP2 POP2
POPr
@ -448,10 +448,10 @@ RTN
( save ) OVR2 .Screen/x DEO2
( draw ) .color PEK .Screen/color DEO
( incr ) SWP2 #0001 ++ SWP2
OVR2 OVR2 LTS2 ,&hor JNZ
OVR2 OVR2 LTS2 ,&hor JCN
POP2 POP2 STH2r STH2r
( incr ) SWP2 #0001 ++ SWP2
OVR2 OVR2 LTS2 ,&ver JNZ
OVR2 OVR2 LTS2 ,&ver JCN
POP2 POP2 POP2 POP2
RTN

View File

@ -53,12 +53,12 @@ BRK
@on-frame ( -> )
.cat/timer PEK #01 ADD [ DUP ] .cat/timer POK
DUP #00 NEQ ,&skip0 JNZ #0000 ;draw-tail JSR2 &skip0
DUP #10 NEQ ,&skip1 JNZ #0001 ;draw-tail JSR2 &skip1
DUP #20 NEQ ,&skip2 JNZ #0002 ;draw-tail JSR2 &skip2
DUP #30 NEQ ,&skip3 JNZ #0003 ;draw-tail JSR2 &skip3
DUP #40 NEQ ,&skip4 JNZ #0002 ;draw-tail JSR2 &skip4
DUP #50 NEQ ,&skip5 JNZ #0001 ;draw-tail JSR2 &skip5
DUP #00 NEQ ,&skip0 JCN #0000 ;draw-tail JSR2 &skip0
DUP #10 NEQ ,&skip1 JCN #0001 ;draw-tail JSR2 &skip1
DUP #20 NEQ ,&skip2 JCN #0002 ;draw-tail JSR2 &skip2
DUP #30 NEQ ,&skip3 JCN #0003 ;draw-tail JSR2 &skip3
DUP #40 NEQ ,&skip4 JCN #0002 ;draw-tail JSR2 &skip4
DUP #50 NEQ ,&skip5 JCN #0001 ;draw-tail JSR2 &skip5
POP
BRK
@ -136,7 +136,7 @@ RTN
( sety ) .Screen/addr DEI2 #0008 + .Screen/addr DEO2
( setx ) .Screen/x DEI2 #0008 + .Screen/x DEO2
( incr ) SWP #01 ADD SWP
DUP2 LTH ,&loop JNZ
DUP2 LTH ,&loop JCN
POP2
RTN

View File

@ -70,27 +70,27 @@ BRK
;draw-cursor JSR2
.Mouse/state DEI #00 NEQ #01 JNZ [ BRK ]
.Mouse/state DEI #00 NEQ #01 JCN [ BRK ]
.Mouse/y DEI2 .window/y1 PEK2 SUB2 STEP8
DUP2 #0010 NEQ2 ,&no-touch-red JNZ
.Mouse/x DEI2 .window/x1 PEK2 #0060 ADD2 LTH2 ,&no-touch-red JNZ
.Mouse/x DEI2 .window/x1 PEK2 #009c ADD2 GTH2 ,&no-touch-red JNZ
DUP2 #0010 NEQ2 ,&no-touch-red JCN
.Mouse/x DEI2 .window/x1 PEK2 #0060 ADD2 LTH2 ,&no-touch-red JCN
.Mouse/x DEI2 .window/x1 PEK2 #009c ADD2 GTH2 ,&no-touch-red JCN
( get new value ) .Mouse/x DEI2 .window/x1 PEK2 SUB2 #0060 SUB2 #0004 DIV2 SWP POP ;theme/r1 #00 .selection PEK ADD2 STA
&no-touch-red
DUP2 #0020 NEQ2 ,&no-touch-green JNZ
.Mouse/x DEI2 .window/x1 PEK2 #0060 ADD2 LTH2 ,&no-touch-green JNZ
.Mouse/x DEI2 .window/x1 PEK2 #009c ADD2 GTH2 ,&no-touch-green JNZ
DUP2 #0020 NEQ2 ,&no-touch-green JCN
.Mouse/x DEI2 .window/x1 PEK2 #0060 ADD2 LTH2 ,&no-touch-green JCN
.Mouse/x DEI2 .window/x1 PEK2 #009c ADD2 GTH2 ,&no-touch-green JCN
( get new value ) .Mouse/x DEI2 .window/x1 PEK2 SUB2 #0060 SUB2 #0004 DIV2 SWP POP ;theme/g1 #00 .selection PEK ADD2 STA
&no-touch-green
DUP2 #0030 NEQ2 ,&no-touch-blue JNZ
.Mouse/x DEI2 .window/x1 PEK2 #0060 ADD2 LTH2 ,&no-touch-blue JNZ
.Mouse/x DEI2 .window/x1 PEK2 #009c ADD2 GTH2 ,&no-touch-blue JNZ
DUP2 #0030 NEQ2 ,&no-touch-blue JCN
.Mouse/x DEI2 .window/x1 PEK2 #0060 ADD2 LTH2 ,&no-touch-blue JCN
.Mouse/x DEI2 .window/x1 PEK2 #009c ADD2 GTH2 ,&no-touch-blue JCN
( get new value ) .Mouse/x DEI2 .window/x1 PEK2 SUB2 #0060 SUB2 #0004 DIV2 SWP POP ;theme/b1 #00 .selection PEK ADD2 STA
&no-touch-blue
DUP2 #0040 NEQ2 ,&no-touch-radio JNZ
.Mouse/x DEI2 .window/x1 PEK2 #0050 ADD2 LTH2 ,&no-touch-radio JNZ
.Mouse/x DEI2 .window/x1 PEK2 #008c ADD2 GTH2 ,&no-touch-radio JNZ
DUP2 #0040 NEQ2 ,&no-touch-radio JCN
.Mouse/x DEI2 .window/x1 PEK2 #0050 ADD2 LTH2 ,&no-touch-radio JCN
.Mouse/x DEI2 .window/x1 PEK2 #008c ADD2 GTH2 ,&no-touch-radio JCN
.Mouse/x DEI2 .window/x1 PEK2 SUB2 #0050 SUB2 STEP8 2/ #0008 DIV2 SWP POP .selection POK
&no-touch-radio
POP2
@ -125,7 +125,7 @@ RTN
&draw-hor
( draw ) #01 .Screen/color DEO
( incr ) SWP2 #0002 ADD2 DUP2 .Screen/x DEO2 SWP2
OVR2 OVR2 LTH2 ,&draw-hor JNZ
OVR2 OVR2 LTH2 ,&draw-hor JCN
POP2 POP2
( draw ver line )
@ -134,7 +134,7 @@ RTN
&draw-ver
( draw ) #02 .Screen/color DEO
( incr ) SWP2 #0002 ADD2 DUP2 .Screen/y DEO2 SWP2
OVR2 OVR2 LTH2 ,&draw-ver JNZ
OVR2 OVR2 LTH2 ,&draw-ver JCN
POP2 POP2
( draw blending modes )
@ -145,7 +145,7 @@ RTN
( move ) OVR #08 MUL #00 SWP #0010 ADD2 .Screen/x DEO2
( draw ) OVR .Screen/color DEO
( incr ) SWP #01 ADD SWP
DUP2 LTH ,&draw-pixel1 JNZ
DUP2 LTH ,&draw-pixel1 JCN
POP POP
#0018 .Screen/y DEO2
#00 #08
@ -153,7 +153,7 @@ RTN
( move ) OVR #08 MUL #00 SWP #0010 ADD2 .Screen/x DEO2
( draw ) OVR #08 ADD .Screen/color DEO
( incr ) SWP #01 ADD SWP
DUP2 LTH ,&draw-pixel2 JNZ
DUP2 LTH ,&draw-pixel2 JCN
POP POP
#0020 .Screen/y DEO2
#00 #08
@ -161,7 +161,7 @@ RTN
( move ) OVR #08 MUL #00 SWP #0010 ADD2 .Screen/x DEO2
( draw ) OVR #20 ADD .Screen/color DEO
( incr ) SWP #01 ADD SWP
DUP2 LTH ,&draw-icn1 JNZ
DUP2 LTH ,&draw-icn1 JCN
POP POP
#0028 .Screen/y DEO2
#00 #08
@ -169,7 +169,7 @@ RTN
( move ) OVR #08 MUL #00 SWP #0010 ADD2 .Screen/x DEO2
( draw ) OVR #28 ADD .Screen/color DEO
( incr ) SWP #01 ADD SWP
DUP2 LTH ,&draw-icn2 JNZ
DUP2 LTH ,&draw-icn2 JCN
POP POP
#0030 .Screen/y DEO2
#00 #08
@ -177,7 +177,7 @@ RTN
( move ) OVR #08 MUL #00 SWP #0010 ADD2 .Screen/x DEO2
( draw ) OVR #40 ADD .Screen/color DEO
( incr ) SWP #01 ADD SWP
DUP2 LTH ,&draw-chr1 JNZ
DUP2 LTH ,&draw-chr1 JCN
POP POP
#0038 .Screen/y DEO2
#00 #08
@ -185,7 +185,7 @@ RTN
( move ) OVR #08 MUL #00 SWP #0010 ADD2 .Screen/x DEO2
( draw ) OVR #48 ADD .Screen/color DEO
( incr ) SWP #01 ADD SWP
DUP2 LTH ,&draw-chr2 JNZ
DUP2 LTH ,&draw-chr2 JCN
POP POP
RTN
@ -270,7 +270,7 @@ RTN
&loop
( incr ) .Screen/x DEI2 8+ .Screen/x DEO2
( draw ) #25 .Screen/color DEO
.Screen/x DEI2 .slider/x2 PEK2 #0008 ADD2 LTH2 ,&loop JNZ
.Screen/x DEI2 .slider/x2 PEK2 #0008 ADD2 LTH2 ,&loop JCN
( incr ) .Screen/x DEI2 #0004 ADD2 .Screen/x DEO2
;sliderc_icn .Screen/addr DEO2
@ -293,10 +293,10 @@ RTN
( save ) OVR2 .Screen/x DEO2
( draw ) .color PEK .Screen/color DEO
( incr ) SWP2 #0001 ADD2 SWP2
OVR2 OVR2 LTH2 ,&hor JNZ
OVR2 OVR2 LTH2 ,&hor JCN
POP2 POP2 STH2r STH2r
( incr ) SWP2 #0001 ADD2 SWP2
OVR2 OVR2 LTH2 ,&ver JNZ
OVR2 OVR2 LTH2 ,&ver JCN
POP2 POP2 POP2 POP2
RTN
@ -308,13 +308,13 @@ RTN
( incr ) .Screen/x DEI2 ++ .Screen/x DEO2
( draw ) .rect/y1 PEK2 .Screen/y DEO2 .color PEK .Screen/color DEO
( draw ) .rect/y2 PEK2 .Screen/y DEO2 .color PEK .Screen/color DEO
.Screen/x DEI2 .rect/x2 PEK2 LTH2 ,&hor JNZ
.Screen/x DEI2 .rect/x2 PEK2 LTH2 ,&hor JCN
.rect/y1 PEK2 .Screen/y DEO2
&ver
( draw ) .rect/x1 PEK2 .Screen/x DEO2 .color PEK .Screen/color DEO
( draw ) .rect/x2 PEK2 .Screen/x DEO2 .color PEK .Screen/color DEO
( incr ) .Screen/y DEI2 ++ .Screen/y DEO2
.Screen/y DEI2 .rect/y2 PEK2 ++ LTH2 ,&ver JNZ
.Screen/y DEI2 .rect/y2 PEK2 ++ LTH2 ,&ver JCN
RTN
@ -330,7 +330,7 @@ RTN
( draw ) DUPr STHr .Screen/color DEO
( incr ) ++
( incr ) .Screen/x DEI2 8+ .Screen/x DEO2
DUP2 LDA #00 NEQ ,&loop JNZ
DUP2 LDA #00 NEQ ,&loop JCN
POP2 POPr
RTN

View File

@ -32,7 +32,7 @@ BRK
@on-frame ( -> )
( incr ) .timer PEK #01 ADD .timer POK
( skip ) .timer PEK #10 EQU #01 JNZ [ BRK ]
( skip ) .timer PEK #10 EQU #01 JCN [ BRK ]
( get note )
;melody #00 .progress PEK ADD2 LDA

View File

@ -35,7 +35,7 @@ BRK
&loop
( send ) DUP2 LDA .Console/char DEO
( incr ) #0001 ADD2
( loop ) DUP2 LDA ,&loop JNZ
( loop ) DUP2 LDA ,&loop JCN
POP2
RTN
@ -50,7 +50,7 @@ RTN
RTN
&digit
#0f AND DUP #0a LTH ,&not-alpha JNZ
#0f AND DUP #0a LTH ,&not-alpha JCN
#27 ADD
&not-alpha
LIT '0 ADD .Console/char DEO
@ -64,14 +64,14 @@ RTN
DUP2 #0064 DIV2 DUP2 ,&digit JSR #0064 MUL2 SUB2
DUP2 #000a DIV2 DUP2 ,&digit JSR #000a MUL2 SUB2
,&digit JSR
.number/started PEK ,&end JNZ
.number/started PEK ,&end JCN
LIT '0 .Console/char DEO
&end
RTN
&digit
SWP POP
DUP .number/started PEK ORA #02 JNZ
DUP .number/started PEK ORA #02 JCN
POP JMP2r
LIT '0 ADD .Console/char DEO
#01 .number/started POK

View File

@ -19,7 +19,7 @@ BRK
&loop
( send ) DUP2 LDA .Console/char DEO
( incr ) #0001 ADD2
( loop ) DUP2 LDA #00 NEQ ,&loop JNZ
( loop ) DUP2 LDA #00 NEQ ,&loop JCN
POP2
RTN

View File

@ -44,27 +44,27 @@ BRK
( hold ctrl key to change slime color )
.Controller/button DEI #0f AND
DUP #01 NEQ ,&no-ctrl JNZ #25 .slime POK &no-ctrl
DUP #02 NEQ ,&no-alt JNZ #2f .slime POK &no-alt
DUP #01 NEQ ,&no-ctrl JCN #25 .slime POK &no-ctrl
DUP #02 NEQ ,&no-alt JCN #2f .slime POK &no-alt
POP
( clear ) #30 .Screen/color DEO
( detect movement )
.Controller/button DEI #f0 AND
DUP #04 SFT #01 AND #01 NEQ ,&no-up JNZ
DUP #04 SFT #01 AND #01 NEQ ,&no-up JCN
( move )
.Screen/y DEI2 -- .Screen/y DEO2
;up_icn .Screen/addr DEO2 &no-up
DUP #05 SFT #01 AND #01 NEQ ,&no-down JNZ
DUP #05 SFT #01 AND #01 NEQ ,&no-down JCN
( move )
.Screen/y DEI2 ++ .Screen/y DEO2
;down_icn .Screen/addr DEO2 &no-down
DUP #06 SFT #01 AND #01 NEQ ,&no-left JNZ
DUP #06 SFT #01 AND #01 NEQ ,&no-left JCN
( move )
.Screen/x DEI2 -- .Screen/x DEO2
;left_icn .Screen/addr DEO2 &no-left
DUP #07 SFT #01 AND #01 NEQ ,&no-right JNZ
DUP #07 SFT #01 AND #01 NEQ ,&no-right JCN
( move )
.Screen/x DEI2 ++ .Screen/x DEO2
;right_icn .Screen/addr DEO2 &no-right

View File

@ -27,9 +27,9 @@ BRK
@on-button ( -> )
( skip ) .Controller/key DEI #00 NEQ #01 JNZ [ BRK ]
( skip ) .Controller/key DEI #00 NEQ #01 JCN [ BRK ]
.Controller/key DEI #0d NEQ ,&no-return JNZ
.Controller/key DEI #0d NEQ ,&no-return JCN
( draw ) #20 .Screen/color DEO
( reset ) #0000 .Screen/x DEO2
( incr ) .Screen/y DEI2 8+ .Screen/y DEO2

View File

@ -2,7 +2,7 @@
%RTN { JMP2r }
%MOD { DUP2 DIV MUL SUB }
%ABS2 { DUP2 #000f SFT2 EQU #04 JNZ #ffff MUL2 }
%ABS2 { DUP2 #000f SFT2 EQU #04 JCN #ffff MUL2 }
%SCALEX { #0002 DIV2 .Screen/width DEI2 #0002 DIV2 ADD2 #0040 SUB2 }
%SCALEY { #0002 DIV2 .Screen/height DEI2 #0002 DIV2 ADD2 #0040 SUB2 }
%12HOURS { DUP #0c GTH #0c MUL SUB }
@ -41,7 +41,7 @@ BRK
@on-frame ( -> )
( only draw once per second )
( skip ) .DateTime/second DEI .current PEK NEQ #01 JNZ [ BRK ]
( skip ) .DateTime/second DEI .current PEK NEQ #01 JCN [ BRK ]
.DateTime/second DEI .current POK
@ -74,7 +74,7 @@ BRK
#00 SWP SCALEX .Screen/x DEO2
OVR #0f MOD #00 EQU #01 ADD .Screen/color DEO
( incr ) SWP #01 ADD SWP
DUP2 LTH ,&loop JNZ
DUP2 LTH ,&loop JCN
POP2
;draw-display JSR2
@ -120,13 +120,13 @@ RTN
.line/y PEK2 .Screen/y DEO2
.color PEK .Screen/color DEO
[ .line/x PEK2 .line/x0 PEK2 EQU2 ]
[ .line/y PEK2 .line/y0 PEK2 EQU2 ] #0101 EQU2 ,&end JNZ
[ .line/y PEK2 .line/y0 PEK2 EQU2 ] #0101 EQU2 ,&end JCN
.line/e1 PEK2 #0002 MUL2 .line/e2 POK2
.line/e2 PEK2 .line/dy PEK2 LTS2 ,&skipy JNZ
.line/e2 PEK2 .line/dy PEK2 LTS2 ,&skipy JCN
.line/e1 PEK2 .line/dy PEK2 ADD2 .line/e1 POK2
.line/x PEK2 .line/sx PEK2 ADD2 .line/x POK2
&skipy
.line/e2 PEK2 .line/dx PEK2 GTS2 ,&skipx JNZ
.line/e2 PEK2 .line/dx PEK2 GTS2 ,&skipx JCN
.line/e1 PEK2 .line/dx PEK2 ADD2 .line/e1 POK2
.line/y PEK2 .line/sy PEK2 ADD2 .line/y POK2
&skipx

View File

@ -28,7 +28,7 @@
;srcpath .File/name DEO2
MEMORY .File/load DEO2
.File/success DEI2 #0000 NEQ2 ;on-success JNZ2
.File/success DEI2 #0000 NEQ2 ;on-success JCN2
;failedtxt .Console/string DEO2
@ -49,10 +49,10 @@ BRK
( draw ) #41 .Screen/color DEO
( incr ) .Screen/addr DEI2 #0010 ADD2 .Screen/addr DEO2
( incr ) SWP2 8+ SWP2
OVR2 OVR2 LTH2 ,&hor JNZ
OVR2 OVR2 LTH2 ,&hor JCN
POP2 POP2
( incr ) SWP2 8+ SWP2
OVR2 OVR2 LTH2 ,&ver JNZ
OVR2 OVR2 LTH2 ,&ver JCN
POP2 POP2
( save file )

View File

@ -1,7 +1,7 @@
( dev/mouse )
%RTN { JMP2r }
%ABS2 { DUP2 #000f SFT2 EQU #04 JNZ #ffff MUL2 }
%ABS2 { DUP2 #000f SFT2 EQU #04 JCN #ffff MUL2 }
%LTS2 { #8000 ADD2 SWP2 #8000 ADD2 GTH2 }
%GTS2 { #8000 ADD2 SWP2 #8000 ADD2 LTH2 }
@ -36,10 +36,10 @@ BRK
;draw-cursor JSR2
( on down )
.Mouse/state DEI #00 NEQ .pointer/state PEK #00 EQU #0101 EQU2 ,on-mouse-down JNZ
.Mouse/state DEI #00 NEQ .pointer/state PEK #00 EQU #0101 EQU2 ,on-mouse-down JCN
( on drag )
.Mouse/state DEI #00 NEQ ,on-mouse-drag JNZ
.Mouse/state DEI #00 NEQ ,on-mouse-drag JCN
.Mouse/state DEI .pointer/state POK
BRK
@ -103,13 +103,13 @@ RTN
.line/y PEK2 .Screen/y DEO2
.color PEK .Screen/color DEO
[ .line/x PEK2 .line/x0 PEK2 EQU2 ]
[ .line/y PEK2 .line/y0 PEK2 EQU2 ] #0101 EQU2 ,&end JNZ
[ .line/y PEK2 .line/y0 PEK2 EQU2 ] #0101 EQU2 ,&end JCN
.line/e1 PEK2 #0002 MUL2 .line/e2 POK2
.line/e2 PEK2 .line/dy PEK2 LTS2 ,&skipy JNZ
.line/e2 PEK2 .line/dy PEK2 LTS2 ,&skipy JCN
.line/e1 PEK2 .line/dy PEK2 ADD2 .line/e1 POK2
.line/x PEK2 .line/sx PEK2 ADD2 .line/x POK2
&skipy
.line/e2 PEK2 .line/dx PEK2 GTS2 ,&skipx JNZ
.line/e2 PEK2 .line/dx PEK2 GTS2 ,&skipx JCN
.line/e1 PEK2 .line/dx PEK2 ADD2 .line/e1 POK2
.line/y PEK2 .line/sy PEK2 ADD2 .line/y POK2
&skipx

View File

@ -45,7 +45,7 @@ BRK
.center/y PEK2 #0040 SUB2 ADD2 .Screen/y DEO2
( draw ) OVR .Screen/color DEO
( incr ) SWP #01 ADD SWP
DUP2 NEQ ,&loop JNZ
DUP2 NEQ ,&loop JCN
POP2
RTN
@ -69,7 +69,7 @@ RTN
( draw ) #21 .Screen/color DEO
( incr ) SWP #01 ADD SWP
DUP2 LTH ,&loop JNZ
DUP2 LTH ,&loop JCN
POP2
RTN

View File

@ -32,11 +32,11 @@ BRK
( clear ) #20 ;draw-dvd JSR2
( case: hit-right ) .dvd/x PEK2 .Screen/width DEI2 #0020 SUB2 EQU2
( case: hit-left ) .dvd/x PEK2 #0000 EQU2
#0000 EQU2 ,&no-flipx JNZ
#0000 EQU2 ,&no-flipx JCN
.dvd/dx PEK #00 EQU .dvd/dx POK &no-flipx
( case: hit-bottom ) .dvd/y PEK2 .Screen/height DEI2 #0010 SUB2 EQU2
( case: hit-top ) .dvd/y PEK2 #0000 EQU2
#0000 EQU2 ,&no-flipy JNZ
#0000 EQU2 ,&no-flipy JCN
.dvd/dy PEK #00 EQU .dvd/dy POK &no-flipy
( incr ) .dvd/x PEK2 #0001 #00 .dvd/dx PEK #00 EQU #fffe MUL2 ADD2 ADD2 .dvd/x POK2
( incr ) .dvd/y PEK2 #0001 #00 .dvd/dy PEK #00 EQU #fffe MUL2 ADD2 ADD2 .dvd/y POK2
@ -57,10 +57,10 @@ BRK
( draw ) DUPr STHr .Screen/color DEO
( next ) .Screen/addr DEI2 #0008 ADD2 .Screen/addr DEO2
( incr ) SWP2 #0008 ADD2 SWP2
OVR2 OVR2 LTH2 ,&hor JNZ
OVR2 OVR2 LTH2 ,&hor JCN
POP2 POP2
( incr ) SWP2 #0008 ADD2 SWP2
OVR2 OVR2 LTH2 ,&ver JNZ
OVR2 OVR2 LTH2 ,&ver JCN
POP2 POP2
( destroy ) POPr

View File

@ -40,22 +40,22 @@
( matrix comparison )
.Mouse/x DEI2 .r1/x1 PEK2 GTH2 .Mouse/x DEI2 .r1/x2 PEK2 LTH2 #0101 EQU2
.Mouse/y DEI2 .r1/y1 PEK2 GTH2 .Mouse/y DEI2 .r1/y2 PEK2 LTH2 #0101 EQU2
#0101 NEQ2 ,&draw1 JNZ #02 .color POK ;hand_icn .pointer/sprite POK2
#0101 NEQ2 ,&draw1 JCN #02 .color POK ;hand_icn .pointer/sprite POK2
&draw1 .r1/x1 PEK2 .r1/y1 PEK2 .r1/x2 PEK2 .r1/y2 PEK2 .color PEK ;line-rect JSR2
#01 .color POK
( 2-step comparison )
.Mouse/x DEI2 .r2/x1 PEK2 GTH2 .Mouse/x DEI2 .r2/x2 PEK2 LTH2 #0101 NEQ2 ,&draw2 JNZ
.Mouse/y DEI2 .r2/y1 PEK2 GTH2 .Mouse/y DEI2 .r2/y2 PEK2 LTH2 #0101 NEQ2 ,&draw2 JNZ
.Mouse/x DEI2 .r2/x1 PEK2 GTH2 .Mouse/x DEI2 .r2/x2 PEK2 LTH2 #0101 NEQ2 ,&draw2 JCN
.Mouse/y DEI2 .r2/y1 PEK2 GTH2 .Mouse/y DEI2 .r2/y2 PEK2 LTH2 #0101 NEQ2 ,&draw2 JCN
#03 .color POK ;hand_icn .pointer/sprite POK2
&draw2 .r2/x1 PEK2 .r2/y1 PEK2 .r2/x2 PEK2 .r2/y2 PEK2 .color PEK ;line-rect JSR2
#01 .color POK
( 4-step comparison )
.Mouse/x DEI2 .r3/x1 PEK2 LTH2 ,&draw3 JNZ
.Mouse/x DEI2 .r3/x2 PEK2 GTH2 ,&draw3 JNZ
.Mouse/y DEI2 .r3/y1 PEK2 LTH2 ,&draw3 JNZ
.Mouse/y DEI2 .r3/y2 PEK2 GTH2 ,&draw3 JNZ
.Mouse/x DEI2 .r3/x1 PEK2 LTH2 ,&draw3 JCN
.Mouse/x DEI2 .r3/x2 PEK2 GTH2 ,&draw3 JCN
.Mouse/y DEI2 .r3/y1 PEK2 LTH2 ,&draw3 JCN
.Mouse/y DEI2 .r3/y2 PEK2 GTH2 ,&draw3 JCN
#02 .color POK ;hand_icn .pointer/sprite POK2
&draw3 .r3/x1 PEK2 .r3/y1 PEK2 .r3/x2 PEK2 .r3/y2 PEK2 .color PEK ;line-rect JSR2
@ -89,13 +89,13 @@ RTN
( incr ) .Screen/x DEI2 #0001 ADD2 .Screen/x DEO2
( draw ) .rect/y1 PEK2 .Screen/y DEO2 .color PEK .Screen/color DEO
( draw ) .rect/y2 PEK2 .Screen/y DEO2 .color PEK .Screen/color DEO
.Screen/x DEI2 .rect/x2 PEK2 LTH2 ,&hor JNZ
.Screen/x DEI2 .rect/x2 PEK2 LTH2 ,&hor JCN
.rect/y1 PEK2 .Screen/y DEO2
&ver
( draw ) .rect/x1 PEK2 .Screen/x DEO2 .color PEK .Screen/color DEO
( draw ) .rect/x2 PEK2 .Screen/x DEO2 .color PEK .Screen/color DEO
( incr ) .Screen/y DEI2 #0001 ADD2 .Screen/y DEO2
.Screen/y DEI2 .rect/y2 PEK2 #0001 ADD2 LTH2 ,&ver JNZ
.Screen/y DEI2 .rect/y2 PEK2 #0001 ADD2 LTH2 ,&ver JCN
RTN

View File

@ -35,7 +35,7 @@ BRK
&draw-ver
( draw ) #02 .Screen/color DEO
( incr ) .Screen/y DEI2 #0002 ADD2 .Screen/y DEO2
.Screen/y DEI2 .Screen/height DEI2 LTH2 ,&draw-ver JNZ
.Screen/y DEI2 .Screen/height DEI2 LTH2 ,&draw-ver JCN
.center/x PEK2 .center/y PEK2 #0010 SUB2 #2c ;text1 ;draw-label-left JSR2
.center/x PEK2 .center/y PEK2 #2c ;text2 ;draw-label-middle JSR2
@ -53,7 +53,7 @@ RTN
( draw ) DUP2 LDA #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2 .label/color PEK .Screen/color DEO
( incr ) #0001 ADD2
( incr ) .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
DUP2 LDA #00 NEQ ,&loop JNZ
DUP2 LDA #00 NEQ ,&loop JCN
POP2
RTN
@ -67,7 +67,7 @@ RTN
( draw ) DUP2 LDA #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2 .label/color PEK .Screen/color DEO
( incr ) #0001 ADD2
( incr ) .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
DUP2 LDA #00 NEQ ,&loop JNZ
DUP2 LDA #00 NEQ ,&loop JCN
POP2
RTN
@ -81,7 +81,7 @@ RTN
( draw ) DUP2 LDA #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2 .label/color PEK .Screen/color DEO
( incr ) #0001 ADD2
( incr ) .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
DUP2 LDA #00 NEQ ,&loop JNZ
DUP2 LDA #00 NEQ ,&loop JCN
POP2
RTN
@ -91,7 +91,7 @@ RTN
#0000 ( counter )
&loop
( incr ) #0001 ADD2 OVR2 OVR2 ADD2
LDA #00 NEQ ,&loop JNZ
LDA #00 NEQ ,&loop JCN
SWP2 POP2
RTN

View File

@ -52,10 +52,10 @@ BRK
( draw ) .color PEK .Screen/color DEO
( incr ) .Screen/addr DEI2 8+ .Screen/addr DEO2
( incr ) SWP2 8+ SWP2
OVR2 OVR2 LTH2 ,&hor JNZ
OVR2 OVR2 LTH2 ,&hor JCN
POP2 POP2
( incr ) SWP2 8+ SWP2
OVR2 OVR2 LTH2 ,&ver JNZ
OVR2 OVR2 LTH2 ,&ver JCN
POP2 POP2
RTN
@ -72,10 +72,10 @@ RTN
( draw ) .color PEK .Screen/color DEO
( incr ) .Screen/addr DEI2 #0010 ADD2 .Screen/addr DEO2
( incr ) SWP2 8+ SWP2
OVR2 OVR2 LTH2 ,&hor JNZ
OVR2 OVR2 LTH2 ,&hor JCN
POP2 POP2
( incr ) SWP2 8+ SWP2
OVR2 OVR2 LTH2 ,&ver JNZ
OVR2 OVR2 LTH2 ,&ver JCN
POP2 POP2
RTN
@ -91,10 +91,10 @@ RTN
( save ) OVR2 .Screen/x DEO2
( draw ) .color PEK .Screen/color DEO
( incr ) SWP2 8+ SWP2
OVR2 OVR2 LTH2 ,&hor JNZ
OVR2 OVR2 LTH2 ,&hor JCN
POP2 POP2
( incr ) SWP2 8+ SWP2
OVR2 OVR2 LTH2 ,&ver JNZ
OVR2 OVR2 LTH2 ,&ver JCN
POP2 POP2
RTN

View File

@ -4,7 +4,7 @@
%++ { #0001 ADD2 }
%-- { #0001 SUB2 }
%8+ { #0008 ADD2 }
%ABS2 { DUP2 #000f SFT2 EQU #04 JNZ #ffff MUL2 }
%ABS2 { DUP2 #000f SFT2 EQU #04 JCN #ffff MUL2 }
%LTS2 { #8000 ADD2 SWP2 #8000 ADD2 GTH2 }
%GTS2 { #8000 ADD2 SWP2 #8000 ADD2 LTH2 }
@ -54,13 +54,13 @@ BRK
.line/dx PEK2 .line/dy PEK2 ADD2 .line/e1 POK2
&loop
.line/x PEK2 .Screen/x DEO2 .line/y PEK2 .Screen/y DEO2 .color PEK .Screen/color DEO
.line/x PEK2 .line/x0 PEK2 EQU2 .line/y PEK2 .line/y0 PEK2 EQU2 #0101 EQU2 ,&end JNZ
.line/x PEK2 .line/x0 PEK2 EQU2 .line/y PEK2 .line/y0 PEK2 EQU2 #0101 EQU2 ,&end JCN
.line/e1 PEK2 #0002 MUL2 .line/e2 POK2
.line/e2 PEK2 .line/dy PEK2 LTS2 ,&skipy JNZ
.line/e2 PEK2 .line/dy PEK2 LTS2 ,&skipy JCN
.line/e1 PEK2 .line/dy PEK2 ADD2 .line/e1 POK2
.line/x PEK2 .line/sx PEK2 ADD2 .line/x POK2
&skipy
.line/e2 PEK2 .line/dx PEK2 GTS2 ,&skipx JNZ
.line/e2 PEK2 .line/dx PEK2 GTS2 ,&skipx JCN
.line/e1 PEK2 .line/dx PEK2 ADD2 .line/e1 POK2
.line/y PEK2 .line/sy PEK2 ADD2 .line/y POK2
&skipx
@ -79,7 +79,7 @@ RTN
( draw ) .rect/x1 PEK2 .Screen/x DEO2 .color PEK DUP .Screen/color DEO
( draw ) .rect/x2 PEK2 .Screen/x DEO2 .Screen/color DEO
( incr ) SWP2 ++ SWP2
OVR2 OVR2 LTS2 ,&ver JNZ
OVR2 OVR2 LTS2 ,&ver JCN
POP2 POP2
.rect/x1 PEK2 .rect/x2 PEK2
&hor
@ -87,7 +87,7 @@ RTN
( draw ) .rect/y1 PEK2 .Screen/y DEO2 .color PEK DUP .Screen/color DEO
( draw ) .rect/y2 PEK2 .Screen/y DEO2 .Screen/color DEO
( incr ) SWP2 ++ SWP2
OVR2 OVR2 ++ LTS2 ,&hor JNZ
OVR2 OVR2 ++ LTS2 ,&hor JCN
POP2 POP2
RTN
@ -103,10 +103,10 @@ RTN
( save ) OVR2 .Screen/x DEO2
( draw ) .color PEK .Screen/color DEO
( incr ) SWP2 ++ SWP2
OVR2 OVR2 LTS2 ,&hor JNZ
OVR2 OVR2 LTS2 ,&hor JCN
POP2 POP2 STH2r STH2r
( incr ) SWP2 ++ SWP2
OVR2 OVR2 LTS2 ,&ver JNZ
OVR2 OVR2 LTS2 ,&ver JCN
POP2 POP2 POP2 POP2
RTN
@ -119,7 +119,7 @@ RTN
( draw ) ;&seg JSR2
&loop
( incr ) .circle/x PEK2 ++ .circle/x POK2
.circle/d PEK2 #0001 LTS2 ,&else JNZ
.circle/d PEK2 #0001 LTS2 ,&else JCN
( decr ) .circle/y PEK2 -- .circle/y POK2
.circle/x PEK2 .circle/y PEK2 SUB2 #0004 MUL2 .circle/d PEK2 ADD2 .circle/d POK2
;&end JMP2
@ -127,7 +127,7 @@ RTN
.circle/x PEK2 #0004 MUL2 .circle/d PEK2 ADD2 .circle/d POK2
&end
( draw ) ;&seg JSR2
.circle/y PEK2 .circle/x PEK2 -- GTS2 ,&loop JNZ
.circle/y PEK2 .circle/x PEK2 -- GTS2 ,&loop JCN
RTN
&seg
.circle/xc PEK2 .circle/x PEK2 ADD2 .Screen/x DEO2 .circle/yc PEK2 .circle/y PEK2 ADD2 .Screen/y DEO2 .color PEK .Screen/color DEO
@ -152,10 +152,10 @@ RTN
( save ) OVR2 .Screen/x DEO2
( draw ) .color PEK .Screen/color DEO
( incr ) SWP2 8+ SWP2
OVR2 OVR2 LTH2 ,&hor JNZ
OVR2 OVR2 LTH2 ,&hor JCN
POP2 POP2
( incr ) SWP2 8+ SWP2
OVR2 OVR2 LTH2 ,&ver JNZ
OVR2 OVR2 LTH2 ,&ver JCN
POP2 POP2
RTN

View File

@ -22,9 +22,9 @@
&loop
DUP2 ,row JSR
#0001 ADD2
DUP2 .Screen/height DEI2 LTH2 ,&loop JNZ
DUP2 .Screen/height DEI2 LTH2 ,&loop JCN
POP2
.scroll/wait PEK ,&noscroll JNZ
.scroll/wait PEK ,&noscroll JCN
.scroll/y PEK2 #0001 ADD2 .scroll/y POK2
BRK
@ -40,11 +40,11 @@
&loop
#0001 SUB2
OVR2 OVR2 .scroll/x PEK2 ADD2 EOR2 DUP2 #0013 DIV2 #0013 MUL2 SUB2
DUP #00 EQU ,&draw JNZ
DUP #05 EQU ,&draw JNZ
DUP #00 EQU ,&draw JCN
DUP #05 EQU ,&draw JCN
POP2
&rest
DUP2 ORA ,&loop JNZ
DUP2 ORA ,&loop JCN
POP2 POP2
JMP2r

View File

@ -12,10 +12,10 @@
@reset
;asma-init-assembler JSR2
;&filename ,asma-assemble-file-pass JSR
asma-IF-ERROR ,asma-print-error JNZ
asma-IF-ERROR ,asma-print-error JCN
;asma-init-assembler-pass JSR2
;&filename ,asma-assemble-file-pass JSR
asma-IF-ERROR ,asma-print-error JNZ
asma-IF-ERROR ,asma-print-error JCN
BRK
&filename
@ -43,14 +43,14 @@
DUP2 .File/offset DEO2
#0100 .File/length DEO2
#fe00 DUP2 DUP2 .File/load DEO2
.File/success DEI2 DUP2 ORA ,&not-end JNZ
.File/success DEI2 DUP2 ORA ,&not-end JCN
POP2 POP2
&error
POP2 POP2 POP2
JMP2r
&not-end
,asma-assemble-chunk JSR asma-IF-ERROR ,&error JNZ
,asma-assemble-chunk JSR asma-IF-ERROR ,&error JCN
SUB2 SUB2
,&loop JMP
@ -79,15 +79,15 @@
&next-char
#0001 ADD2
&loop ( last-ptr* ptr* / start-of-token* )
OVR2 OVR2 LTH2 ,&end JNZ
OVR2 OVR2 LTH2 ,&end JCN
DUP2 LDA ( last-ptr* ptr* char / start-of-token* )
DUP #20 GTH ,&next-char-pop JNZ
DUP #20 GTH ,&next-char-pop JCN
#00 OVR2 ( last-ptr* ptr* char 00 ptr* / start-of-token* )
STA
STH2r ,asma-assemble-token JSR asma-IF-ERROR ,&error JNZ
STH2r ,asma-assemble-token JSR asma-IF-ERROR ,&error JCN
#0a NEQ ,&not-newline JNZ
#0a NEQ ,&not-newline JCN
;asma/line LDA2 #0001 ADD2 ;asma/line STA2
&not-newline
@ -108,7 +108,7 @@
DUP2 .Console/string DEO2 #0a .Console/char DEO
DUP2 ;asma/token STA2
DUP2 ;asma/orig-token STA2
DUP2 LDA ,&not-empty JNZ
DUP2 LDA ,&not-empty JCN
POP2
JMP2r
@ -129,7 +129,7 @@
( restore truncated char )
STAr
,&not-found JNZ
,&not-found JCN
( tree-offset* token-routine-ptr* / end* )
STH2r ;asma/token STA2
@ -153,8 +153,8 @@
@asma-parse-hex-digit ( charcode -- 00-0f if valid hex
OR 10-ff otherwise )
DUP #3a LTH ,&digit JNZ
DUP #60 GTH ,&letter JNZ
DUP #3a LTH ,&digit JCN
DUP #60 GTH ,&letter JCN
JMP2r
&digit
@ -173,14 +173,14 @@
&loop
DUP2 LDA
DUP ,&not-end JNZ
DUP ,&not-end JCN
POP POP2
STH2r ROT #01 ADD #03 MUL
JMP2r
&not-end
,asma-parse-hex-digit JSR
DUP #f0 AND ,&fail JNZ
DUP #f0 AND ,&fail JCN
LIT2r 0010 MUL2r
#00 STH STH ADD2r
#0001 ADD2
@ -196,7 +196,7 @@
&loop
DUP2 LDA
,&not-end JNZ
,&not-end JCN
POP2 STHr
JMP2r
@ -211,7 +211,7 @@
@asma-parse-opcode ( -- byte 00 if valid opcode
OR 01 otherwise )
;asma/token LDA2
DUP2 ,asma-strlen JSR #03 LTH ,&too-short JNZ
DUP2 ,asma-strlen JSR #03 LTH ,&too-short JCN
( truncate to three chars long )
#0003 ADD2 ( end* / )
@ -222,22 +222,22 @@
;asma-trees/opcodes ;asma-traverse-tree JSR2
STAr
,&not-found JNZ
,&not-found JCN
;asma-opcodes/_disasm SUB2 #0003 SFT2 ( 00 byte / end* )
&loop
DUP2r LDAr STHr LIT2r 0001 ADD2r ( 00 byte char / end* )
DUP ,&not-end JNZ
DUP ,&not-end JCN
POP POP2r
SWP
JMP2r
&not-end
DUP LIT '2 NEQ ,&not-two JNZ
DUP LIT '2 NEQ ,&not-two JCN
POP asma-SHORT-FLAG ORA ,&loop JMP
&not-two
LIT 'r NEQ ,&not-return JNZ
LIT 'r NEQ ,&not-return JCN
asma-RETURN-FLAG ORA ,&loop JMP
&not-return ( 00 byte / end* )
@ -275,7 +275,7 @@
@asma-append-heap-string ( string* -- )
DUP2 LDA
DUP ,asma-append-heap-byte JSR
,&keep-going JNZ
,&keep-going JCN
POP2 JMP2r
&keep-going
@ -293,13 +293,13 @@
#0a .Console/char DEO )
&loop ( incoming-ptr* )
DUP2 LDA2 ORA ,&valid-node JNZ
DUP2 LDA2 ORA ,&valid-node JCN
#01 JMP2r
&valid-node
LDA2 DUP2 STH2
#0004 ADD2 ,asma-strcmp-tree JSR
DUP ,&nomatch JNZ
DUP ,&nomatch JCN
POP2r JMP2r
&nomatch
@ -315,7 +315,7 @@
&loop ( node-key* / token* )
DUP2 #0001 ADD2 SWP2 LDA DUP2r LDAr STHr
DUP2 ORA ,&not-end JNZ
DUP2 ORA ,&not-end JCN
( end of C strings, match found )
POP2r POP
@ -323,7 +323,7 @@
&not-end
SUB
DUP ,&nomatch JNZ
DUP ,&nomatch JCN
POP
LIT2r 0001 ADD2r
,&loop JMP
@ -347,9 +347,9 @@
JMP2r
@asma-macro-define
;asma/pass LDA ,&ignore-macro JNZ
;asma/pass LDA ,&ignore-macro JCN
;asma-trees/macros ;asma-traverse-tree JSR2 ,&not-exist JNZ
;asma-trees/macros ;asma-traverse-tree JSR2 ,&not-exist JCN
POP2
;asma-msg-macro ;asma/error STA2
JMP2r
@ -379,7 +379,7 @@
@asma-label-define
#0000 ;asma/scope-addr STA2
;asma-trees/labels ,asma-label-helper JSR
,&already-existed JNZ
,&already-existed JCN
#0000 ;asma-append-heap-short JSR2 ( data2: subtree incoming ptr )
@ -396,7 +396,7 @@
@asma-label-helper ( incoming-ptr* -- binary-ptr* 00 if label existed already
OR binary-ptr* 01 if label was created )
;asma-traverse-tree JSR2
,&new-label JNZ
,&new-label JCN
( label already exists )
( FIXME check label address )
@ -424,7 +424,7 @@
@asma-pad-helper ( offset* -- )
;asma-parse-hex-string JSR2
,&valid JNZ
,&valid JCN
;asma-msg-hex ;asma/error POK2
JMP2r
@ -443,7 +443,7 @@
&loop
DUP2 LDA
DUP ,&not-end JNZ
DUP ,&not-end JCN
POP POP2
JMP2r
@ -466,7 +466,7 @@
,asma-addr-helper JSR
;asma-write-byte JSR2
,&not-zero-page JNZ
,&not-zero-page JCN
JMP2r
&not-zero-page
@ -478,7 +478,7 @@
,asma-addr-helper JSR ;asma/addr LDA2 SUB2 #0002 SUB2
DUP2 #0080 LTH2 STH
DUP2 #ff7f GTH2 STHr ORA ,&in-bounds JNZ
DUP2 #ff7f GTH2 STHr ORA ,&in-bounds JCN
POP2
;asma-msg-relative ;asma/error STA2
@ -490,20 +490,20 @@
JMP2r
@asma-addr-helper ( -- addr* )
;asma/token LDA2 DUP2 LDA #26 NEQ ,&not-local JNZ
;asma/token LDA2 DUP2 LDA #26 NEQ ,&not-local JCN
#0001 ADD2 ;asma/token STA2
;asma/scope-addr LDA2 ;asma-trees/scope LDA2
,&final-lookup JMP
&not-local ( token* )
DUP2 LDA
DUP ,&not-end JNZ
DUP ,&not-end JCN
POP POP2
#0000 ;asma-trees/labels
,&final-lookup JMP
&not-end ( token* char )
#2f EQU ,&found-slash JNZ
#2f EQU ,&found-slash JCN
#0001 ADD2
,&not-local JMP
@ -511,19 +511,19 @@
DUP2 #00 ROT ROT STA
;asma-trees/labels ;asma-traverse-tree JSR2 STH
SWP2 DUP2 #2f ROT ROT STA
STHr ,&not-found JNZ
STHr ,&not-found JCN
( token* binary-ptr* )
#0001 ADD2 ;asma/token STA2
DUP2 LDA2 SWP2 #0002 ADD2
&final-lookup ( addr-offset* incoming-ptr* )
;asma-traverse-tree JSR2 ,&not-found JNZ
;asma-traverse-tree JSR2 ,&not-found JCN
LDA2 ADD2
JMP2r
&not-found ( dummy* dummy* )
;asma/pass LDA #00 EQU ,&ignore-error JNZ
;asma/pass LDA #00 EQU ,&ignore-error JCN
;asma-msg-label ;asma/error STA2
&ignore-error
@ -556,7 +556,7 @@
;asma-write-short JMP2 ( tail call )
@asma-normal-body
;asma-parse-opcode JSR2 ,&not-opcode JNZ
;asma-parse-opcode JSR2 ,&not-opcode JCN
;asma-write-byte JMP2 ( tail call )
&not-opcode
@ -566,17 +566,17 @@
( hex short ) ,asma-short-helper/raw JMP
&not-hex
;asma-trees/macros ;asma-traverse-tree JSR2 ,&not-macro JNZ
;asma-trees/macros ;asma-traverse-tree JSR2 ,&not-macro JCN
&macro-loop
DUP2 LDA ,&keep-going JNZ
DUP2 LDA ,&keep-going JCN
&error
POP2
JMP2r
&keep-going
DUP2 DUP2 ;asma-strlen JSR2 #00 SWP #0001 ADD2 ADD2
SWP2 ;asma-assemble-token JSR2 asma-IF-ERROR ,&error JNZ
SWP2 ;asma-assemble-token JSR2 asma-IF-ERROR ,&error JCN
,&macro-loop JMP
&not-macro
@ -728,8 +728,8 @@
&NEQ :&MUL :&NOP "NEQ 00
&GTH $2 $2 "GTH 00
&_entry :&EQU :&POP "LTH 00
&JMP :&GTH :&JNZ "JMP 00
&JNZ $2 $2 "JNZ 00
&JMP :&GTH :&JCN "JMP 00
&JCN $2 $2 "JCN 00
&JSR :&JMP :&LDR "JSR 00
&STH :&SFT :&SUB "STH 00
&PEK :&OVR :&POK "PEK 00

View File

@ -20,7 +20,7 @@
%RTN { JMP2r }
%RTN? { #00 EQU #02 JNZ STH2r JMP2 }
%RTN? { #00 EQU #02 JCN STH2r JMP2 }
%++ { #0001 ADD2 } %-- { #0001 SUB2 }
%8/ { #0003 SFT2 } %8* { #0030 SFT2 }
@ -76,15 +76,15 @@ BRK
@on-button ( -> )
( alt + arrow )
.Controller/button DEI #0f AND #02 NEQ ,&no-alt JNZ
.Controller/button DEI #0f AND #02 NEQ ,&no-alt JCN
.Controller/button DEI #04 SFT
DUP #01 NEQ ,&no-aup JNZ
DUP #01 NEQ ,&no-aup JCN
( sel word ) ;find-wordstart JSR2 .selection/to POK2 &no-aup
DUP #02 NEQ ,&no-adown JNZ
DUP #02 NEQ ,&no-adown JCN
( sel word ) ;find-wordend JSR2 .selection/to POK2 &no-adown
DUP #04 NEQ ,&no-aleft JNZ
DUP #04 NEQ ,&no-aleft JCN
( sel decr ) .selection/to PEK2 -- .selection/to POK2 &no-aleft
DUP #08 NEQ ,&no-aright JNZ
DUP #08 NEQ ,&no-aright JCN
( sel incr ) .selection/to PEK2 ++ .selection/to POK2 &no-aright
POP
;clamp-selection JSR2
@ -93,15 +93,15 @@ BRK
&no-alt
( ctrl + arrow )
.Controller/button DEI #0f AND #01 NEQ ,&no-ctrl JNZ
.Controller/button DEI #0f AND #01 NEQ ,&no-ctrl JCN
.Controller/button DEI #04 SFT
DUP #01 NEQ ,&no-cup JNZ
DUP #01 NEQ ,&no-cup JCN
( jump scroll ) #0004 ;scroll-up JSR2 &no-cup
DUP #02 NEQ ,&no-cdown JNZ
DUP #02 NEQ ,&no-cdown JCN
( jump scroll ) #0004 ;scroll-down JSR2 &no-cdown
DUP #04 NEQ ,&no-cleft JNZ
DUP #04 NEQ ,&no-cleft JCN
( jump line ) ;goto-linestart JSR2 &no-cleft
DUP #08 NEQ ,&no-cright JNZ
DUP #08 NEQ ,&no-cright JCN
( jump line ) ;goto-lineend JSR2 &no-cright
POP
;redraw JSR2
@ -109,20 +109,20 @@ BRK
&no-ctrl
( arrow )
.Controller/button DEI #f0 AND #00 EQU ;&no-arrow JNZ2
.Controller/button DEI #f0 AND #00 EQU ;&no-arrow JCN2
.Controller/button DEI #f0 AND
DUP #10 NEQ ,&no-arrowup JNZ
( clamp ) .position/y PEK2 #0000 EQU2 ,&no-arrowup JNZ
DUP #10 NEQ ,&no-arrowup JCN
( clamp ) .position/y PEK2 #0000 EQU2 ,&no-arrowup JCN
;find-lineoffset JSR2 .position/x POK2 .position/y PEK2 -- .position/y POK2
;find-selection JSR2 DUP2 .selection/from POK2 ++ .selection/to POK2 &no-arrowup
DUP #20 NEQ ,&no-arrowdown JNZ
DUP #20 NEQ ,&no-arrowdown JCN
( clamp:TODO )
;find-lineoffset JSR2 .position/x POK2 .position/y PEK2 ++ .position/y POK2
;find-selection JSR2 DUP2 .selection/from POK2 ++ .selection/to POK2 &no-arrowdown
DUP #40 NEQ ,&no-arrowleft JNZ
( clamp ) .selection/from PEK2 ;document/body EQU2 ,&no-arrowleft JNZ
DUP #40 NEQ ,&no-arrowleft JCN
( clamp ) .selection/from PEK2 ;document/body EQU2 ,&no-arrowleft JCN
.selection/from PEK2 -- DUP2 .selection/from POK2 ++ .selection/to POK2 &no-arrowleft
DUP #80 NEQ ,&no-arrowright JNZ
DUP #80 NEQ ,&no-arrowright JCN
( clamp:TODO )
#aa .Console/byte DEO
.selection/from PEK2 ++ DUP2 .selection/from POK2 ++ .selection/to POK2 &no-arrowright
@ -132,9 +132,9 @@ BRK
;redraw JSR2
&no-arrow
.Controller/key DEI #08 NEQ ,&no-backspace JNZ
.Controller/key DEI #08 NEQ ,&no-backspace JCN
( erase )
.selection/to PEK2 .selection/from PEK2 SUB2 #0001 NEQ2 ,&erase-multiple JNZ
.selection/to PEK2 .selection/from PEK2 SUB2 #0001 NEQ2 ,&erase-multiple JCN
.selection/to PEK2 .selection/from PEK2 SUB2 ;shift-left JSR2
;&erase-end JMP2
&erase-multiple
@ -158,9 +158,9 @@ BRK
@on-mouse ( -> )
.Mouse/state DEI #00 EQU ,&touch-end JNZ
.Mouse/x DEI2 #0010 LTH2 ;touch-linebar JNZ2
.Mouse/x DEI2 .Screen/width DEI2 8- LTH2 ;touch-body JNZ2
.Mouse/state DEI #00 EQU ,&touch-end JCN
.Mouse/x DEI2 #0010 LTH2 ;touch-linebar JCN2
.Mouse/x DEI2 .Screen/width DEI2 8- LTH2 ;touch-body JCN2
;touch-scrollbar JMP2
&touch-end
@ -186,18 +186,18 @@ BRK
.Mouse/y DEI2 8/ .scroll/y PEK2 ADD2 .position/y POK2
.Mouse/x DEI2 .textarea/x1 PEK2 SUB2 #0007 ADD2 #0007 DIV2 .position/x POK2
( chords )
.Mouse/chord DEI #00 EQU ,&no-chords JNZ
.Mouse/chord DEI #00 EQU ,&no-chords JCN
.Mouse/chord DEI
DUP #01 NEQ ,&no-chord-cut JNZ
DUP #01 NEQ ,&no-chord-cut JCN
;cut JSR2 ( release ) #00 DUP .Mouse/state DEO .Mouse/chord DEO &no-chord-cut
DUP #10 NEQ ,&no-chord-paste JNZ
DUP #10 NEQ ,&no-chord-paste JCN
;paste JSR2 ( release ) #00 DUP .Mouse/state DEO .Mouse/chord DEO &no-chord-paste
POP
;redraw JSR2
BRK
&no-chords
( drag )
.Mouse/state DEI .touch/state PEK NEQ .Controller/button DEI #0f AND #02 NEQ #0101 EQU2 ,&no-drag JNZ
.Mouse/state DEI .touch/state PEK NEQ .Controller/button DEI #0f AND #02 NEQ #0101 EQU2 ,&no-drag JCN
( on drag )
;find-selection JSR2 ++ .selection/to POK2
;clamp-selection JSR2
@ -214,11 +214,11 @@ BRK
@touch-scrollbar ( -- )
.Mouse/y DEI2 #0008 GTH2 ,&no-up JNZ
.Mouse/y DEI2 #0008 GTH2 ,&no-up JCN
( decr ) .scroll/y PEK2 #00 .scroll/y PEK2 #0000 NEQ2 SUB2 .scroll/y POK2
,&end JMP
&no-up
.Mouse/y DEI2 .Screen/height DEI2 8- LTH2 ,&no-down JNZ
.Mouse/y DEI2 .Screen/height DEI2 8- LTH2 ,&no-down JCN
( incr ) .scroll/y PEK2 ++ .scroll/y POK2
,&end JMP
&no-down
@ -237,13 +237,13 @@ BRK
;document/body ;document/eof STA2
&loop
( incr ) ;document/eof LDA2 ++ ;document/eof STA2
;document/eof LDA2 LDA #00 NEQ ,&loop JNZ
;document/eof LDA2 LDA #00 NEQ ,&loop JCN
RTN
@scroll-up ( length -- )
DUP2 .scroll/y PEK2 LTH2 ,&clamp JNZ
DUP2 .scroll/y PEK2 LTH2 ,&clamp JCN
#0000 .scroll/y POK2 POP2 RTN
&clamp
.scroll/y PEK2 SWP2 SUB2 .scroll/y POK2
@ -264,7 +264,7 @@ RTN
&loop
( move ) .j PEK2 .i PEK2 ADD2 LDA .j PEK2 STA
( incr ) .j PEK2 ++ .j POK2
.j PEK2 ;document/eof LDA2 LTH2 ,&loop JNZ
.j PEK2 ;document/eof LDA2 LTH2 ,&loop JCN
;document/eof LDA2 .i PEK2 SUB2 ;document/eof STA2
RTN
@ -276,17 +276,17 @@ RTN
&loop
( move ) .j PEK2 .i PEK2 SUB2 LDA .j PEK2 STA
( decr ) .j PEK2 -- .j POK2
.j PEK2 .selection/from PEK2 GTH2 ,&loop JNZ
.j PEK2 .selection/from PEK2 GTH2 ,&loop JCN
;document/eof LDA2 .i PEK2 ADD2 ;document/eof STA2
RTN
@follow-selection ( -- )
.position/y PEK2 .scroll/y PEK2 GTH2 ,&no-up JNZ
.position/y PEK2 .scroll/y PEK2 GTH2 ,&no-up JCN
.position/y PEK2 .scroll/y POK2 RTN
&no-up
.position/y PEK2 .Screen/height DEI2 #0010 SUB2 8/ .scroll/y PEK2 ADD2 LTH2 ,&no-down JNZ
.position/y PEK2 .Screen/height DEI2 #0010 SUB2 8/ .scroll/y PEK2 ADD2 LTH2 ,&no-down JCN
.position/y PEK2 .Screen/height DEI2 #0010 SUB2 8/ SUB2 .scroll/y POK2 RTN
&no-down
@ -305,7 +305,7 @@ RTN
.selection/from PEK2 -- LDA #0a EQU RTN?
.selection/from PEK2 -- LDA #0d EQU RTN?
( decr ) .selection/from PEK2 DUP2 .selection/to POK2 -- .selection/from POK2
.selection/from PEK2 LDA #00 NEQ ,&loop JNZ
.selection/from PEK2 LDA #00 NEQ ,&loop JCN
( clamp at document body )
.selection/from PEK2 ;document/body GTH2 RTN?
;document/body DUP2 .selection/from POK2 ++ .selection/to POK2
@ -318,7 +318,7 @@ RTN
.selection/from PEK2 LDA #0a EQU RTN?
.selection/from PEK2 LDA #0d EQU RTN?
( incr ) .selection/from PEK2 ++ DUP2 ++ .selection/to POK2 .selection/from POK2
.selection/from PEK2 LDA #00 NEQ ,&loop JNZ
.selection/from PEK2 LDA #00 NEQ ,&loop JCN
( clamp at document body )
.selection/from PEK2 ;document/eof LTH2 RTN?
;document/eof -- DUP2 .selection/from POK2 ++ .selection/to POK2
@ -330,10 +330,10 @@ RTN
.selection/to PEK2 .j POK2
&loop
( decr ) .j PEK2 -- .j POK2
.j PEK2 LDA #20 EQU ,&end JNZ
.j PEK2 LDA #0a EQU ,&end JNZ
.j PEK2 LDA #0d EQU ,&end JNZ
.j PEK2 ;document/body GTH2 ,&loop JNZ
.j PEK2 LDA #20 EQU ,&end JCN
.j PEK2 LDA #0a EQU ,&end JCN
.j PEK2 LDA #0d EQU ,&end JCN
.j PEK2 ;document/body GTH2 ,&loop JCN
&end
( return ) .j PEK2 --
@ -344,10 +344,10 @@ RTN
.selection/to PEK2 .j POK2
&loop
( incr ) .j PEK2 ++ .j POK2
.j PEK2 LDA #20 EQU ,&end JNZ
.j PEK2 LDA #0a EQU ,&end JNZ
.j PEK2 LDA #0d EQU ,&end JNZ
.j PEK2 ;document/body GTH2 ,&loop JNZ
.j PEK2 LDA #20 EQU ,&end JCN
.j PEK2 LDA #0a EQU ,&end JCN
.j PEK2 LDA #0d EQU ,&end JCN
.j PEK2 ;document/body GTH2 ,&loop JCN
&end
( return ) .j PEK2 ++
@ -358,9 +358,9 @@ RTN
#0000 .j POK2
&loop
( incr ) .j PEK2 ++ .j POK2
.selection/from PEK2 .j PEK2 SUB2 LDA #0a EQU ,&end JNZ
.selection/from PEK2 .j PEK2 SUB2 LDA #0d EQU ,&end JNZ
.selection/from PEK2 .j PEK2 SUB2 ;document/body GTH2 ,&loop JNZ
.selection/from PEK2 .j PEK2 SUB2 LDA #0a EQU ,&end JCN
.selection/from PEK2 .j PEK2 SUB2 LDA #0d EQU ,&end JCN
.selection/from PEK2 .j PEK2 SUB2 ;document/body GTH2 ,&loop JCN
&end
( return ) .j PEK2
@ -370,12 +370,12 @@ RTN
;document/body .j POK2 #0000 .pt/y POK2
&loop
.pt/y PEK2 .position/y PEK2 -- GTH2 ,&end JNZ
.j PEK2 LDA #0a NEQ .j PEK2 LDA #0d NEQ #0101 EQU2 ,&no-space JNZ
.pt/y PEK2 .position/y PEK2 -- GTH2 ,&end JCN
.j PEK2 LDA #0a NEQ .j PEK2 LDA #0d NEQ #0101 EQU2 ,&no-space JCN
( incr ) .pt/y PEK2 ++ .pt/y POK2
&no-space
( incr ) .j PEK2 ++ .j POK2
.j PEK2 LDA #00 NEQ ,&loop JNZ
.j PEK2 LDA #00 NEQ ,&loop JCN
&end
( return ) .j PEK2
@ -386,10 +386,10 @@ RTN
;find-line JSR2 ( find line )
#0000 .pt/x POK2
&loop
.j PEK2 .pt/x PEK2 ADD2 LDA #0a EQU ,&end JNZ
.j PEK2 .pt/x PEK2 ADD2 LDA #0d EQU ,&end JNZ
.j PEK2 .pt/x PEK2 ADD2 LDA #0a EQU ,&end JCN
.j PEK2 .pt/x PEK2 ADD2 LDA #0d EQU ,&end JCN
( incr ) .pt/x PEK2 ++ .pt/x POK2
.pt/x PEK2 .position/x PEK2 -- LTH2 ,&loop JNZ
.pt/x PEK2 .position/x PEK2 -- LTH2 ,&loop JCN
&end
( return ) .pt/x PEK2 ADD2
@ -411,7 +411,7 @@ RTN
&loop
.selection/from PEK2 .i PEK2 ADD2 LDA ;clip/body .i PEK2 ADD2 STA
( incr ) .i PEK2 ++ .i POK2
.i PEK2 .j PEK2 LTH2 ,&loop JNZ
.i PEK2 .j PEK2 LTH2 ,&loop JCN
RTN
@ -423,7 +423,7 @@ RTN
&loop
;clip/body .i PEK2 ADD2 LDA .selection/from PEK2 .i PEK2 ADD2 STA
( incr ) .i PEK2 ++ .i POK2
.i PEK2 .j PEK2 LTH2 ,&loop JNZ
.i PEK2 .j PEK2 LTH2 ,&loop JCN
RTN
@ -431,17 +431,17 @@ RTN
;document/body .selection/from POK2 #0000 .pt/x POK2 #0000 .pt/y POK2
&loop
.selection/from PEK2 LDA #0a NEQ .selection/from PEK2 LDA #0d NEQ #0101 EQU2 ,&no-space JNZ
.selection/from PEK2 LDA #0a NEQ .selection/from PEK2 LDA #0d NEQ #0101 EQU2 ,&no-space JCN
( incr ) .pt/y PEK2 ++ .pt/y POK2
#0000 .pt/x POK2
&no-space
.pt/y PEK2 .position/y PEK2 -- GTH2 .pt/x PEK2 .position/x PEK2 -- GTH2 #0101 NEQ2 ,&no-reached JNZ
.pt/y PEK2 .position/y PEK2 -- GTH2 .pt/x PEK2 .position/x PEK2 -- GTH2 #0101 NEQ2 ,&no-reached JCN
.selection/from PEK2 ++ .selection/to POK2
RTN
&no-reached
( incr ) .pt/x PEK2 ++ .pt/x POK2
( incr ) .selection/from PEK2 ++ .selection/from POK2
.selection/from PEK2 LDA #00 NEQ ,&loop JNZ
.selection/from PEK2 LDA #00 NEQ ,&loop JCN
RTN
@ -518,11 +518,11 @@ RTN
( scroll to position )
#0000 .j POK2 ( j is linebreaks )
&find-offset
.scroll/y PEK2 .j PEK2 EQU2 ,&find-offset-end JNZ
.textarea/addr PEK2 LDA #0a NEQ .textarea/addr PEK2 LDA #0d NEQ #0101 EQU2 ,&no-break JNZ
.scroll/y PEK2 .j PEK2 EQU2 ,&find-offset-end JCN
.textarea/addr PEK2 LDA #0a NEQ .textarea/addr PEK2 LDA #0d NEQ #0101 EQU2 ,&no-break JCN
( incr ) .j PEK2 ++ .j POK2 &no-break
( incr ) .textarea/addr PEK2 ++ .textarea/addr POK2
.textarea/addr PEK2 LDA #00 NEQ ,&find-offset JNZ
.textarea/addr PEK2 LDA #00 NEQ ,&find-offset JCN
&find-offset-end
#0018 .Screen/x DEO2 #0000 .Screen/y DEO2
@ -530,10 +530,10 @@ RTN
&loop
.Screen/y DEI2 .Screen/height DEI2 #0010 SUB2 GTH2 ;&end JNZ2
.Screen/y DEI2 .Screen/height DEI2 #0010 SUB2 GTH2 ;&end JCN2
.i PEK2 LDA #0a NEQ .i PEK2 LDA #0d NEQ #0101 EQU2 ;&no-linebreak JNZ2
.i PEK2 LDA #0a NEQ .i PEK2 LDA #0d NEQ #0101 EQU2 ;&no-linebreak JCN2
( draw linebreak )
;linebreak_icn .Screen/addr DEO2
( draw ) #02
@ -545,7 +545,7 @@ RTN
( incr ) .Screen/x DEI2 8+ .Screen/x DEO2
;font .Screen/addr DEO2
#21 .Screen/color DEO
.Screen/x DEI2 .Screen/width DEI2 8- LTH2 ,&fill-clear JNZ
.Screen/x DEI2 .Screen/width DEI2 8- LTH2 ,&fill-clear JCN
( draw line number )
#0000 .Screen/x DEO2
@ -565,7 +565,7 @@ RTN
( get character )
;font #00 .i PEK2 LDA #20 SUB 8* ADD2 .Screen/addr DEO2
( is a special character )
.i PEK2 LDA #20 GTH ,&no-tab JNZ ;font .Screen/addr DEO2 &no-tab
.i PEK2 LDA #20 GTH ,&no-tab JCN ;font .Screen/addr DEO2 &no-tab
( draw ) #21
.i PEK2 .selection/from PEK2 -- GTH2
@ -575,7 +575,7 @@ RTN
( incr ) .i PEK2 ++ .i POK2
( incr ) .Screen/x DEI2 #0007 ADD2 .Screen/x DEO2
.i PEK2 LDA #00 NEQ ;&loop JNZ2
.i PEK2 LDA #00 NEQ ;&loop JCN2
&end
@ -593,7 +593,7 @@ RTN
&loop
( draw ) #21 .Screen/color DEO
( incr ) SWP2 8+ DUP2 .Screen/y DEO2 SWP2
OVR2 OVR2 LTH2 ,&loop JNZ
OVR2 OVR2 LTH2 ,&loop JCN
POP2 POP2
.scroll/y PEK2 8+ .Screen/y DEO2
@ -619,7 +619,7 @@ RTN
( draw ) DUP2 LDA #00 SWP #20 SUB 8* ;font ADD2 .Screen/addr DEO2 .label/color PEK .Screen/color DEO
( incr ) ++
( incr ) .Screen/x DEI2 8+ .Screen/x DEO2
DUP2 LDA #00 NEQ ,&loop JNZ
DUP2 LDA #00 NEQ ,&loop JCN
POP2
( selection )
.selection/from PEK2 ;document/body SUB2 ;draw-short JSR2

View File

@ -148,26 +148,26 @@ BRK
@on-button ( -> )
( skip ) .Controller/button DEI #00 NEQ #01 JNZ [ BRK ]
( skip ) .Controller/button DEI #00 NEQ #01 JCN [ BRK ]
.Controller/button DEI #11 NEQ ,&no-pageup JNZ .settings/page PEK2
.Controller/button DEI #11 NEQ ,&no-pageup JCN .settings/page PEK2
#0800 SUB2 .settings/page POK2
;redraw JSR2
BRK &no-pageup
.Controller/button DEI #21 NEQ ,&no-pagedown JNZ .settings/page PEK2
.Controller/button DEI #21 NEQ ,&no-pagedown JCN .settings/page PEK2
#0800 ADD2 .settings/page POK2
;redraw JSR2
BRK &no-pagedown
.Controller/button DEI #f0 AND
DUP #04 SFT #01 AND #01 NEQ ,&no-up JNZ
DUP #04 SFT #01 AND #01 NEQ ,&no-up JCN
( move ) .bankview/selection PEK #10 SUB .bankview/selection POK &no-up
DUP #05 SFT #01 AND #01 NEQ ,&no-down JNZ
DUP #05 SFT #01 AND #01 NEQ ,&no-down JCN
( move ) .bankview/selection PEK #10 ADD .bankview/selection POK &no-down
DUP #06 SFT #01 AND #01 NEQ ,&no-left JNZ
DUP #06 SFT #01 AND #01 NEQ ,&no-left JCN
( move ) .bankview/selection PEK #01 SUB .bankview/selection POK &no-left
DUP #07 SFT #01 AND #01 NEQ ,&no-right JNZ
DUP #07 SFT #01 AND #01 NEQ ,&no-right JCN
( move ) .bankview/selection PEK #01 ADD .bankview/selection POK &no-right
POP
@ -179,16 +179,16 @@ BRK
;draw-cursor JSR2
( skip ) .Mouse/state DEI #00 NEQ #01 JNZ [ BRK ]
( skip ) .Mouse/state DEI #00 NEQ #01 JCN [ BRK ]
( toolbar )
.Mouse/y DEI2 .bankview/y PEK2 #0010 SUB2 SUB2 #0008 DIV2 #0000 NEQ2 ;&no-toolbar-click JNZ2
.Mouse/y DEI2 .bankview/y PEK2 #0010 SUB2 SUB2 #0008 DIV2 #0000 NEQ2 ;&no-toolbar-click JCN2
( brush )
.Mouse/x DEI2 .bankview/x PEK2 SUB2 #0008 DIV2 #000d LTH2 ,&no-brush-click JNZ
.Mouse/x DEI2 .bankview/x PEK2 SUB2 #0008 DIV2 #000f GTH2 ,&no-brush-click JNZ
.Mouse/x DEI2 .bankview/x PEK2 SUB2 #0008 DIV2 #000d LTH2 ,&no-brush-click JCN
.Mouse/x DEI2 .bankview/x PEK2 SUB2 #0008 DIV2 #000f GTH2 ,&no-brush-click JCN
( select ) .mouse/x PEK2 .bankview/x PEK2 SUB2 #0008 DIV2 #000d SUB2 TOB .bankview/mode POK
&no-brush-click
.Mouse/x DEI2 .bankview/x PEK2 SUB2 #0008 DIV2 #0005 NEQ2 ,&no-toggle-depth JNZ
.Mouse/x DEI2 .bankview/x PEK2 SUB2 #0008 DIV2 #0005 NEQ2 ,&no-toggle-depth JCN
;toggle-depth JSR2
&no-toggle-depth
( release ) #00 .Mouse/state DEO
@ -198,43 +198,43 @@ BRK
( bankview )
.Mouse/x DEI2 .bankview/x PEK2 GTH2 .Mouse/x DEI2 .bankview/x PEK2 #0080 ADD2 LTH2 #0101 EQU2
.Mouse/y DEI2 .bankview/y PEK2 GTH2 .Mouse/y DEI2 .bankview/y PEK2 #0080 ADD2 LTH2 #0101 EQU2
#0101 EQU2 ;on-touch-bankview JNZ2
#0101 EQU2 ;on-touch-bankview JCN2
( tileview )
.Mouse/x DEI2 .tileview/x PEK2 GTH2 .Mouse/x DEI2 .tileview/x PEK2 #0080 ADD2 LTH2 #0101 EQU2
.Mouse/y DEI2 .tileview/y PEK2 GTH2 .Mouse/y DEI2 .tileview/y PEK2 #0080 ADD2 LTH2 #0101 EQU2
#0101 EQU2 ;on-touch-tileview JNZ2
#0101 EQU2 ;on-touch-tileview JCN2
( editview )
.Mouse/x DEI2 DUP2 .editview/x1 PEK2 GTH2 ROT ROT .editview/x2 PEK2 LTH2 #0101 EQU2
.Mouse/y DEI2 DUP2 .editview/y1 PEK2 GTH2 ROT ROT .editview/y2 PEK2 LTH2 #0101 EQU2
#0101 EQU2 ;on-touch-editview JNZ2
#0101 EQU2 ;on-touch-editview JCN2
( dataview )
.Mouse/x DEI2 DUP2 .dataview/x1 PEK2 GTH2 ROT ROT .dataview/x2 PEK2 LTH2 #0101 EQU2
.Mouse/y DEI2 DUP2 .dataview/y1 PEK2 GTH2 ROT ROT .dataview/y2 PEK2 LTH2 #0101 EQU2
#0101 EQU2 ;on-touch-dataview JNZ2
#0101 EQU2 ;on-touch-dataview JCN2
( blendbiew )
.Mouse/x DEI2 DUP2 .blendview/x1 PEK2 GTH2 ROT ROT .blendview/x2 PEK2 LTH2 #0101 EQU2
.Mouse/y DEI2 DUP2 .blendview/y1 PEK2 GTH2 ROT ROT .blendview/y2 PEK2 LTH2 #0101 EQU2
#0101 EQU2 ;on-touch-blendview JNZ2
#0101 EQU2 ;on-touch-blendview JCN2
( colorview )
.Mouse/x DEI2 DUP2 .colorview/x1 PEK2 GTH2 ROT ROT .colorview/x2 PEK2 LTH2 #0101 EQU2
.Mouse/y DEI2 DUP2 .colorview/y1 PEK2 GTH2 ROT ROT .colorview/y2 PEK2 LTH2 #0101 EQU2
#0101 EQU2 ;on-touch-colorview JNZ2
#0101 EQU2 ;on-touch-colorview JCN2
( preview )
.Mouse/x DEI2 DUP2 .preview/x1 PEK2 GTH2 ROT ROT .preview/x2 PEK2 LTH2 #0101 EQU2
.Mouse/y DEI2 DUP2 .preview/y1 PEK2 GTH2 ROT ROT .preview/y2 PEK2 LTH2 #0101 EQU2
#0101 EQU2 ;on-touch-preview JNZ2
#0101 EQU2 ;on-touch-preview JCN2
BRK
@on-touch-bankview ( -> )
.bankview/mode PEK #01 NEQ ,&not-copy-mode JNZ
.bankview/mode PEK #01 NEQ ,&not-copy-mode JCN
#00 .i POK
&copy-loop
( load ) .settings/tile PEK2 .i PEK ADD LDA
@ -244,11 +244,11 @@ BRK
( 2-bit mode ) #00 .settings/depth PEK #01 ADD MUL2
.settings/page PEK2 ADD2 #00 .i PEK ADD2 STA
( incr ) .i PEK #01 ADD .i POK
.i PEK #08 LTH ,&copy-loop JNZ
.i PEK #08 LTH ,&copy-loop JCN
;redraw JSR2 BRK
&not-copy-mode
.bankview/mode PEK #02 NEQ ,&not-erase-mode JNZ
.bankview/mode PEK #02 NEQ ,&not-erase-mode JCN
#00 .i POK
&erase-loop
#00
@ -258,7 +258,7 @@ BRK
( 2-bit mode ) #00 .settings/depth PEK #01 ADD MUL2
.settings/page PEK2 ADD2 #00 .i PEK ADD2 STA
( incr ) .i PEK #01 ADD .i POK
.i PEK #08 LTH ,&erase-loop JNZ
.i PEK #08 LTH ,&erase-loop JCN
;redraw JSR2 BRK
&not-erase-mode
@ -284,13 +284,13 @@ BRK
@on-touch-dataview ( -> )
.Mouse/y DEI2 .dataview/y1 PEK2 SUB2 STEP8 TOB #60 EQU ,&skip JNZ BRK &skip
.Mouse/y DEI2 .dataview/y1 PEK2 SUB2 STEP8 TOB #60 EQU ,&skip JCN BRK &skip
.Mouse/x DEI2 .dataview/x1 PEK2 SUB2 #0008 DIV2 TOB
DUP #00 NEQ ,&no-move-up JNZ
DUP #00 NEQ ,&no-move-up JCN
;op_shiftup JSR2
( release ) #00 .Mouse/state DEO
;redraw JSR2 POP BRK &no-move-up
DUP #01 NEQ ,&no-move-down JNZ
DUP #01 NEQ ,&no-move-down JCN
;op_shiftdown JSR2
( release ) #00 .Mouse/state DEO
;redraw JSR2 POP BRK &no-move-down
@ -312,13 +312,13 @@ BRK
( channel ) .Mouse/y DEI2 .colorview/y1 PEK2 SUB2 #0008 DIV2 TOB STH
( rgb ) .Mouse/x DEI2 .colorview/x1 PEK2 SUB2 #0008 DIV2 TOB
DUP #00 NEQ ,&no-brush JNZ
DUP #00 NEQ ,&no-brush JCN
DUPr STHr .settings/brush POK &no-brush
DUP #01 NEQ ,&no-red JNZ
DUP #01 NEQ ,&no-red JCN
DUPr STHr .System/r ;set-color JSR2 &no-red
DUP #02 NEQ ,&no-green JNZ
DUP #02 NEQ ,&no-green JCN
DUPr STHr .System/g ;set-color JSR2 &no-green
DUP #03 NEQ ,&no-blue JNZ
DUP #03 NEQ ,&no-blue JCN
DUPr STHr .System/b ;set-color JSR2 &no-blue
POP POPr
( release ) #00 .Mouse/state DEO
@ -342,22 +342,22 @@ BRK
@set-color ( color rgb -- )
STH
DUP #00 NEQ ,&no-red0 JNZ
DUP #00 NEQ ,&no-red0 JCN
DUPr STHr DEI DUP #04 SFT #01 ADD
( add/sub ) .Mouse/state DEI #10 EQU #fe MUL ADD
( resume ) #40 SFT SWP #0f AND ADD DUPr STHr DEO
&no-red0
DUP #01 NEQ ,&no-red1 JNZ
DUP #01 NEQ ,&no-red1 JCN
DUPr STHr DEI DUP #0f AND #01 ADD
( add/sub ) .Mouse/state DEI #10 EQU #fe MUL ADD
( resume ) #0f AND SWP #f0 AND ADD DUPr STHr DEO
&no-red1
DUP #02 NEQ ,&no-red2 JNZ
DUP #02 NEQ ,&no-red2 JCN
DUPr STHr #01 ADD DEI DUP #04 SFT #01 ADD
( add/sub ) .Mouse/state DEI #10 EQU #fe MUL ADD
( resume ) #40 SFT SWP #0f AND ADD DUPr STHr #01 ADD DEO
&no-red2
DUP #03 NEQ ,&no-red3 JNZ
DUP #03 NEQ ,&no-red3 JCN
DUPr STHr #01 ADD DEI DUP #0f AND #01 ADD
( add/sub ) .Mouse/state DEI #10 EQU #fe MUL ADD
( resume ) #0f AND SWP #f0 AND ADD DUPr STHr #01 ADD DEO
@ -466,7 +466,7 @@ RTN
.Screen/addr DEI2 #0008 ADD2 .Screen/addr DEO2
.Screen/y DEI2 #0008 ADD2 .Screen/y DEO2
SWP #01 ADD SWP
DUP2 LTH ,&guides JNZ
DUP2 LTH ,&guides JCN
POP2
( draw page )
@ -484,10 +484,10 @@ RTN
( draw ) #20 ADD ADD ADD .Screen/color DEO
( incr ) SWP2 #0008 ADD2 SWP2
( incr ) .Screen/addr DEI2 #0008 ADD2 #00 .settings/depth PEK #0008 MUL2 ADD2 .Screen/addr DEO2
OVR2 OVR2 LTH2 ,&hor JNZ
OVR2 OVR2 LTH2 ,&hor JCN
POP2 POP2
( incr ) SWP2 #0008 ADD2 SWP2
OVR2 OVR2 LTH2 ,&ver JNZ
OVR2 OVR2 LTH2 ,&ver JCN
POP2 POP2
RTN
@ -538,7 +538,7 @@ RTN
&line-hor
( draw ) #03 .Screen/color DEO
( incr ) .Screen/x DEI2 #0002 ADD2 .Screen/x DEO2
.Screen/x DEI2 .tileview/x PEK2 #0082 ADD2 LTH2 ,&line-hor JNZ
.Screen/x DEI2 .tileview/x PEK2 #0082 ADD2 LTH2 ,&line-hor JCN
( line ver )
.tileview/y PEK2 .Screen/y DEO2
@ -546,7 +546,7 @@ RTN
&line-ver
( draw ) #03 .Screen/color DEO
( incr ) .Screen/y DEI2 #0002 ADD2 .Screen/y DEO2
.Screen/y DEI2 .tileview/y PEK2 #0081 ADD2 LTH2 ,&line-ver JNZ
.Screen/y DEI2 .tileview/y PEK2 #0081 ADD2 LTH2 ,&line-ver JCN
( rewind ) .settings/tile PEK2 #0018 SUB2 .settings/tile POK2
@ -575,7 +575,7 @@ RTN
( check if within ratio )
.settings/ratio PEK #0f AND LTH STH
.settings/ratio PEK #04 SFT LTH STHr
#0101 NEQ2 ,&outside JNZ
#0101 NEQ2 ,&outside JCN
( get tile ) DUP2r STH2r .Screen/addr DEO2
@ -590,10 +590,10 @@ RTN
#00 ;draw-tile JSR2
&resume
( incr ) SWP #01 ADD SWP
DUP2 LTH ,&hor JNZ
DUP2 LTH ,&hor JCN
POP2
( incr ) SWP #01 ADD SWP
DUP2 LTH ;&ver JNZ2
DUP2 LTH ;&ver JCN2
POP2
POP2r
@ -637,12 +637,12 @@ RTN
#0001 .Screen/x DEI2 ADD2 .Screen/x DEO2
( incr ) SWP #01 ADD SWP
DUP2 LTH ,&hor JNZ
DUP2 LTH ,&hor JCN
POP2
#0001 .Screen/y DEI2 ADD2 .Screen/y DEO2
.Screen/x DEI2 #0020 SUB2 .Screen/x DEO2
( incr ) SWP #01 ADD SWP
DUP2 LTH ,&ver JNZ
DUP2 LTH ,&ver JCN
POP2
.Screen/y DEI2 #0020 SUB2 .Screen/y DEO2
POPr
@ -662,11 +662,11 @@ RTN
( draw ) #21 .Screen/color DEO
( incr ) .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
( incr ) .pt/x PEK #01 ADD .pt/x POK
.pt/x PEK #08 LTH ;&hor JNZ2
.pt/x PEK #08 LTH ;&hor JCN2
( incr ) .Screen/y DEI2 #0008 ADD2 .Screen/y DEO2
( incr ) .pt/y PEK #01 ADD .pt/y POK
.Screen/x DEI2 #0040 SUB2 .Screen/x DEO2
.pt/y PEK #08 LTH ;&ver JNZ2
.pt/y PEK #08 LTH ;&ver JCN2
RTN
@ -682,7 +682,7 @@ RTN
#20 .Screen/color DEO
OVR #20 ADD .settings/depth PEK #20 MUL ADD .Screen/color DEO
SWP #01 ADD SWP
DUP2 LTH ,&loop JNZ
DUP2 LTH ,&loop JCN
POP2
.blendview/x1 PEK2 .Screen/x DEO2
@ -704,7 +704,7 @@ RTN
.settings/tile PEK2 #00 .i PEK ADD2 LDA #22 ;draw-byte JSR2
( incr ) .i PEK #01 ADD .i POK
( incr ) .Screen/y DEI2 #0008 ADD2 .Screen/y DEO2
.i PEK #08 LTH ;&bytes JNZ2
.i PEK #08 LTH ;&bytes JCN2
( operations )
@ -727,10 +727,10 @@ RTN
( incr ) .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
( incr ) .Screen/addr DEI2 #0008 ADD2 .Screen/addr DEO2
( incr ) .pt/x PEK #01 ADD .pt/x POK
.pt/x PEK #02 LTH ;&tiles-hor JNZ2
.pt/x PEK #02 LTH ;&tiles-hor JCN2
( incr ) .pt/y PEK #01 ADD .pt/y POK
( incr ) .Screen/y DEI2 #0008 ADD2 .Screen/y DEO2
.pt/y PEK #02 LTH ;&tiles-ver JNZ2
.pt/y PEK #02 LTH ;&tiles-ver JCN2
RTN
@ -755,7 +755,7 @@ RTN
OVR .colorview/y1 PEK2 ROT #00 SWP #0008 MUL2 ADD2 .Screen/y DEO2
OVR #20 ADD .Screen/color DEO
SWP #01 ADD SWP
DUP2 LTH ,&loop JNZ
DUP2 LTH ,&loop JCN
POP2
RTN
@ -775,7 +775,7 @@ RTN
( check if within ratio )
.settings/ratio PEK #0f AND LTH STH
.settings/ratio PEK #04 SFT LTH STHr
#0101 NEQ2 ,&outside JNZ
#0101 NEQ2 ,&outside JCN
( get tile ) DUP2r STH2r .Screen/addr DEO2
( get blending ) .settings/blending PEK
( get depth ) .settings/depth PEK #20 MUL
@ -787,10 +787,10 @@ RTN
#23 .Screen/color DEO
&resume
( incr ) SWP #01 ADD SWP
DUP2 LTH ,&hor JNZ
DUP2 LTH ,&hor JCN
POP2
( incr ) SWP #01 ADD SWP
DUP2 LTH ;&ver JNZ2
DUP2 LTH ;&ver JCN2
POP2
POP2r
.preview/x1 PEK2 #0001 SUB2 .Screen/x DEO2
@ -873,7 +873,7 @@ RTN
( draw ) .rect/x1 PEK2 .Screen/x DEO2 .color PEK DUP .Screen/color DEO
( draw ) .rect/x2 PEK2 .Screen/x DEO2 .Screen/color DEO
( incr ) SWP2 #0001 ADD2 SWP2
OVR2 OVR2 LTS2 ,&ver JNZ
OVR2 OVR2 LTS2 ,&ver JCN
POP2 POP2
.rect/x1 PEK2 .rect/x2 PEK2
&hor
@ -881,7 +881,7 @@ RTN
( draw ) .rect/y1 PEK2 .Screen/y DEO2 .color PEK DUP .Screen/color DEO
( draw ) .rect/y2 PEK2 .Screen/y DEO2 .Screen/color DEO
( incr ) SWP2 #0001 ADD2 SWP2
OVR2 OVR2 #0001 ADD2 LTS2 ,&hor JNZ
OVR2 OVR2 #0001 ADD2 LTS2 ,&hor JCN
POP2 POP2
RTN
@ -893,7 +893,7 @@ RTN
( save ) OVR2 .Screen/x DEO2
( draw ) DUPr STHr .Screen/color DEO
( incr ) SWP2 #0002 ADD2 SWP2
OVR2 OVR2 LTH2 ,&loop JNZ
OVR2 OVR2 LTH2 ,&loop JCN
POP2 POP2 POPr
RTN
@ -905,7 +905,7 @@ RTN
( save ) OVR2 .Screen/y DEO2
( draw ) DUPr STHr .Screen/color DEO
( incr ) SWP2 #0002 ADD2 SWP2
OVR2 OVR2 LTH2 ,&loop JNZ
OVR2 OVR2 LTH2 ,&loop JCN
POP2 POP2 POPr
RTN

View File

@ -151,7 +151,7 @@
&h ( number* -- )
,scale JSR
.neralie/h PEK2 ;mul2hi JSR2
DUP2 #0000 NEQ2 #02 JNZ POP2 JMP2r
DUP2 #0000 NEQ2 #02 JCN POP2 JMP2r
DUP2 .neralie/y PEK2 ADD2 .neralie/y POK2
.neralie/h PEK2 SWP2 SUB2 .neralie/h POK2
.neralie/x PEK2 DUP2 .neralie/w PEK2 ADD2 .neralie/y PEK2 ,h JMP
@ -159,7 +159,7 @@
&v ( number* -- )
,scale JSR
.neralie/w PEK2 ;mul2hi JSR2
DUP2 #0000 NEQ2 #02 JNZ POP2 JMP2r
DUP2 #0000 NEQ2 #02 JCN POP2 JMP2r
DUP2 .neralie/x PEK2 ADD2 .neralie/x POK2
.neralie/w PEK2 SWP2 SUB2 .neralie/w POK2
.neralie/y PEK2 DUP2 .neralie/h PEK2 ADD2 .neralie/x PEK2 ,v JMP
@ -179,12 +179,12 @@
.Screen/y .lines/addr POK
&draw-line ( v1* v2* -- )
OVR2 OVR2 LTH2 #01 JNZ SWP2
OVR2 OVR2 LTH2 #01 JCN SWP2
STH2
&loop
LIT2 [ 00 ] &spacing [ 01 ] ADD2
DUP2 DUP2r STH2r LTH2 ,&keep-going JNZ
DUP2 DUP2r STH2r LTH2 ,&keep-going JCN
POP2 POP2r
JMP2r
@ -239,7 +239,7 @@
&adc ( 31..24 a* b* -- 31..24 sum* )
OVR2 ADD2 SWP2 OVR2
GTH2 ,&carry JNZ
GTH2 ,&carry JCN
JMP2r
&carry
ROT #01 ADD ROT ROT

View File

@ -14,7 +14,7 @@
)
%RTN { JMP2r }
%ABS2 { DUP2 #000f SFT2 EQU #04 JNZ #ffff MUL2 }
%ABS2 { DUP2 #000f SFT2 EQU #04 JCN #ffff MUL2 }
%LTS2 { #8000 ADD2 SWP2 #8000 ADD2 GTH2 }
%GTS2 { #8000 ADD2 SWP2 #8000 ADD2 LTH2 }
%CLN2r { DUP2 STH2 }
@ -100,14 +100,14 @@ BRK
@on-screen ( -> )
.document/edit PEK #01 NEQ ,&no-edit JNZ
.document/edit PEK #01 NEQ ,&no-edit JCN
#0008 .Screen/x DEO2
.Screen/height DEI2 #0010 SUB2 .Screen/y DEO2
;path/name #01 .timer PEK #04 DIV #03 AND #03 MUL ADD ;draw-label JSR2
&clear
#20 .Screen/color DEO
.Screen/x DEI2 8+ DUP2 .Screen/x DEO2
.Screen/width DEI2 LTH2 ,&clear JNZ
.Screen/width DEI2 LTH2 ,&clear JCN
( blink ) .timer PEK #01 ADD .timer POK
&no-edit
@ -118,7 +118,7 @@ BRK
;draw-cursor JSR2
( release drag )
.Mouse/state DEI #00 EQU .brush/drag PEK #01 EQU #0101 NEQ2 ,&no-release JNZ
.Mouse/state DEI #00 EQU .brush/drag PEK #01 EQU #0101 NEQ2 ,&no-release JCN
.origin/x1 PEK2 #0002 SUB2 .origin/y1 PEK2 #0002 SUB2 .origin/x2 PEK2 #0002 ADD2 .origin/y2 PEK2 #0002 ADD2 #00 ;fill-rect JSR2
.canvas/x1 PEK2 -- .canvas/y1 PEK2 -- .canvas/x2 PEK2 .canvas/y2 PEK2 #10 ;line-rect JSR2
;draw-background JSR2
@ -128,32 +128,32 @@ BRK
&no-release
( operations on release line/rect )
.Mouse/state DEI .brush/last PEK EQU ;&no-touch-change JNZ2
.Mouse/x DEI2 CLN2r .canvas/x1 PEK2 GTS2 STH2r .canvas/x2 PEK2 LTS2 #0101 NEQ2 ;&no-touch-change JNZ2
.Mouse/y DEI2 CLN2r .canvas/y1 PEK2 GTS2 STH2r .canvas/y2 PEK2 LTS2 #0101 NEQ2 ;&no-touch-change JNZ2
.Mouse/state DEI #00 EQU ,&no-touch-ondown JNZ
.Mouse/state DEI .brush/last PEK EQU ;&no-touch-change JCN2
.Mouse/x DEI2 CLN2r .canvas/x1 PEK2 GTS2 STH2r .canvas/x2 PEK2 LTS2 #0101 NEQ2 ;&no-touch-change JCN2
.Mouse/y DEI2 CLN2r .canvas/y1 PEK2 GTS2 STH2r .canvas/y2 PEK2 LTS2 #0101 NEQ2 ;&no-touch-change JCN2
.Mouse/state DEI #00 EQU ,&no-touch-ondown JCN
( on down )
.Mouse/x DEI2 .cursor/dx POK2
.Mouse/y DEI2 .cursor/dy POK2
&no-touch-ondown
.Mouse/state DEI #00 NEQ ,&no-touch-onup JNZ
.Mouse/state DEI #00 NEQ ,&no-touch-onup JCN
( on up )
.brush/tool PEK #02 NEQ ,&no-touch-line JNZ
.brush/tool PEK #02 NEQ ,&no-touch-line JCN
.cursor/dx PEK2 .canvas/x1 PEK2 SUB2 .cursor/dy PEK2 .canvas/y1 PEK2 SUB2 .Mouse/x DEI2 .canvas/x1 PEK2 SUB2 .Mouse/y DEI2 .canvas/y1 PEK2 SUB2 ;paint-line JSR2
;&touch-end JMP2
&no-touch-line
.brush/tool PEK #03 NEQ ,&no-touch-rect JNZ
.brush/tool PEK #03 NEQ ,&no-touch-rect JCN
.cursor/dx PEK2 .canvas/x1 PEK2 SUB2 .cursor/dy PEK2 .canvas/y1 PEK2 SUB2 .Mouse/x DEI2 .canvas/x1 PEK2 SUB2 .Mouse/y DEI2 .canvas/y1 PEK2 SUB2 ;paint-rect JSR2
;&touch-end JMP2
&no-touch-rect
&no-touch-onup
&no-touch-change
.Mouse/state DEI #00 EQU ;&no-touch JNZ2
.Mouse/state DEI #00 EQU ;&no-touch JCN2
( drag )
.Controller/button DEI #02 NEQ ;&no-drag JNZ2
.brush/drag PEK #00 NEQ ,&no-drag-start JNZ
.Controller/button DEI #02 NEQ ;&no-drag JCN2
.brush/drag PEK #00 NEQ ,&no-drag-start JCN
.canvas/x1 PEK2 .origin/x1 POK2
.canvas/y1 PEK2 .origin/y1 POK2
.canvas/x2 PEK2 .origin/x2 POK2
@ -170,8 +170,8 @@ BRK
&no-drag
( in sizepane )
.Mouse/x DEI2 CLN2r .sizepane/x1 PEK2 GTH2 STH2r .sizepane/x2 PEK2 LTH2 #0101 NEQ2 ,&no-touch-sizepane JNZ
.Mouse/y DEI2 CLN2r .sizepane/y1 PEK2 GTH2 STH2r .sizepane/y2 PEK2 LTH2 #0101 NEQ2 ,&no-touch-sizepane JNZ
.Mouse/x DEI2 CLN2r .sizepane/x1 PEK2 GTH2 STH2r .sizepane/x2 PEK2 LTH2 #0101 NEQ2 ,&no-touch-sizepane JCN
.Mouse/y DEI2 CLN2r .sizepane/y1 PEK2 GTH2 STH2r .sizepane/y2 PEK2 LTH2 #0101 NEQ2 ,&no-touch-sizepane JCN
( release ) #00 .Mouse/state DEO
#01 .brush/tool POK
.Mouse/x DEI2 .sizepane/x1 PEK2 SUB2 8/ SWP POP .brush/size POK
@ -181,8 +181,8 @@ BRK
&no-touch-sizepane
( in pattpane )
.Mouse/x DEI2 CLN2r .pattpane/x1 PEK2 GTH2 STH2r .pattpane/x2 PEK2 LTH2 #0101 NEQ2 ,&no-touch-pattpane JNZ
.Mouse/y DEI2 CLN2r .pattpane/y1 PEK2 GTH2 STH2r .pattpane/y2 PEK2 LTH2 #0101 NEQ2 ,&no-touch-pattpane JNZ
.Mouse/x DEI2 CLN2r .pattpane/x1 PEK2 GTH2 STH2r .pattpane/x2 PEK2 LTH2 #0101 NEQ2 ,&no-touch-pattpane JCN
.Mouse/y DEI2 CLN2r .pattpane/y1 PEK2 GTH2 STH2r .pattpane/y2 PEK2 LTH2 #0101 NEQ2 ,&no-touch-pattpane JCN
( release ) #00 .Mouse/state DEO
.Mouse/x DEI2 .pattpane/x1 PEK2 SUB2 8/ SWP POP .brush/patt POK
( draw ) ;draw-pattpane JSR2
@ -190,8 +190,8 @@ BRK
&no-touch-pattpane
( in toolpane )
.Mouse/x DEI2 CLN2r .toolpane/x1 PEK2 GTH2 STH2r .toolpane/x2 PEK2 LTH2 #0101 NEQ2 ,&no-touch-toolpane JNZ
.Mouse/y DEI2 CLN2r .toolpane/y1 PEK2 GTH2 STH2r .toolpane/y2 PEK2 LTH2 #0101 NEQ2 ,&no-touch-toolpane JNZ
.Mouse/x DEI2 CLN2r .toolpane/x1 PEK2 GTH2 STH2r .toolpane/x2 PEK2 LTH2 #0101 NEQ2 ,&no-touch-toolpane JCN
.Mouse/y DEI2 CLN2r .toolpane/y1 PEK2 GTH2 STH2r .toolpane/y2 PEK2 LTH2 #0101 NEQ2 ,&no-touch-toolpane JCN
( release ) #00 .Mouse/state DEO
.Mouse/x DEI2 .toolpane/x1 PEK2 SUB2 8/ SWP POP .brush/tool POK
( draw ) ;draw-toolpane JSR2
@ -199,22 +199,22 @@ BRK
&no-touch-toolpane
( in viewpane )
.Mouse/x DEI2 CLN2r .viewpane/x1 PEK2 GTH2 STH2r .viewpane/x2 PEK2 LTH2 #0101 NEQ2 ;&no-touch-viewpane JNZ2
.Mouse/y DEI2 CLN2r .viewpane/y1 PEK2 GTH2 STH2r .viewpane/y2 PEK2 LTH2 #0101 NEQ2 ;&no-touch-viewpane JNZ2
.Mouse/x DEI2 CLN2r .viewpane/x1 PEK2 GTH2 STH2r .viewpane/x2 PEK2 LTH2 #0101 NEQ2 ;&no-touch-viewpane JCN2
.Mouse/y DEI2 CLN2r .viewpane/y1 PEK2 GTH2 STH2r .viewpane/y2 PEK2 LTH2 #0101 NEQ2 ;&no-touch-viewpane JCN2
( release ) #00 .Mouse/state DEO
( clear ) .canvas/x1 PEK2 #0002 SUB2 .canvas/y1 PEK2 #0002 SUB2 .canvas/x2 PEK2 #0002 ADD2 .canvas/y2 PEK2 #0002 ADD2 #00 ;fill-rect JSR2
;draw-background JSR2
.Mouse/x DEI2 .viewpane/x1 PEK2 SUB2 8/ SWP POP
DUP #00 NEQ ,&no-incwidth JNZ
DUP #00 NEQ ,&no-incwidth JCN
.canvas/w PEK2 ++ .canvas/w POK2
&no-incwidth
DUP #01 NEQ ,&no-decwidth JNZ
DUP #01 NEQ ,&no-decwidth JCN
.canvas/w PEK2 -- .canvas/w POK2
&no-decwidth
DUP #02 NEQ ,&no-incheight JNZ
DUP #02 NEQ ,&no-incheight JCN
.canvas/h PEK2 ++ .canvas/h POK2
&no-incheight
DUP #03 NEQ ,&no-decheight JNZ
DUP #03 NEQ ,&no-decheight JCN
.canvas/h PEK2 -- .canvas/h POK2
&no-decheight
POP
@ -224,23 +224,23 @@ BRK
&no-touch-viewpane
( in canvas )
.Mouse/x DEI2 CLN2r .canvas/x1 PEK2 GTS2 STH2r .canvas/x2 PEK2 LTS2 #0101 NEQ2 ;&no-touch-canvas JNZ2
.Mouse/y DEI2 CLN2r .canvas/y1 PEK2 GTS2 STH2r .canvas/y2 PEK2 LTS2 #0101 NEQ2 ;&no-touch-canvas JNZ2
.Mouse/x DEI2 CLN2r .canvas/x1 PEK2 GTS2 STH2r .canvas/x2 PEK2 LTS2 #0101 NEQ2 ;&no-touch-canvas JCN2
.Mouse/y DEI2 CLN2r .canvas/y1 PEK2 GTS2 STH2r .canvas/y2 PEK2 LTS2 #0101 NEQ2 ;&no-touch-canvas JCN2
( set cursor operation )
;add-pixel .Mouse/state DEI #01 EQU ;&no-oper JNZ2 POP2 ;remove-pixel &no-oper .brush/oper POK2
;add-pixel .Mouse/state DEI #01 EQU ;&no-oper JCN2 POP2 ;remove-pixel &no-oper .brush/oper POK2
.brush/tool PEK #00 NEQ ,&no-touch-pen JNZ
.brush/tool PEK #00 NEQ ,&no-touch-pen JCN
.cursor/x0 PEK2 .canvas/x1 PEK2 SUB2 .cursor/y0 PEK2 .canvas/y1 PEK2 SUB2 .Mouse/x DEI2 .canvas/x1 PEK2 SUB2 .Mouse/y DEI2 .canvas/y1 PEK2 SUB2 ;paint-line JSR2
;&touch-end JMP2
&no-touch-pen
.brush/tool PEK #01 NEQ ,&no-touch-brush JNZ
.brush/tool PEK #01 NEQ ,&no-touch-brush JCN
.Mouse/x DEI2 .canvas/x1 PEK2 SUB2 .Mouse/y DEI2 .canvas/y1 PEK2 SUB2 ;paint-brush JSR2
;&touch-end JMP2
&no-touch-brush
.brush/tool PEK #04 NEQ ,&no-touch-zoom JNZ
.brush/tool PEK #04 NEQ ,&no-touch-zoom JCN
.zoom/active PEK #00 EQU .zoom/active POK
( release ) #00 .Mouse/state DEO
.Mouse/x DEI2 .canvas/x1 PEK2 SUB2 .canvas/w PEK2 2/ SUB2 .zoom/x POK2
@ -252,23 +252,23 @@ BRK
&no-touch-canvas
( background interface )
.Mouse/y DEI2 STEP8 .Screen/height DEI2 #0010 SUB2 NEQ2 ,&no-touch-background JNZ
.Mouse/y DEI2 STEP8 .Screen/height DEI2 #0010 SUB2 NEQ2 ,&no-touch-background JCN
.Mouse/x DEI2 .Screen/width DEI2 #0028 SUB2 SUB2 8/ SWP POP
DUP #00 NEQ ,&no-eye-button JNZ
DUP #00 NEQ ,&no-eye-button JCN
;present JSR2
( release ) #00 .Mouse/state DEO
&no-eye-button
DUP #01 NEQ ,&no-rename-button JNZ
DUP #01 NEQ ,&no-rename-button JCN
;rename JSR2
#01 .document/edit POK
( release ) #00 .Mouse/state DEO
&no-rename-button
DUP #02 NEQ ,&no-load-button JNZ
DUP #02 NEQ ,&no-load-button JCN
;path/name ;load-file JSR2
;draw-canvas JSR2
( release ) #00 .Mouse/state DEO
&no-load-button
DUP #03 NEQ ,&no-save-button JNZ
DUP #03 NEQ ,&no-save-button JCN
;path/name ;save-file JSR2
( release ) #00 .Mouse/state DEO
&no-save-button
@ -289,23 +289,23 @@ BRK
@on-button ( -> )
( if in renaming mode )
.document/edit PEK #01 NEQ ;&no-edit JNZ2
.Controller/key DEI #00 EQU ;&no-edit JNZ2
.document/edit PEK #01 NEQ ;&no-edit JCN2
.Controller/key DEI #00 EQU ;&no-edit JCN2
( enter )
.Controller/key DEI #0d NEQ ,&no-edit-enter JNZ
.Controller/key DEI #0d NEQ ,&no-edit-enter JCN
#00 .document/edit POK
;redraw JSR2
BRK
&no-edit-enter
( backspace )
.Controller/key DEI #08 NEQ ,&no-edit-backspace JNZ
.path/length PEK #00 EQU ,&edit-end JNZ
.Controller/key DEI #08 NEQ ,&no-edit-backspace JCN
.path/length PEK #00 EQU ,&edit-end JCN
.path/length PEK #01 SUB .path/length POK
#00 ;path/name #00 .path/length PEK ADD2 STA
BRK
&no-edit-backspace
( default )
.path/length PEK #1f EQU ,&edit-end JNZ
.path/length PEK #1f EQU ,&edit-end JCN
.Controller/key DEI ;path/name #00 .path/length PEK ADD2 STA
.path/length PEK #01 ADD .path/length POK
&edit-end
@ -314,36 +314,36 @@ BRK
&no-edit
( control zoom )
.zoom/active PEK #00 EQU ,&skip-zoom JNZ
.zoom/active PEK #00 EQU ,&skip-zoom JCN
.Controller/button DEI #f0 AND
DUP #04 SFT #01 AND #01 NEQ ,&no-up JNZ
DUP #04 SFT #01 AND #01 NEQ ,&no-up JCN
( move ) .zoom/y PEK2 -- .zoom/y POK2 &no-up
DUP #05 SFT #01 AND #01 NEQ ,&no-down JNZ
DUP #05 SFT #01 AND #01 NEQ ,&no-down JCN
( move ) .zoom/y PEK2 ++ .zoom/y POK2 &no-down
DUP #06 SFT #01 AND #01 NEQ ,&no-left JNZ
DUP #06 SFT #01 AND #01 NEQ ,&no-left JCN
( move ) .zoom/x PEK2 -- .zoom/x POK2 &no-left
DUP #07 SFT #01 AND #01 NEQ ,&no-right JNZ
DUP #07 SFT #01 AND #01 NEQ ,&no-right JCN
( move ) .zoom/x PEK2 ++ .zoom/x POK2 &no-right
#00 EQU #04 JNZ ;draw-canvas JSR2
#00 EQU #04 JCN ;draw-canvas JSR2
&skip-zoom
.Controller/key DEI
DUP #20 NEQ ,&no-space JNZ
DUP #20 NEQ ,&no-space JCN
( toggle zoom ) .zoom/active PEK #00 EQU .zoom/active POK ;redraw JSR2 &no-space
DUP #08 NEQ ,&no-backspace JNZ
DUP #08 NEQ ,&no-backspace JCN
( erase ) ;clear JSR2 &no-backspace
DUP #71 NEQ ,&no-qkey JNZ
DUP #71 NEQ ,&no-qkey JCN
( tool0 ) #00 .brush/tool POK ;draw-toolpane JSR2 &no-qkey
DUP #77 NEQ ,&no-wkey JNZ
DUP #77 NEQ ,&no-wkey JCN
( tool0 ) #01 .brush/tool POK ;draw-toolpane JSR2 &no-wkey
DUP #65 NEQ ,&no-ekey JNZ
DUP #65 NEQ ,&no-ekey JCN
( tool0 ) #02 .brush/tool POK ;draw-toolpane JSR2 &no-ekey
DUP #72 NEQ ,&no-rkey JNZ
DUP #72 NEQ ,&no-rkey JCN
( tool0 ) #03 .brush/tool POK ;draw-toolpane JSR2 &no-rkey
DUP #74 NEQ ,&no-tkey JNZ
DUP #74 NEQ ,&no-tkey JCN
( tool0 ) #04 .brush/tool POK ;draw-toolpane JSR2 &no-tkey
DUP
DUP #30 GTH SWP #39 LTH #0101 NEQ2 ,&no-numkey JNZ
DUP #30 GTH SWP #39 LTH #0101 NEQ2 ,&no-numkey JCN
( size ) .Controller/key DEI #31 SUB .brush/size POK ;draw-sizepane JSR2 &no-numkey
POP
@ -377,7 +377,7 @@ RTN
&loop
( write ) OVR2 #00 ROT ROT STA
( incr ) SWP2 #0001 ADD2 SWP2
OVR2 OVR2 LTH2 ,&loop JNZ
OVR2 OVR2 LTH2 ,&loop JCN
POP2 POP2
;redraw JSR2
@ -388,10 +388,10 @@ RTN
.document/presentation PEK #00 EQU .document/presentation POK
.document/presentation PEK
DUP #00 NEQ ,&skip0 JNZ
DUP #00 NEQ ,&skip0 JCN
.theme/r0 PEK2 .System/r DEO2 .theme/g0 PEK2 .System/g DEO2 .theme/b0 PEK2 .System/b DEO2
&skip0
DUP #01 NEQ ,&skip1 JNZ
DUP #01 NEQ ,&skip1 JCN
.theme/r1 PEK2 .System/r DEO2 .theme/g1 PEK2 .System/g DEO2 .theme/b1 PEK2 .System/b DEO2
&skip1
POP
@ -420,7 +420,7 @@ RTN
( load ) .line/y1 POK2 .line/x1 POK2 .line/y2 POK2 .line/x2 POK2
( trim if zoomed )
.zoom/active PEK #01 NEQ ,&no-zoom JNZ
.zoom/active PEK #01 NEQ ,&no-zoom JCN
.line/x1 PEK2 8/ .zoom/x PEK2 ADD2 .line/x1 POK2
.line/y1 PEK2 8/ .zoom/y PEK2 ADD2 .line/y1 POK2
.line/x2 PEK2 8/ .zoom/x PEK2 ADD2 .line/x2 POK2
@ -434,13 +434,13 @@ RTN
.line/dx PEK2 .line/dy PEK2 ADD2 .line/e1 POK2
&loop
( paint ) .line/x2 PEK2 .line/y2 PEK2 .brush/oper PEK2 JSR2
.line/x2 PEK2 .line/x1 PEK2 EQU2 .line/y2 PEK2 .line/y1 PEK2 EQU2 #0101 EQU2 ,&end JNZ
.line/x2 PEK2 .line/x1 PEK2 EQU2 .line/y2 PEK2 .line/y1 PEK2 EQU2 #0101 EQU2 ,&end JCN
.line/e1 PEK2 #0002 MUL2 .line/e2 POK2
.line/e2 PEK2 .line/dy PEK2 LTS2 ,&skipy JNZ
.line/e2 PEK2 .line/dy PEK2 LTS2 ,&skipy JCN
.line/e1 PEK2 .line/dy PEK2 ADD2 .line/e1 POK2
.line/x2 PEK2 .line/sx PEK2 ADD2 .line/x2 POK2
&skipy
.line/e2 PEK2 .line/dx PEK2 GTS2 ,&skipx JNZ
.line/e2 PEK2 .line/dx PEK2 GTS2 ,&skipx JCN
.line/e1 PEK2 .line/dx PEK2 ADD2 .line/e1 POK2
.line/y2 PEK2 .line/sy PEK2 ADD2 .line/y2 POK2
&skipx
@ -457,7 +457,7 @@ RTN
( load ) .rect/y2 POK2 .rect/x2 POK2 .rect/y1 POK2 .rect/x1 POK2
( trim if zoomed )
.zoom/active PEK #01 NEQ ,&no-zoom JNZ
.zoom/active PEK #01 NEQ ,&no-zoom JCN
.rect/x1 PEK2 8/ .zoom/x PEK2 ADD2 .rect/x1 POK2
.rect/y1 PEK2 8/ .zoom/y PEK2 ADD2 .rect/y1 POK2
.rect/x2 PEK2 8/ .zoom/x PEK2 ADD2 #0001 ADD2 .rect/x2 POK2
@ -471,12 +471,12 @@ RTN
.rect/x1 PEK2 .pt2/x POK2
&hor
.pt2/x PEK2 SWP POP .px/x POK .pt2/y PEK2 SWP POP .px/y POK
;patternize JSR2 #00 EQU ,&no-pixel JNZ
;patternize JSR2 #00 EQU ,&no-pixel JCN
( draw ) .pt2/x PEK2 .pt2/y PEK2 .brush/oper PEK2 JSR2 &no-pixel
( incr ) .pt2/x PEK2 ++ .pt2/x POK2
.pt2/x PEK2 .rect/x2 PEK2 LTS2 ,&hor JNZ
.pt2/x PEK2 .rect/x2 PEK2 LTS2 ,&hor JCN
.pt2/y PEK2 ++ .pt2/y POK2
.pt2/y PEK2 .rect/y2 PEK2 LTS2 ,&ver JNZ
.pt2/y PEK2 .rect/y2 PEK2 LTS2 ,&ver JCN
;draw-canvas JSR2
;draw-foreground JSR2
@ -488,7 +488,7 @@ RTN
#0003 SUB2 .pt0/y POK2 #0003 SUB2 .pt0/x POK2 ( cursor offset )
( trim if zoomed )
.zoom/active PEK #01 NEQ ,&no-zoom JNZ
.zoom/active PEK #01 NEQ ,&no-zoom JCN
.pt0/x PEK2 8/ .zoom/x PEK2 ADD2 #0003 SUB2 .pt0/x POK2
.pt0/y PEK2 8/ .zoom/y PEK2 ADD2 #0003 SUB2 .pt0/y POK2
&no-zoom
@ -499,13 +499,13 @@ RTN
&hor
( addr ) ;size_icns #00 .brush/size PEK 8* ADD2
( byte ) #00 .px/y PEK ADD2 LDA #07 .px/x PEK SUB SFT #01 AND
#00 EQU ,&no-pixel JNZ
;patternize JSR2 #00 EQU ,&no-pixel JNZ
#00 EQU ,&no-pixel JCN
;patternize JSR2 #00 EQU ,&no-pixel JCN
.pt0/x PEK2 #00 .px/x PEK ADD2 .pt0/y PEK2 #00 .px/y PEK ADD2 .brush/oper PEK2 JSR2 &no-pixel
( incr ) .px/x PEK #01 ADD .px/x POK
.px/x PEK #08 LTH ,&hor JNZ
.px/x PEK #08 LTH ,&hor JCN
( incr ) .px/y PEK #01 ADD .px/y POK
.px/y PEK #08 LTH ,&ver JNZ
.px/y PEK #08 LTH ,&ver JCN
;draw-canvas JSR2
;draw-foreground JSR2
@ -514,37 +514,37 @@ RTN
@patternize ( -- )
.brush/patt PEK #00 NEQ ,&noplain JNZ
.brush/patt PEK #00 NEQ ,&noplain JCN
#01 RTN &noplain
.brush/patt PEK #01 NEQ ,&notone1 JNZ
.brush/patt PEK #01 NEQ ,&notone1 JCN
.pt0/x PEK2 #00 .px/x PEK ADD2 .pt0/y PEK2 #00 .px/y PEK ADD2 ADD2 #0001 AND2 #0000 EQU2
.pt0/x PEK2 #00 .px/x PEK ADD2 .pt0/y PEK2 #00 .px/y PEK ADD2 SUB2 #0001 AND2 #0000 EQU2
#0101 EQU2
RTN &notone1
.brush/patt PEK #02 NEQ ,&notone2 JNZ
.brush/patt PEK #02 NEQ ,&notone2 JCN
.pt0/x PEK2 #00 .px/x PEK ADD2 .pt0/y PEK2 #00 .px/y PEK ADD2 ADD2 #0003 AND2 #0000 EQU2
.pt0/x PEK2 #00 .px/x PEK ADD2 .pt0/y PEK2 #00 .px/y PEK ADD2 SUB2 #0003 AND2 #0000 EQU2
#0101 EQU2
RTN &notone2
.brush/patt PEK #03 NEQ ,&notone3 JNZ
.brush/patt PEK #03 NEQ ,&notone3 JCN
.pt0/x PEK2 #00 .px/x PEK ADD2 .pt0/y PEK2 #00 .px/y PEK ADD2 ADD2 #0005 AND2 #0000 EQU2
.pt0/x PEK2 #00 .px/x PEK ADD2 .pt0/y PEK2 #00 .px/y PEK ADD2 SUB2 #0005 AND2 #0000 EQU2
#0101 EQU2
RTN &notone3
.brush/patt PEK #04 NEQ ,&notone4 JNZ
.brush/patt PEK #04 NEQ ,&notone4 JCN
.pt0/x PEK2 #00 .px/x PEK ADD2 .pt0/y PEK2 #00 .px/y PEK ADD2 ADD2 #0003 AND2 #0000 EQU2 RTN &notone4
.brush/patt PEK #05 NEQ ,&notone5 JNZ
.brush/patt PEK #05 NEQ ,&notone5 JCN
.pt0/x PEK2 #00 .px/x PEK ADD2 .pt0/y PEK2 #00 .px/y PEK ADD2 SUB2 #0003 AND2 #0000 EQU2 RTN &notone5
.brush/patt PEK #06 NEQ ,&notone6 JNZ
.brush/patt PEK #06 NEQ ,&notone6 JCN
.pt0/x PEK2 #00 .px/x PEK ADD2 #0001 AND2 SWP POP RTN &notone6
.brush/patt PEK #07 NEQ ,&notone7 JNZ
.brush/patt PEK #07 NEQ ,&notone7 JCN
.pt0/y PEK2 #00 .px/y PEK ADD2 #0001 AND2 SWP POP RTN &notone7
#00
@ -609,7 +609,7 @@ RTN
@draw-canvas ( -- )
.zoom/active PEK #01 EQU ;draw-canvas-zoom JNZ2
.zoom/active PEK #01 EQU ;draw-canvas-zoom JCN2
.canvas/y1 PEK2 .Screen/y DEO2
;data .Screen/addr DEO2
@ -619,9 +619,9 @@ RTN
( draw ) #29 .Screen/color DEO
( incr ) .Screen/x DEI2 8+ .Screen/x DEO2
( incr ) .Screen/addr DEI2 8+ .Screen/addr DEO2
.Screen/x DEI2 .canvas/x2 PEK2 NEQ2 ,&hor JNZ
.Screen/x DEI2 .canvas/x2 PEK2 NEQ2 ,&hor JCN
( incr ) .Screen/y DEI2 8+ .Screen/y DEO2
.Screen/y DEI2 .canvas/y2 PEK2 NEQ2 ,&ver JNZ
.Screen/y DEI2 .canvas/y2 PEK2 NEQ2 ,&ver JCN
RTN
@ -638,10 +638,10 @@ RTN
( draw ) #29 .Screen/color DEO
( incr ) .Screen/x DEI2 8+ .Screen/x DEO2
( incr ) .pt1/x PEK2 ++ .pt1/x POK2
.Screen/x DEI2 .canvas/x2 PEK2 NEQ2 ,&hor JNZ
.Screen/x DEI2 .canvas/x2 PEK2 NEQ2 ,&hor JCN
( incr ) .Screen/y DEI2 8+ .Screen/y DEO2
( incr ) .pt1/y PEK2 ++ .pt1/y POK2
.Screen/y DEI2 .canvas/y2 PEK2 NEQ2 ,&ver JNZ
.Screen/y DEI2 .canvas/y2 PEK2 NEQ2 ,&ver JCN
RTN
@ -655,19 +655,19 @@ RTN
( record cursor positions )
.Mouse/x DEI2 .cursor/x POK2 .Mouse/y DEI2 .cursor/y POK2
( draw size cursor )
.brush/tool PEK #01 NEQ ;&outside-canvas JNZ2
.brush/tool PEK #01 NEQ ;&outside-canvas JCN2
( do not draw size when holding alt )
.Controller/button DEI #02 EQU ;&outside-canvas JNZ2
.Mouse/x DEI2 CLN2r .canvas/x1 PEK2 GTH2 STH2r .canvas/x2 PEK2 LTH2 #0101 NEQ2 ;&outside-canvas JNZ2
.Mouse/y DEI2 CLN2r .canvas/y1 PEK2 GTH2 STH2r .canvas/y2 PEK2 LTH2 #0101 NEQ2 ;&outside-canvas JNZ2
.Controller/button DEI #02 EQU ;&outside-canvas JCN2
.Mouse/x DEI2 CLN2r .canvas/x1 PEK2 GTH2 STH2r .canvas/x2 PEK2 LTH2 #0101 NEQ2 ;&outside-canvas JCN2
.Mouse/y DEI2 CLN2r .canvas/y1 PEK2 GTH2 STH2r .canvas/y2 PEK2 LTH2 #0101 NEQ2 ;&outside-canvas JCN2
( do not draw size in toolpane )
.Mouse/x DEI2 CLN2r .toolpane/x1 PEK2 GTH2 STH2r .toolpane/x2 PEK2 LTH2 #0101 EQU2 .Mouse/y DEI2 CLN2r .toolpane/y1 PEK2 GTH2 STH2r .toolpane/y2 PEK2 LTH2 #0101 EQU2 #0101 EQU2 ;&outside-canvas JNZ2
.Mouse/x DEI2 CLN2r .sizepane/x1 PEK2 GTH2 STH2r .sizepane/x2 PEK2 LTH2 #0101 EQU2 .Mouse/y DEI2 CLN2r .sizepane/y1 PEK2 GTH2 STH2r .sizepane/y2 PEK2 LTH2 #0101 EQU2 #0101 EQU2 ;&outside-canvas JNZ2
.Mouse/x DEI2 CLN2r .pattpane/x1 PEK2 GTH2 STH2r .pattpane/x2 PEK2 LTH2 #0101 EQU2 .Mouse/y DEI2 CLN2r .pattpane/y1 PEK2 GTH2 STH2r .pattpane/y2 PEK2 LTH2 #0101 EQU2 #0101 EQU2 ;&outside-canvas JNZ2
.Mouse/x DEI2 CLN2r .toolpane/x1 PEK2 GTH2 STH2r .toolpane/x2 PEK2 LTH2 #0101 EQU2 .Mouse/y DEI2 CLN2r .toolpane/y1 PEK2 GTH2 STH2r .toolpane/y2 PEK2 LTH2 #0101 EQU2 #0101 EQU2 ;&outside-canvas JCN2
.Mouse/x DEI2 CLN2r .sizepane/x1 PEK2 GTH2 STH2r .sizepane/x2 PEK2 LTH2 #0101 EQU2 .Mouse/y DEI2 CLN2r .sizepane/y1 PEK2 GTH2 STH2r .sizepane/y2 PEK2 LTH2 #0101 EQU2 #0101 EQU2 ;&outside-canvas JCN2
.Mouse/x DEI2 CLN2r .pattpane/x1 PEK2 GTH2 STH2r .pattpane/x2 PEK2 LTH2 #0101 EQU2 .Mouse/y DEI2 CLN2r .pattpane/y1 PEK2 GTH2 STH2r .pattpane/y2 PEK2 LTH2 #0101 EQU2 #0101 EQU2 ;&outside-canvas JCN2
.cursor/x PEK2 #0003 SUB2 .Screen/x DEO2 .cursor/y PEK2 #0003 SUB2 .Screen/y DEO2
;brush_icns #00 .brush/size PEK 8* ADD2 .Screen/addr DEO2
#31 .Mouse/state DEI #02 MUL ADD .Screen/color DEO
.Mouse/state DEI #00 EQU ,&outside-canvas JNZ RTN
.Mouse/state DEI #00 EQU ,&outside-canvas JCN RTN
&outside-canvas
( draw new cursor )
.cursor/x PEK2 .Screen/x DEO2 .cursor/y PEK2 .Screen/y DEO2
@ -678,7 +678,7 @@ RTN
@draw-toolpane ( -- )
.document/presentation PEK #00 EQU ,&skip JNZ RTN &skip
.document/presentation PEK #00 EQU ,&skip JCN RTN &skip
( frame )
.toolpane/x1 PEK2 -- .toolpane/y1 PEK2 -- .toolpane/x2 PEK2 .toolpane/y2 PEK2 #00 ;line-rect JSR2
@ -690,9 +690,9 @@ RTN
( draw ) #21 .Screen/x DEI2 .toolpane/x1 PEK2 SUB2 8/ SWP POP .brush/tool PEK EQU #02 MUL ADD .Screen/color DEO
( incr ) .Screen/x DEI2 8+ .Screen/x DEO2
( incr ) .Screen/addr DEI2 8+ .Screen/addr DEO2
.Screen/x DEI2 .toolpane/x2 PEK2 LTH2 ,&loop JNZ
.Screen/x DEI2 .toolpane/x2 PEK2 LTH2 ,&loop JCN
.zoom/active PEK #01 NEQ ,&no-zoom JNZ
.zoom/active PEK #01 NEQ ,&no-zoom JCN
.Screen/x DEI2 #0008 SUB2 .Screen/x DEO2
;tool_icns #0028 ADD2 .Screen/addr DEO2
#21 #04 .brush/tool PEK EQU #02 MUL ADD .Screen/color DEO
@ -702,7 +702,7 @@ RTN
@draw-pattpane ( -- )
.document/presentation PEK #00 EQU ,&skip JNZ RTN &skip
.document/presentation PEK #00 EQU ,&skip JCN RTN &skip
( frame )
.pattpane/x1 PEK2 -- .pattpane/y1 PEK2 -- .pattpane/x2 PEK2 .pattpane/y2 PEK2 #00 ;line-rect JSR2
@ -714,13 +714,13 @@ RTN
( draw ) #21 .Screen/x DEI2 .pattpane/x1 PEK2 SUB2 8/ SWP POP .brush/patt PEK EQU #02 MUL ADD .Screen/color DEO
( incr ) .Screen/x DEI2 8+ .Screen/x DEO2
( incr ) .Screen/addr DEI2 8+ .Screen/addr DEO2
.Screen/x DEI2 .pattpane/x2 PEK2 LTH2 ,&loop JNZ
.Screen/x DEI2 .pattpane/x2 PEK2 LTH2 ,&loop JCN
RTN
@draw-sizepane ( -- )
.document/presentation PEK #00 EQU ,&skip JNZ RTN &skip
.document/presentation PEK #00 EQU ,&skip JCN RTN &skip
( frame )
.sizepane/x1 PEK2 -- .sizepane/y1 PEK2 -- .sizepane/x2 PEK2 .sizepane/y2 PEK2 #00 ;line-rect JSR2
@ -732,13 +732,13 @@ RTN
( draw ) #21 .Screen/x DEI2 .sizepane/x1 PEK2 SUB2 8/ SWP POP .brush/size PEK EQU #02 MUL ADD .Screen/color DEO
( incr ) .Screen/x DEI2 8+ .Screen/x DEO2
( incr ) .Screen/addr DEI2 8+ .Screen/addr DEO2
.Screen/x DEI2 .sizepane/x2 PEK2 LTH2 ,&loop JNZ
.Screen/x DEI2 .sizepane/x2 PEK2 LTH2 ,&loop JCN
RTN
@draw-viewpane ( -- )
.document/presentation PEK #00 EQU ,&skip JNZ RTN &skip
.document/presentation PEK #00 EQU ,&skip JCN RTN &skip
( frame )
.viewpane/x1 PEK2 -- .viewpane/y1 PEK2 -- .viewpane/x2 PEK2 .viewpane/y2 PEK2 #00 ;line-rect JSR2
@ -750,7 +750,7 @@ RTN
( draw ) #21 .Screen/color DEO
( incr ) .Screen/x DEI2 8+ .Screen/x DEO2
( incr ) .Screen/addr DEI2 8+ .Screen/addr DEO2
.Screen/x DEI2 .viewpane/x2 PEK2 LTH2 ,&loop JNZ
.Screen/x DEI2 .viewpane/x2 PEK2 LTH2 ,&loop JCN
RTN
@ -770,7 +770,7 @@ RTN
( draw ver line )
.Screen/width DEI2 #0002 DIV2 #0000 .Screen/height DEI2 .document/presentation PEK #00 EQU ;line-vertical-dotted JSR2
.document/presentation PEK #01 EQU ;&skip-size JNZ2
.document/presentation PEK #01 EQU ;&skip-size JCN2
( draw size )
#0010 .Screen/y DEO2
( draw width )
@ -816,7 +816,7 @@ RTN
( draw ) .rect/x1 PEK2 .Screen/x DEO2 .color PEK DUP .Screen/color DEO
( draw ) .rect/x2 PEK2 .Screen/x DEO2 .Screen/color DEO
( incr ) SWP2 ++ SWP2
OVR2 OVR2 LTS2 ,&ver JNZ
OVR2 OVR2 LTS2 ,&ver JCN
POP2 POP2
.rect/x1 PEK2 .rect/x2 PEK2
&hor
@ -824,7 +824,7 @@ RTN
( draw ) .rect/y1 PEK2 .Screen/y DEO2 .color PEK DUP .Screen/color DEO
( draw ) .rect/y2 PEK2 .Screen/y DEO2 .Screen/color DEO
( incr ) SWP2 ++ SWP2
OVR2 OVR2 ++ LTS2 ,&hor JNZ
OVR2 OVR2 ++ LTS2 ,&hor JCN
POP2 POP2
RTN
@ -840,10 +840,10 @@ RTN
( save ) OVR2 .Screen/x DEO2
( draw ) .color PEK .Screen/color DEO
( incr ) SWP2 ++ SWP2
OVR2 OVR2 LTS2 ,&hor JNZ
OVR2 OVR2 LTS2 ,&hor JCN
POP2 POP2 STH2r STH2r
( incr ) SWP2 ++ SWP2
OVR2 OVR2 LTS2 ,&ver JNZ
OVR2 OVR2 LTS2 ,&ver JCN
POP2 POP2 POP2 POP2
RTN
@ -856,7 +856,7 @@ RTN
( draw ) .color PEK #20 ADD .Screen/color DEO
( incr ) #0001 ADD2
( incr ) .Screen/x DEI2 8+ .Screen/x DEO2
( loop ) DUP2 LDA #00 NEQ ,&loop JNZ
( loop ) DUP2 LDA #00 NEQ ,&loop JCN
POP2
RTN
@ -867,7 +867,7 @@ RTN
&draw-hor
( draw ) .color PEK .Screen/color DEO
( incr ) SWP2 #0002 ADD2 DUP2 .Screen/x DEO2 SWP2
OVR2 OVR2 LTH2 ,&draw-hor JNZ
OVR2 OVR2 LTH2 ,&draw-hor JCN
POP2 POP2
RTN
@ -878,7 +878,7 @@ RTN
&draw-ver
( draw ) .color PEK .Screen/color DEO
( incr ) SWP2 #0002 ADD2 DUP2 .Screen/y DEO2 SWP2
OVR2 OVR2 LTH2 ,&draw-ver JNZ
OVR2 OVR2 LTH2 ,&draw-ver JCN
POP2 POP2
RTN
@ -889,7 +889,7 @@ RTN
( copy src->dst ) OVR2 OVR2 SWP2 LDA ROT ROT STA
( incr dst ) ++
( incr src ) SWP2 ++ SWP2
OVR2 LDA #00 NEQ ,&loop JNZ
OVR2 LDA #00 NEQ ,&loop JCN
#00 ROT ROT STA POP2
RTN

View File

@ -73,7 +73,7 @@ BRK
.timer PEK ++ DUP .timer POK
( skip ) #08 EQU ,&tick JNZ BRK &tick
( skip ) #08 EQU ,&tick JCN BRK &tick
.timer/frame PEK ++ .timer/frame POK
@ -85,32 +85,32 @@ BRK
@on-button
.Controller/key DEI #00 EQU ,&no-key JNZ
.Controller/key DEI #00 EQU ,&no-key JCN
.selection/x1 PEK .selection/y1 PEK .Controller/key DEI SET-CELL
;redraw JSR2
&no-key
( arrows )
.Controller/button DEI #f0 AND
DUP #04 SFT #01 AND #01 NEQ ,&no-up JNZ
.selection/y1 PEK #00 EQU ,&no-up JNZ
DUP #04 SFT #01 AND #01 NEQ ,&no-up JCN
.selection/y1 PEK #00 EQU ,&no-up JCN
.selection/y1 PEK -- .selection/y1 POK
.selection/y2 PEK -- .selection/y2 POK &no-up
DUP #05 SFT #01 AND #01 NEQ ,&no-down JNZ
.selection/y1 PEK .grid/height PEK -- EQU ,&no-down JNZ
DUP #05 SFT #01 AND #01 NEQ ,&no-down JCN
.selection/y1 PEK .grid/height PEK -- EQU ,&no-down JCN
.selection/y1 PEK ++ .selection/y1 POK
.selection/y2 PEK ++ .selection/y2 POK &no-down
DUP #06 SFT #01 AND #01 NEQ ,&no-left JNZ
.selection/x1 PEK #00 EQU ,&no-left JNZ
DUP #06 SFT #01 AND #01 NEQ ,&no-left JCN
.selection/x1 PEK #00 EQU ,&no-left JCN
.selection/x1 PEK -- .selection/x1 POK
.selection/x2 PEK -- .selection/x2 POK &no-left
DUP #07 SFT #01 AND #01 NEQ ,&no-right JNZ
.selection/x1 PEK .grid/width PEK -- EQU ,&no-right JNZ
DUP #07 SFT #01 AND #01 NEQ ,&no-right JCN
.selection/x1 PEK .grid/width PEK -- EQU ,&no-right JCN
.selection/x1 PEK ++ .selection/x1 POK
.selection/x2 PEK ++ .selection/x2 POK &no-right
POP
.Controller/key DEI #08 NEQ ,&no-backspace JNZ
.Controller/key DEI #08 NEQ ,&no-backspace JCN
.selection/x1 PEK .selection/y1 PEK #2e SET-CELL ( put . char )
&no-backspace
@ -120,7 +120,7 @@ BRK
@on-mouse
.Mouse/state DEI #00 EQU ,&no-touch JNZ
.Mouse/state DEI #00 EQU ,&no-touch JCN
.Mouse/x DEI2 8/ SWP POP .selection/x1 POK
.Mouse/y DEI2 8/ SWP POP .selection/y1 POK
;redraw JSR2
@ -153,10 +153,10 @@ BRK
( get x,y ) SWP2 OVR STH SWP2 OVR STHr
#2e SET-CELL
( incr ) SWP ++ SWP
DUP2 LTH ,&hor JNZ
DUP2 LTH ,&hor JCN
POP2
( incr ) SWP ++ SWP
DUP2 LTH ,&ver JNZ
DUP2 LTH ,&ver JCN
POP2
#9a .timer/speed POK
@ -179,7 +179,7 @@ RTN
@get-port ( x y lock -- value )
(
DUP #01 NEQ ^$no-lock JNZ
DUP #01 NEQ ^$no-lock JCN
DUP2 #01 SET-LOCK
$no-lock
STH DUP2 #02 #02 STHr MUL ADD ,set-type JSR2
@ -192,11 +192,11 @@ RTN
DUP2 LDA-CELL
( if character is dot )
DUP #2e NEQ ,&no-bar JNZ
DUP #2e NEQ ,&no-bar JCN
( check if x,y is grid )
POP
DUP2 #08 MOD #00 EQU SWP #08 MOD #00 EQU #0101 NEQ2 ,&no-marker8 JNZ POP2 ;marker8_icn RTN &no-marker8
DUP2 #02 MOD #00 EQU SWP #02 MOD #00 EQU #0101 NEQ2 ,&no-marker4 JNZ POP2 ;marker4_icn RTN &no-marker4
DUP2 #08 MOD #00 EQU SWP #08 MOD #00 EQU #0101 NEQ2 ,&no-marker8 JCN POP2 ;marker8_icn RTN &no-marker8
DUP2 #02 MOD #00 EQU SWP #02 MOD #00 EQU #0101 NEQ2 ,&no-marker4 JCN POP2 ;marker4_icn RTN &no-marker4
POP2 ;font RTN
&no-bar
STH POP2 STHr
@ -304,11 +304,11 @@ RTN
STH
( limit )
DUP #00 NEQ ,&not-edge JNZ
DUP #00 NEQ ,&not-edge JCN
#2a SET-CELL POP STHr RTN
&not-edge
( collide )
DUP2 -- LDA-CELL #2e EQU ,&not-collide JNZ
DUP2 -- LDA-CELL #2e EQU ,&not-collide JCN
#2a SET-CELL POP STHr RTN
&not-collide
( move )
@ -373,11 +373,11 @@ RTN
STH
( limit )
OVR #00 NEQ ,&not-edge JNZ
OVR #00 NEQ ,&not-edge JCN
#2a SET-CELL POP STHr RTN
&not-edge
( collide )
DUP2 SWP -- SWP LDA-CELL #2e EQU ,&not-collide JNZ
DUP2 SWP -- SWP LDA-CELL #2e EQU ,&not-collide JCN
#2a SET-CELL POP STHr RTN
&not-collide
( move )
@ -415,30 +415,30 @@ RTN
@run-char ( x y char -- )
( skip dot )
DUP #2e NEQ ,&not-dot JNZ
DUP #2e NEQ ,&not-dot JCN
POP POP2 RTN
&not-dot
( skip locked )
ROT ROT DUP2 LDA-LOCK #00 EQU ,&not-locked JNZ
ROT ROT DUP2 LDA-LOCK #00 EQU ,&not-locked JCN
POP POP2 RTN
&not-locked
ROT
( A ) DUP #41 EQU ;op-a JNZ2 ( B ) DUP #42 EQU ;op-b JNZ2
( C ) DUP #43 EQU ;op-c JNZ2 ( D ) DUP #44 EQU ;op-d JNZ2
( E ) DUP #45 EQU ;op-e JNZ2 ( F ) DUP #46 EQU ;op-f JNZ2
( G ) DUP #47 EQU ;op-g JNZ2 ( H ) DUP #48 EQU ;op-h JNZ2
( I ) DUP #49 EQU ;op-i JNZ2 ( J ) DUP #4a EQU ;op-j JNZ2
( K ) DUP #4b EQU ;op-k JNZ2 ( L ) DUP #4c EQU ;op-l JNZ2
( M ) DUP #4d EQU ;op-m JNZ2 ( N ) DUP #4e EQU ;op-n JNZ2
( O ) DUP #4f EQU ;op-o JNZ2 ( P ) DUP #50 EQU ;op-p JNZ2
( Q ) DUP #51 EQU ;op-q JNZ2 ( R ) DUP #52 EQU ;op-r JNZ2
( S ) DUP #53 EQU ;op-s JNZ2 ( T ) DUP #54 EQU ;op-t JNZ2
( U ) DUP #55 EQU ;op-u JNZ2 ( V ) DUP #56 EQU ;op-v JNZ2
( W ) DUP #57 EQU ;op-w JNZ2 ( X ) DUP #58 EQU ;op-x JNZ2
( Y ) DUP #59 EQU ;op-y JNZ2 ( Z ) DUP #5a EQU ;op-z JNZ2
( * ) DUP #2a EQU ;op-bang JNZ2
( A ) DUP #41 EQU ;op-a JCN2 ( B ) DUP #42 EQU ;op-b JCN2
( C ) DUP #43 EQU ;op-c JCN2 ( D ) DUP #44 EQU ;op-d JCN2
( E ) DUP #45 EQU ;op-e JCN2 ( F ) DUP #46 EQU ;op-f JCN2
( G ) DUP #47 EQU ;op-g JCN2 ( H ) DUP #48 EQU ;op-h JCN2
( I ) DUP #49 EQU ;op-i JCN2 ( J ) DUP #4a EQU ;op-j JCN2
( K ) DUP #4b EQU ;op-k JCN2 ( L ) DUP #4c EQU ;op-l JCN2
( M ) DUP #4d EQU ;op-m JCN2 ( N ) DUP #4e EQU ;op-n JCN2
( O ) DUP #4f EQU ;op-o JCN2 ( P ) DUP #50 EQU ;op-p JCN2
( Q ) DUP #51 EQU ;op-q JCN2 ( R ) DUP #52 EQU ;op-r JCN2
( S ) DUP #53 EQU ;op-s JCN2 ( T ) DUP #54 EQU ;op-t JCN2
( U ) DUP #55 EQU ;op-u JCN2 ( V ) DUP #56 EQU ;op-v JCN2
( W ) DUP #57 EQU ;op-w JCN2 ( X ) DUP #58 EQU ;op-x JCN2
( Y ) DUP #59 EQU ;op-y JCN2 ( Z ) DUP #5a EQU ;op-z JCN2
( * ) DUP #2a EQU ;op-bang JCN2
POP POP2
RTN
@ -452,10 +452,10 @@ RTN
( get x,y ) SWP2 OVR STH SWP2 OVR STHr
( unlock ) #00 SET-LOCK
( incr ) SWP ++ SWP
DUP2 LTH ,&hor JNZ
DUP2 LTH ,&hor JCN
POP2
( incr ) SWP ++ SWP
DUP2 LTH ,&ver JNZ
DUP2 LTH ,&ver JCN
POP2
RTN
@ -471,10 +471,10 @@ RTN
( get x,y ) SWP2 OVR STH SWP2 OVR STHr
DUP2 LDA-CELL ;run-char JSR2
( incr ) SWP ++ SWP
DUP2 LTH ,&hor JNZ
DUP2 LTH ,&hor JCN
POP2
( incr ) SWP ++ SWP
DUP2 LTH ,&ver JNZ
DUP2 LTH ,&ver JCN
POP2
;redraw JSR2
@ -551,10 +551,10 @@ RTN
( sprite ) DUP2 ;get-cell-sprite JSR2 .Screen/addr DEO2
( draw ) ;is-selected JSR2 #0d MUL #21 ADD .Screen/color DEO
( incr ) SWP ++ SWP
DUP2 LTH ,&hor JNZ
DUP2 LTH ,&hor JCN
POP2
( incr ) SWP ++ SWP
DUP2 LTH ,&ver JNZ
DUP2 LTH ,&ver JCN
POP2
;draw-interface JSR2

View File

@ -41,7 +41,7 @@ Program p;
char ops[][4] = {
"BRK", "LIT", "NOP", "POP", "DUP", "SWP", "OVR", "ROT",
"EQU", "NEQ", "GTH", "LTH", "JMP", "JNZ", "JSR", "STH",
"EQU", "NEQ", "GTH", "LTH", "JMP", "JCN", "JSR", "STH",
"PEK", "POK", "LDR", "STR", "LDA", "STA", "DEI", "DEO",
"ADD", "SUB", "MUL", "DIV", "AND", "ORA", "EOR", "SFT"
};