Implemented more macros in left/nasu

This commit is contained in:
neauoire 2021-03-16 11:25:26 -07:00
parent f997c5f564
commit b52417b66c
5 changed files with 168 additions and 173 deletions

View File

@ -264,8 +264,6 @@ walktoken(char *w)
case ',': return 3; /* lit2 addr-hb addr-lb */ case ',': return 3; /* lit2 addr-hb addr-lb */
case '.': return 2; /* addr-hb addr-lb */ case '.': return 2; /* addr-hb addr-lb */
case '^': return 2; /* Relative jump: lit addr-offset */ case '^': return 2; /* Relative jump: lit addr-offset */
case '+': /* signed positive */
case '-': /* signed negative */
case '#': return (slen(w + 1) == 2 ? 2 : 3); case '#': return (slen(w + 1) == 2 ? 2 : 3);
} }
if((m = findmacro(w))) { if((m = findmacro(w))) {
@ -326,21 +324,6 @@ parsetoken(char *w)
else else
return 0; return 0;
return 1; return 1;
} else if(w[0] == '+' && sihx(w + 1)) {
if(slen(w + 1) == 2)
pushbyte((Sint8)shex(w + 1), 1);
else if(slen(w + 1) == 4)
pushshort((Sint16)shex(w + 1), 1);
else
return 0;
} else if(w[0] == '-' && sihx(w + 1)) {
if(slen(w + 1) == 2)
pushbyte((Sint8)(shex(w + 1) * -1), 1);
else if(slen(w + 1) == 4)
pushshort((Sint16)(shex(w + 1) * -1), 1);
else
return 0;
return 1;
} else if((m = findmacro(w))) { } else if((m = findmacro(w))) {
int i; int i;
m->refs++; m->refs++;

View File

@ -1,8 +1,8 @@
( Controller ) ( Controller )
%INCR2 { #0001 ADD2 } %++ { #0001 ADD2 }
%DECR2 { #0001 SUB2 } %-- { #0001 SUB2 }
%HALF2 { #0002 DIV2 } %2/ { #0002 DIV2 }
%JMC2 { ROT JMP2? POP2 } %JMC2 { ROT JMP2? POP2 }
;slime { color 1 } ;slime { color 1 }
@ -10,8 +10,8 @@
|0100 @RESET |0100 @RESET
( set origin ) ( set origin )
~Screen.width HALF2 =Sprite.x ~Screen.width 2/ =Sprite.x
~Screen.height HALF2 =Sprite.y ~Screen.height 2/ =Sprite.y
,default_icn =Sprite.addr ,default_icn =Sprite.addr
#11 =Sprite.color #11 =Sprite.color
#0a =slime #0a =slime
@ -36,13 +36,13 @@ BRK
( detect movement ) ( detect movement )
~Controller.buttons #f0 AND ~Controller.buttons #f0 AND
DUP #04 SHR #01 AND #01 NEQ ,$no-up JMC2 DUP #04 SHR #01 AND #01 NEQ ,$no-up JMC2
( move ) ~Sprite.y DECR2 =Sprite.y ,up_icn =Sprite.addr $no-up ( move ) ~Sprite.y -- =Sprite.y ,up_icn =Sprite.addr $no-up
DUP #05 SHR #01 AND #01 NEQ ,$no-down JMC2 DUP #05 SHR #01 AND #01 NEQ ,$no-down JMC2
( move ) ~Sprite.y INCR2 =Sprite.y ,down_icn =Sprite.addr $no-down ( move ) ~Sprite.y ++ =Sprite.y ,down_icn =Sprite.addr $no-down
DUP #06 SHR #01 AND #01 NEQ ,$no-left JMC2 DUP #06 SHR #01 AND #01 NEQ ,$no-left JMC2
( move ) ~Sprite.x DECR2 =Sprite.x ,left_icn =Sprite.addr $no-left ( move ) ~Sprite.x -- =Sprite.x ,left_icn =Sprite.addr $no-left
DUP #07 SHR #01 AND #01 NEQ ,$no-right JMC2 DUP #07 SHR #01 AND #01 NEQ ,$no-right JMC2
( move ) ~Sprite.x INCR2 =Sprite.x ,right_icn =Sprite.addr $no-right ( move ) ~Sprite.x ++ =Sprite.x ,right_icn =Sprite.addr $no-right
POP POP
( draw face ) ( draw face )

View File

@ -1,6 +1,8 @@
( draw routines ) ( draw routines )
%RTN { JMP2r } %RTN { JMP2r }
%++ { #0001 ADD2 }
%8+ { #0008 ADD2 }
;label { x 2 y 2 color 1 addr 2 } ;label { x 2 y 2 color 1 addr 2 }
;pict { x 2 y 2 width 2 height 2 color 1 addr 2 } ;pict { x 2 y 2 width 2 height 2 color 1 addr 2 }
@ -32,7 +34,7 @@ BRK
( load ) =color =rect.y2 =rect.x2 DUP2 =Screen.y =rect.y1 DUP2 =Screen.x =rect.x1 ( load ) =color =rect.y2 =rect.x2 DUP2 =Screen.y =rect.y1 DUP2 =Screen.x =rect.x1
$hor $hor
( incr ) ~Screen.x #0001 ADD2 =Screen.x ( incr ) ~Screen.x ++ =Screen.x
( draw ) ~rect.y1 =Screen.y ~color =Screen.color ( draw ) ~rect.y1 =Screen.y ~color =Screen.color
( draw ) ~rect.y2 =Screen.y ~color =Screen.color ( draw ) ~rect.y2 =Screen.y ~color =Screen.color
,$hor ~Screen.x ~rect.x2 LTH2 JMP2? ,$hor ~Screen.x ~rect.x2 LTH2 JMP2?
@ -40,8 +42,8 @@ BRK
$ver $ver
( draw ) ~rect.x1 =Screen.x ~color =Screen.color ( draw ) ~rect.x1 =Screen.x ~color =Screen.color
( draw ) ~rect.x2 =Screen.x ~color =Screen.color ( draw ) ~rect.x2 =Screen.x ~color =Screen.color
( incr ) ~Screen.y #0001 ADD2 =Screen.y ( incr ) ~Screen.y ++ =Screen.y
,$ver ~Screen.y ~rect.y2 #0001 ADD2 LTH2 JMP2? ,$ver ~Screen.y ~rect.y2 ++ LTH2 JMP2?
RTN RTN
@ -52,9 +54,9 @@ RTN
~rect.x1 =Screen.x ~rect.x1 =Screen.x
$hor $hor
( draw ) ~color =Screen.color ( draw ) ~color =Screen.color
( incr ) ~Screen.x #0001 ADD2 =Screen.x ( incr ) ~Screen.x ++ =Screen.x
,$hor ~Screen.x ~rect.x2 LTH2 JMP2? ,$hor ~Screen.x ~rect.x2 LTH2 JMP2?
( incr ) ~Screen.y #0001 ADD2 =Screen.y ( incr ) ~Screen.y ++ =Screen.y
,$ver ~Screen.y ~rect.y2 LTH2 JMP2? ,$ver ~Screen.y ~rect.y2 LTH2 JMP2?
RTN RTN
@ -66,10 +68,10 @@ RTN
~pict.x =Sprite.x ~pict.x =Sprite.x
$hor $hor
( draw ) ~pict.color =Sprite.color ( draw ) ~pict.color =Sprite.color
( incr ) ~Sprite.x #0008 ADD2 =Sprite.x ( incr ) ~Sprite.x 8+ =Sprite.x
( incr ) ~Sprite.addr #0008 ADD2 =Sprite.addr ( incr ) ~Sprite.addr 8+ =Sprite.addr
,$hor ~Sprite.x ~pict.width ~pict.x ADD2 LTH2 JMP2? ,$hor ~Sprite.x ~pict.width ~pict.x ADD2 LTH2 JMP2?
( incr ) ~Sprite.y #0008 ADD2 =Sprite.y ( incr ) ~Sprite.y 8+ =Sprite.y
,$ver ~Sprite.y ~pict.height ~pict.y ADD2 LTH2 JMP2? ,$ver ~Sprite.y ~pict.height ~pict.y ADD2 LTH2 JMP2?
RTN RTN
@ -79,8 +81,8 @@ RTN
( load ) =label.addr =label.color =Sprite.y =Sprite.x ~label.addr ( load ) =label.addr =label.color =Sprite.y =Sprite.x ~label.addr
$loop $loop
( draw ) DUP2 LDR #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr ~label.color =Sprite.color ( draw ) DUP2 LDR #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr ~label.color =Sprite.color
( incr ) #0001 ADD2 ( incr ) ++
( incr ) ~Sprite.x #0008 ADD2 =Sprite.x ( incr ) ~Sprite.x 8+ =Sprite.x
DUP2 LDR #00 NEQ ,$loop ROT JMP2? DUP2 LDR #00 NEQ ,$loop ROT JMP2?
POP2 POP2

View File

@ -18,6 +18,10 @@
%RTN { JMP2r } %RTN { JMP2r }
%RTN? { JMP2r? } %RTN? { JMP2r? }
%++ { #0001 ADD2 } %-- { #0001 SUB2 }
%8/ { #0003 SHR2 } %8* { #0003 SHL2 }
%8- { #0008 SUB2 } %8+ { #0008 ADD2 }
;lock { byte 1 } ;lock { byte 1 }
;k { byte 1 } ;k { byte 1 }
;l { byte 1 } ;l { byte 1 }
@ -38,7 +42,7 @@
( load file ) ( load file )
,filepath ,load-file JSR2 ,filepath ,load-file JSR2
( place textarea ) ( place textarea )
#0018 =textarea.x1 ~Screen.height #0008 SUB2 =textarea.y2 #0018 =textarea.x1 ~Screen.height 8- =textarea.y2
,select JSR2 ,select JSR2
,redraw JSR2 ,redraw JSR2
@ -54,22 +58,22 @@ BRK
,no-ctrl-up ~Controller #10 NEQ JMP2? ,no-ctrl-up ~Controller #10 NEQ JMP2?
( clamp ) ,no-ctrl-up ~position.y #0000 EQU2 JMP2? ( clamp ) ,no-ctrl-up ~position.y #0000 EQU2 JMP2?
,find-lineoffset JSR2 =position.x ,find-lineoffset JSR2 =position.x
~position.y #0001 SUB2 =position.y ~position.y -- =position.y
,find-selection JSR2 DUP2 =selection.from #0001 ADD2 =selection.to ,find-selection JSR2 DUP2 =selection.from ++ =selection.to
,clamp-selection JSR2 ,follow-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 ,clamp-selection JSR2 ,follow-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2
@no-ctrl-up @no-ctrl-up
,no-ctrl-down ~Controller #20 NEQ JMP2? ,no-ctrl-down ~Controller #20 NEQ JMP2?
,find-lineoffset JSR2 =position.x ~position.y #0001 ADD2 =position.y ,find-lineoffset JSR2 =position.x ~position.y ++ =position.y
,find-selection JSR2 DUP2 =selection.from #0001 ADD2 =selection.to ,find-selection JSR2 DUP2 =selection.from ++ =selection.to
,clamp-selection JSR2 ,follow-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 ,clamp-selection JSR2 ,follow-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2
@no-ctrl-down @no-ctrl-down
,no-ctrl-left ~Controller #40 NEQ JMP2? ,no-ctrl-left ~Controller #40 NEQ JMP2?
( clamp ) ,no-ctrl-left ~selection.from ,document.body EQU2 JMP2? ( clamp ) ,no-ctrl-left ~selection.from ,document.body EQU2 JMP2?
~selection.from #0001 SUB2 DUP2 =selection.from #0001 ADD2 =selection.to ~selection.from -- DUP2 =selection.from ++ =selection.to
,clamp-selection JSR2 ,follow-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 ,clamp-selection JSR2 ,follow-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2
@no-ctrl-left @no-ctrl-left
,no-ctrl-right ~Controller #80 NEQ JMP2? ,no-ctrl-right ~Controller #80 NEQ JMP2?
~selection.from #0001 ADD2 DUP2 =selection.from #0001 ADD2 =selection.to ~selection.from ++ DUP2 =selection.from ++ =selection.to
,clamp-selection JSR2 ,follow-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 ,clamp-selection JSR2 ,follow-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2
@no-ctrl-right @no-ctrl-right
( alt ) ( alt )
@ -83,11 +87,11 @@ BRK
,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 ,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2
@no-adown @no-adown
,no-aleft ~Controller #04 SHR #04 NEQ JMP2? ,no-aleft ~Controller #04 SHR #04 NEQ JMP2?
~selection.to #0001 SUB2 =selection.to ~selection.to -- =selection.to
,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 ,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2
@no-aleft @no-aleft
,no-aright ~Controller #04 SHR #08 NEQ JMP2? ,no-aright ~Controller #04 SHR #08 NEQ JMP2?
~selection.to #0001 ADD2 =selection.to ~selection.to ++ =selection.to
,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 ,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2
@no-aright @no-aright
@no-alt @no-alt
@ -121,20 +125,20 @@ BRK
~selection.to ~selection.from SUB2 ,shift-left JSR2 ~selection.to ~selection.from SUB2 ,shift-left JSR2
,$erase-end JMP2 ,$erase-end JMP2
$erase-multiple $erase-multiple
~selection.from #0001 ADD2 =selection.from ~selection.from ++ =selection.from
~selection.to ~selection.from SUB2 #0001 ADD2 ,shift-left JSR2 ~selection.to ~selection.from SUB2 ++ ,shift-left JSR2
$erase-end $erase-end
~selection.from #0001 SUB2 =selection.from ~selection.from -- =selection.from
,$keys-end JMP2 ,$keys-end JMP2
$no-backspace $no-backspace
( insert ) ( insert )
~selection.to ~selection.from SUB2 ,shift-right JSR2 ~selection.to ~selection.from SUB2 ,shift-right JSR2
~Keys ~selection.from STR ~Keys ~selection.from STR
~selection.from #0001 ADD2 =selection.from ~selection.from ++ =selection.from
$keys-end $keys-end
~selection.from #0001 ADD2 =selection.to ~selection.from ++ =selection.to
( release ) #00 =Keys ( release ) #00 =Keys
,redraw JSR2 ,redraw JSR2
@ -144,7 +148,7 @@ BRK
,no-change ~Mouse.state ~touch.state EQU JMP2? ,no-change ~Mouse.state ~touch.state EQU JMP2?
#0000 =Sprite.x ~Screen.height #0008 SUB2 =Sprite.y #0000 =Sprite.x ~Screen.height 8- =Sprite.y
,mouse00icn =Sprite.addr ,mouse00icn =Sprite.addr
,nobutton1 ~Mouse.state #01 NEQ JMP2? ,mouse01icn =Sprite.addr @nobutton1 ,nobutton1 ~Mouse.state #01 NEQ JMP2? ,mouse01icn =Sprite.addr @nobutton1
,nobutton2 ~Mouse.state #10 NEQ JMP2? ,mouse10icn =Sprite.addr @nobutton2 ,nobutton2 ~Mouse.state #10 NEQ JMP2? ,mouse10icn =Sprite.addr @nobutton2
@ -156,7 +160,7 @@ BRK
,touch-end ~Mouse.state #00 EQU JMP2? ,touch-end ~Mouse.state #00 EQU JMP2?
,touch-linebar ~Mouse.x #0010 LTH2 JMP2? ,touch-linebar ~Mouse.x #0010 LTH2 JMP2?
,touch-body ~Mouse.x ~Screen.width #0008 SUB2 LTH2 JMP2? ,touch-body ~Mouse.x ~Screen.width 8- LTH2 JMP2?
,touch-scrollbar JMP2 ,touch-scrollbar JMP2
@touch-end @touch-end
@ -175,11 +179,11 @@ BRK
( decr ) ~scroll.y #00 ~scroll.y #0000 NEQ2 SUB2 =scroll.y ( decr ) ~scroll.y #00 ~scroll.y #0000 NEQ2 SUB2 =scroll.y
^$end JMP ^$end JMP
$no-up $no-up
,$no-down ~Mouse.y ~Screen.height #0008 SUB2 LTH2 JMP2? ,$no-down ~Mouse.y ~Screen.height 8- LTH2 JMP2?
( incr ) ~scroll.y #0001 ADD2 =scroll.y ( incr ) ~scroll.y ++ =scroll.y
^$end JMP ^$end JMP
$no-down $no-down
~Mouse.y #0008 SUB2 =scroll.y ~Mouse.y 8- =scroll.y
$end $end
,redraw JSR2 ,redraw JSR2
,touch-end JMP2 ,touch-end JMP2
@ -188,8 +192,8 @@ RTN
@touch-linebar @touch-linebar
~Mouse.y #0008 DIV2 ~scroll.y ADD2 =position.y #0000 =position.x ~Mouse.y 8/ ~scroll.y ADD2 =position.y #0000 =position.x
,find-selection JSR2 DUP2 =selection.from #0001 ADD2 =selection.to ,find-selection JSR2 DUP2 =selection.from ++ =selection.to
,redraw JSR2 ,redraw JSR2
,touch-end JMP2 ,touch-end JMP2
@ -197,7 +201,7 @@ RTN
@touch-body @touch-body
~Mouse.y #0008 DIV2 ~scroll.y ADD2 =position.y ~Mouse.y 8/ ~scroll.y ADD2 =position.y
~Mouse.x ~textarea.x1 SUB2 #0007 ADD2 #0007 DIV2 =position.x ~Mouse.x ~textarea.x1 SUB2 #0007 ADD2 #0007 DIV2 =position.x
,$no-chord-cut ~Mouse.chord #01 NEQ JMP2? ,$no-chord-cut ~Mouse.chord #01 NEQ JMP2?
@ -215,12 +219,12 @@ RTN
,$no-drag ~Mouse.state ~touch.state NEQ ~Controller #0f AND #02 NEQ #0101 EQU2 JMP2? ,$no-drag ~Mouse.state ~touch.state NEQ ~Controller #0f AND #02 NEQ #0101 EQU2 JMP2?
( on drag ) ( on drag )
,find-selection JSR2 #0001 ADD2 =selection.to ,find-selection JSR2 ++ =selection.to
,clamp-selection JSR2 ,clamp-selection JSR2
^$end JMP ^$end JMP
$no-drag $no-drag
( on click ) ( on click )
,find-selection JSR2 DUP2 =selection.from #0001 ADD2 =selection.to ,find-selection JSR2 DUP2 =selection.from ++ =selection.to
$end $end
,redraw JSR2 ,redraw JSR2
,touch-end JMP2 ,touch-end JMP2
@ -233,7 +237,7 @@ RTN
( get file length ) ( get file length )
,document.body =document.eof ,document.body =document.eof
$loop NOP $loop NOP
( incr ) ~document.eof #0001 ADD2 =document.eof ( incr ) ~document.eof ++ =document.eof
~document.eof LDR #00 NEQ ^$loop MUL JMP ~document.eof LDR #00 NEQ ^$loop MUL JMP
RTN RTN
@ -257,10 +261,10 @@ RTN
@shift-left ( length ) @shift-left ( length )
=i =i
~selection.from #0001 SUB2 =j ( start -> end ) ~selection.from -- =j ( start -> end )
$loop NOP $loop NOP
( move ) ~j ~i ADD2 LDR ~j STR ( move ) ~j ~i ADD2 LDR ~j STR
( incr ) ~j #0001 ADD2 =j ( incr ) ~j ++ =j
~j ~document.eof LTH2 ^$loop MUL JMP ~j ~document.eof LTH2 ^$loop MUL JMP
~document.eof ~i SUB2 =document.eof ~document.eof ~i SUB2 =document.eof
@ -272,7 +276,7 @@ RTN
~document.eof =j ( end -> start ) ~document.eof =j ( end -> start )
$loop NOP $loop NOP
( move ) ~j ~i SUB2 LDR ~j STR ( move ) ~j ~i SUB2 LDR ~j STR
( decr ) ~j #0001 SUB2 =j ( decr ) ~j -- =j
~j ~selection.from GTH2 ^$loop MUL JMP ~j ~selection.from GTH2 ^$loop MUL JMP
~document.eof ~i ADD2 =document.eof ~document.eof ~i ADD2 =document.eof
@ -283,8 +287,8 @@ RTN
,$no-up ~position.y ~scroll.y GTH2 JMP2? ,$no-up ~position.y ~scroll.y GTH2 JMP2?
~position.y =scroll.y RTN ~position.y =scroll.y RTN
$no-up $no-up
,$no-down ~position.y ~Screen.height #0010 SUB2 #0008 DIV2 ~scroll.y ADD2 LTH2 JMP2? ,$no-down ~position.y ~Screen.height #0010 SUB2 8/ ~scroll.y ADD2 LTH2 JMP2?
~position.y ~Screen.height #0010 SUB2 #0008 DIV2 SUB2 =scroll.y RTN ~position.y ~Screen.height #0010 SUB2 8/ SUB2 =scroll.y RTN
$no-down $no-down
RTN RTN
@ -292,20 +296,20 @@ RTN
@clamp-selection @clamp-selection
~selection.from ~selection.to LTH2 RTN? ~selection.from ~selection.to LTH2 RTN?
~selection.from #0001 ADD2 =selection.to ~selection.from ++ =selection.to
RTN RTN
@goto-linestart @goto-linestart
$loop NOP $loop NOP
~selection.from #0001 SUB2 LDR #0a EQU RTN? ~selection.from -- LDR #0a EQU RTN?
~selection.from #0001 SUB2 LDR #0d EQU RTN? ~selection.from -- LDR #0d EQU RTN?
( decr ) ~selection.from DUP2 =selection.to #0001 SUB2 =selection.from ( decr ) ~selection.from DUP2 =selection.to -- =selection.from
~selection.from LDR #00 NEQ ^$loop MUL JMP ~selection.from LDR #00 NEQ ^$loop MUL JMP
( clamp at document body ) ( clamp at document body )
~selection.from ,document.body GTH2 RTN? ~selection.from ,document.body GTH2 RTN?
,document.body DUP2 =selection.from #0001 ADD2 =selection.to ,document.body DUP2 =selection.from ++ =selection.to
RTN RTN
@ -314,11 +318,11 @@ RTN
$loop NOP $loop NOP
~selection.from LDR #0a EQU RTN? ~selection.from LDR #0a EQU RTN?
~selection.from LDR #0d EQU RTN? ~selection.from LDR #0d EQU RTN?
( incr ) ~selection.from #0001 ADD2 DUP2 #0001 ADD2 =selection.to =selection.from ( incr ) ~selection.from ++ DUP2 ++ =selection.to =selection.from
~selection.from LDR #00 NEQ ^$loop MUL JMP ~selection.from LDR #00 NEQ ^$loop MUL JMP
( clamp at document body ) ( clamp at document body )
~selection.from ,document.eof LTH2 RTN? ~selection.from ,document.eof LTH2 RTN?
,document.eof #0001 SUB2 DUP2 =selection.from #0001 ADD2 =selection.to ,document.eof -- DUP2 =selection.from ++ =selection.to
RTN RTN
@ -326,13 +330,13 @@ RTN
~selection.to =j ~selection.to =j
$loop NOP $loop NOP
( decr ) ~j #0001 SUB2 =j ( decr ) ~j -- =j
,$end ~j LDR #20 EQU JMP2? ,$end ~j LDR #20 EQU JMP2?
,$end ~j LDR #0a EQU JMP2? ,$end ~j LDR #0a EQU JMP2?
,$end ~j LDR #0d EQU JMP2? ,$end ~j LDR #0d EQU JMP2?
~j ,document.body GTH2 ^$loop MUL JMP ~j ,document.body GTH2 ^$loop MUL JMP
$end $end
( return ) ~j #0001 SUB2 ( return ) ~j --
RTN RTN
@ -340,13 +344,13 @@ RTN
~selection.to =j ~selection.to =j
$loop NOP $loop NOP
( incr ) ~j #0001 ADD2 =j ( incr ) ~j ++ =j
,$end ~j LDR #20 EQU JMP2? ,$end ~j LDR #20 EQU JMP2?
,$end ~j LDR #0a EQU JMP2? ,$end ~j LDR #0a EQU JMP2?
,$end ~j LDR #0d EQU JMP2? ,$end ~j LDR #0d EQU JMP2?
~j ,document.body GTH2 ^$loop MUL JMP ~j ,document.body GTH2 ^$loop MUL JMP
$end $end
( return ) ~j #0001 ADD2 ( return ) ~j ++
RTN RTN
@ -354,7 +358,7 @@ RTN
#0000 =j #0000 =j
$loop NOP $loop NOP
( incr ) ~j #0001 ADD2 =j ( incr ) ~j ++ =j
,$end ~selection.from ~j SUB2 LDR #0a EQU JMP2? ,$end ~selection.from ~j SUB2 LDR #0a EQU JMP2?
,$end ~selection.from ~j SUB2 LDR #0d EQU JMP2? ,$end ~selection.from ~j SUB2 LDR #0d EQU JMP2?
~selection.from ~j SUB2 ,document.body GTH2 ^$loop MUL JMP ~selection.from ~j SUB2 ,document.body GTH2 ^$loop MUL JMP
@ -367,11 +371,11 @@ RTN
,document.body =j #0000 =pt.y ,document.body =j #0000 =pt.y
$loop NOP $loop NOP
,$end ~pt.y ~position.y #0001 SUB2 GTH2 JMP2? ,$end ~pt.y ~position.y -- GTH2 JMP2?
,$no-space ~j LDR #0a NEQ ~j LDR #0d NEQ #0101 EQU2 JMP2? ,$no-space ~j LDR #0a NEQ ~j LDR #0d NEQ #0101 EQU2 JMP2?
( incr ) ~pt.y #0001 ADD2 =pt.y ( incr ) ~pt.y ++ =pt.y
$no-space $no-space
( incr ) ~j #0001 ADD2 =j ( incr ) ~j ++ =j
~j LDR #00 NEQ ^$loop MUL JMP ~j LDR #00 NEQ ^$loop MUL JMP
$end $end
( return ) ~j ( return ) ~j
@ -385,8 +389,8 @@ RTN
$loop NOP $loop NOP
,$end ~j ~pt.x ADD2 LDR #0a EQU JMP2? ,$end ~j ~pt.x ADD2 LDR #0a EQU JMP2?
,$end ~j ~pt.x ADD2 LDR #0d EQU JMP2? ,$end ~j ~pt.x ADD2 LDR #0d EQU JMP2?
( incr ) ~pt.x #0001 ADD2 =pt.x ( incr ) ~pt.x ++ =pt.x
~pt.x ~position.x #0001 SUB2 LTH2 ^$loop MUL JMP ~pt.x ~position.x -- LTH2 ^$loop MUL JMP
$end $end
( return ) ~pt.x ADD2 ( return ) ~pt.x ADD2
@ -396,7 +400,7 @@ RTN
,copy JSR2 ,copy JSR2
~selection.to ~selection.from SUB2 ,shift-left JSR2 ~selection.to ~selection.from SUB2 ,shift-left JSR2
~selection.from #0001 ADD2 =selection.to ~selection.from ++ =selection.to
RTN RTN
@ -407,7 +411,7 @@ RTN
~j =clip.len ~j =clip.len
$loop NOP $loop NOP
~selection.from ~i ADD2 LDR ,clip.body ~i ADD2 STR ~selection.from ~i ADD2 LDR ,clip.body ~i ADD2 STR
( incr ) ~i #0001 ADD2 =i ( incr ) ~i ++ =i
~i ~j LTH2 ^$loop MUL JMP ~i ~j LTH2 ^$loop MUL JMP
RTN RTN
@ -419,7 +423,7 @@ RTN
~clip.len =j ( end ) ~clip.len =j ( end )
$loop NOP $loop NOP
,clip.body ~i ADD2 LDR ~selection.from ~i ADD2 STR ,clip.body ~i ADD2 LDR ~selection.from ~i ADD2 STR
( incr ) ~i #0001 ADD2 =i ( incr ) ~i ++ =i
~i ~j LTH2 ^$loop MUL JMP ~i ~j LTH2 ^$loop MUL JMP
RTN RTN
@ -429,15 +433,15 @@ RTN
,document.body =selection.from #0000 =pt.x #0000 =pt.y ,document.body =selection.from #0000 =pt.x #0000 =pt.y
$loop $loop
,$no-space ~selection.from LDR #0a NEQ ~selection.from LDR #0d NEQ #0101 EQU2 JMP2? ,$no-space ~selection.from LDR #0a NEQ ~selection.from LDR #0d NEQ #0101 EQU2 JMP2?
( incr ) ~pt.y #0001 ADD2 =pt.y ( incr ) ~pt.y ++ =pt.y
#0000 =pt.x #0000 =pt.x
$no-space $no-space
,$no-reached ~pt.y ~position.y #0001 SUB2 GTH2 ~pt.x ~position.x #0001 SUB2 GTH2 #0101 NEQ2 JMP2? ,$no-reached ~pt.y ~position.y -- GTH2 ~pt.x ~position.x -- GTH2 #0101 NEQ2 JMP2?
~selection.from #0001 ADD2 =selection.to ~selection.from ++ =selection.to
RTN RTN
$no-reached $no-reached
( incr ) ~pt.x #0001 ADD2 =pt.x ( incr ) ~pt.x ++ =pt.x
( incr ) ~selection.from #0001 ADD2 =selection.from ( incr ) ~selection.from ++ =selection.from
,$loop ~selection.from LDR #00 NEQ JMP2? ,$loop ~selection.from LDR #00 NEQ JMP2?
RTN RTN
@ -451,7 +455,7 @@ RTN
,draw-titlebar JSR2 ,draw-titlebar JSR2
( save/load icons ) ( save/load icons )
~Screen.height #0008 SUB2 =Sprite.y ~Screen.height 8- =Sprite.y
~Screen.width #0018 SUB2 =Sprite.x ~Screen.width #0018 SUB2 =Sprite.x
,load_icn =Sprite.addr ,load_icn =Sprite.addr
#02 =Sprite.color #02 =Sprite.color
@ -466,14 +470,14 @@ RTN
=addr =addr
,font_hex #00 ,addr LDR #f0 AND #04 SHR #08 MUL ADD2 =Sprite.addr ,font_hex #00 ,addr LDR #f0 AND #04 SHR #08 MUL ADD2 =Sprite.addr
( draw ) #0e =Sprite.color ( draw ) #0e =Sprite.color
~Sprite.x #0008 ADD2 =Sprite.x ~Sprite.x 8+ =Sprite.x
,font_hex #00 ,addr LDR #0f AND #08 MUL ADD2 =Sprite.addr ,font_hex #00 ,addr LDR #0f AND #08 MUL ADD2 =Sprite.addr
( draw ) #0e =Sprite.color ( draw ) #0e =Sprite.color
~Sprite.x #0008 ADD2 =Sprite.x ~Sprite.x 8+ =Sprite.x
,font_hex #00 ,addr #0001 ADD2 LDR #f0 AND #04 SHR #08 MUL ADD2 =Sprite.addr ,font_hex #00 ,addr ++ LDR #f0 AND #04 SHR #08 MUL ADD2 =Sprite.addr
( draw ) #0e =Sprite.color ( draw ) #0e =Sprite.color
~Sprite.x #0008 ADD2 =Sprite.x ~Sprite.x 8+ =Sprite.x
,font_hex #00 ,addr #0001 ADD2 LDR #0f AND #08 MUL ADD2 =Sprite.addr ,font_hex #00 ,addr ++ LDR #0f AND #08 MUL ADD2 =Sprite.addr
( draw ) #0e =Sprite.color ( draw ) #0e =Sprite.color
RTN RTN
@ -512,9 +516,9 @@ RTN
$find-offset NOP $find-offset NOP
,$find-offset-end ~scroll.y ~j EQU2 JMP2? ,$find-offset-end ~scroll.y ~j EQU2 JMP2?
,$no-break ~textarea.addr LDR #0a NEQ ~textarea.addr LDR #0d NEQ #0101 EQU2 JMP2? ,$no-break ~textarea.addr LDR #0a NEQ ~textarea.addr LDR #0d NEQ #0101 EQU2 JMP2?
( incr ) ~j #0001 ADD2 =j ( incr ) ~j ++ =j
$no-break $no-break
( incr ) ~textarea.addr #0001 ADD2 =textarea.addr ( incr ) ~textarea.addr ++ =textarea.addr
~textarea.addr LDR #00 NEQ ^$find-offset MUL JMP ~textarea.addr LDR #00 NEQ ^$find-offset MUL JMP
$find-offset-end $find-offset-end
@ -526,10 +530,10 @@ RTN
,$end ~Sprite.y ~Screen.height #0010 SUB2 GTH2 JMP2? ,$end ~Sprite.y ~Screen.height #0010 SUB2 GTH2 JMP2?
( get character ) ( get character )
,font #00 ~i LDR #20 SUB #0008 MUL2 ADD2 =Sprite.addr ,font #00 ~i LDR #20 SUB 8* ADD2 =Sprite.addr
( draw ) #01 ( draw ) #01
~i ~selection.from #0001 SUB2 GTH2 ~i ~selection.from -- GTH2
~i ~selection.to LTH2 #0101 EQU2 ~i ~selection.to LTH2 #0101 EQU2
#05 MUL ADD ~i ~selection.from EQU2 ADD =Sprite.color #05 MUL ADD ~i ~selection.from EQU2 ADD =Sprite.color
@ -537,20 +541,20 @@ RTN
( draw linebreak ) ( draw linebreak )
,linebreak_icn =Sprite.addr ,linebreak_icn =Sprite.addr
( draw ) #02 ( draw ) #02
~i ~selection.from #0001 SUB2 GTH2 ~i ~selection.from -- GTH2
~i ~selection.to LTH2 #0101 EQU2 ~i ~selection.to LTH2 #0101 EQU2
#06 MUL ADD =Sprite.color #06 MUL ADD =Sprite.color
( fill clear ) ( fill clear )
$fill-clear $fill-clear
( incr ) ~Sprite.x #0008 ADD2 =Sprite.x ( incr ) ~Sprite.x 8+ =Sprite.x
,font =Sprite.addr ,font =Sprite.addr
#01 =Sprite.color #01 =Sprite.color
,$fill-clear ~Sprite.x ~Screen.width #0008 SUB2 LTH2 JMP2? ,$fill-clear ~Sprite.x ~Screen.width 8- LTH2 JMP2?
( draw line number ) ( draw line number )
#0000 =Sprite.x #0000 =Sprite.x
~scroll.y ~Sprite.y #0008 DIV2 ADD2 DUP2 SWP POP =k ~scroll.y ~Sprite.y 8/ ADD2 DUP2 SWP POP =k
~position.y EQU2 #0c MUL =l ~position.y EQU2 #0c MUL =l
,font_hex #00 ~k #f0 AND #04 SHR #08 MUL ADD2 =Sprite.addr ,font_hex #00 ~k #f0 AND #04 SHR #08 MUL ADD2 =Sprite.addr
#02 ~l ADD =Sprite.color #02 ~l ADD =Sprite.color
@ -559,10 +563,10 @@ RTN
#02 ~l ADD =Sprite.color #02 ~l ADD =Sprite.color
#0010 =Sprite.x #0010 =Sprite.x
( incr ) ~Sprite.y #0008 ADD2 =Sprite.y ( incr ) ~Sprite.y 8+ =Sprite.y
$no-linebreak $no-linebreak
( incr ) ~i #0001 ADD2 =i ( incr ) ~i ++ =i
( incr ) ~Sprite.x #0007 ADD2 =Sprite.x ( incr ) ~Sprite.x #0007 ADD2 =Sprite.x
,$loop ~i LDR #00 NEQ JMP2? ,$loop ~i LDR #00 NEQ JMP2?
@ -573,13 +577,13 @@ RTN
@draw-scrollbar @draw-scrollbar
~Screen.width #0008 SUB2 =Sprite.x ~Screen.width 8- =Sprite.x
#0000 =Sprite.y #0000 =Sprite.y
,scrollbar_bg =Sprite.addr ,scrollbar_bg =Sprite.addr
$loop NOP $loop NOP
( draw ) #08 =Sprite.color ( draw ) #08 =Sprite.color
( incr ) ~Sprite.y #0008 ADD2 =Sprite.y ( incr ) ~Sprite.y 8+ =Sprite.y
~Sprite.y ~Screen.height LTH2 ^$loop MUL JMP ~Sprite.y ~Screen.height LTH2 ^$loop MUL JMP
#0000 =Sprite.y #0000 =Sprite.y
@ -587,11 +591,11 @@ RTN
( draw ) #08 =Sprite.color ( draw ) #08 =Sprite.color
( at ) ( at )
~scroll.y #0008 ADD2 =Sprite.y ~scroll.y 8+ =Sprite.y
,scrollbar_fg =Sprite.addr ,scrollbar_fg =Sprite.addr
( draw ) #08 =Sprite.color ( draw ) #08 =Sprite.color
~Screen.height #0008 SUB2 =Sprite.y ~Screen.height 8- =Sprite.y
,arrowdown_icn =Sprite.addr ,arrowdown_icn =Sprite.addr
( draw ) #08 =Sprite.color ( draw ) #08 =Sprite.color
@ -599,13 +603,13 @@ RTN
@draw-titlebar @draw-titlebar
#0018 ~Screen.height #0008 SUB2 #09 ,filepath #0018 ~Screen.height 8- #09 ,filepath
( load ) =label.addr =label.color =Sprite.y =Sprite.x ( load ) =label.addr =label.color =Sprite.y =Sprite.x
~label.addr ~label.addr
$loop NOP $loop NOP
( draw ) DUP2 LDR #00 SWP #20 SUB #0008 MUL2 ,font ADD2 =Sprite.addr ~label.color =Sprite.color ( draw ) DUP2 LDR #00 SWP #20 SUB 8* ,font ADD2 =Sprite.addr ~label.color =Sprite.color
( incr ) #0001 ADD2 ( incr ) ++
( incr ) ~Sprite.x #0008 ADD2 =Sprite.x ( incr ) ~Sprite.x 8+ =Sprite.x
DUP2 LDR #00 NEQ ^$loop MUL JMP DUP2 LDR #00 NEQ ^$loop MUL JMP
POP2 POP2
( selection ) ( selection )

View File

@ -6,8 +6,14 @@
1 2 3 - Select brush 1 2 3 - Select brush
) )
%RTN { JMP2r } %RTN { JMP2r }
%RTN? { JMP2r? } %RTN? { JMP2r? }
%STEP8 { #0003 SHR2 #0003 SHL2 }
%++ { #0001 ADD2 }
%2/ { #0001 SHR2 } %2* { #0001 SHL2 }
%8/ { #0003 SHR2 } %8* { #0003 SHL2 }
%8- { #0008 SUB2 } %8+ { #0008 ADD2 }
;bankview { x 2 y 2 mode 1 addr 2 } ;bankview { x 2 y 2 mode 1 addr 2 }
;tileview { x 2 y 2 addr 2 } ;tileview { x 2 y 2 addr 2 }
@ -21,12 +27,12 @@
|0100 @RESET |0100 @RESET
~SCRN.width #0002 DIV2 #008a SUB2 =bankview.x ~SCRN.width 2/ #008a SUB2 =bankview.x
~SCRN.height #0002 DIV2 #003f SUB2 =bankview.y ~SCRN.height 2/ #003f SUB2 =bankview.y
,bank1 =bankview.addr ,bank1 =bankview.addr
~SCRN.width #0002 DIV2 #0002 ADD2 =tileview.x ~SCRN.width 2/ #0002 ADD2 =tileview.x
~SCRN.height #0002 DIV2 #003f SUB2 =tileview.y ~SCRN.height 2/ #003f SUB2 =tileview.y
,bank1 #0448 ADD2 =tileview.addr ,bank1 #0448 ADD2 =tileview.addr
,redraw JSR2 ,redraw JSR2
@ -56,10 +62,10 @@ BRK
~tileview.addr #0080 SUB2 =tileview.addr ~tileview.addr #0080 SUB2 =tileview.addr
@no-ctrl-down @no-ctrl-down
,no-ctrl-left ~CTRL.buttons #40 EQU JMP2? ,no-ctrl-left ~CTRL.buttons #40 EQU JMP2?
~tileview.addr #0008 ADD2 =tileview.addr ~tileview.addr 8+ =tileview.addr
@no-ctrl-left @no-ctrl-left
,no-ctrl-right ~CTRL.buttons #80 EQU JMP2? ,no-ctrl-right ~CTRL.buttons #80 EQU JMP2?
~tileview.addr #0008 SUB2 =tileview.addr ~tileview.addr 8- =tileview.addr
@no-ctrl-right @no-ctrl-right
~tileview.addr #0800 DIV2 #0800 MUL2 =bankview.addr ~tileview.addr #0800 DIV2 #0800 MUL2 =bankview.addr
,redraw JSR2 ,redraw JSR2
@ -72,24 +78,24 @@ BRK
( toolbar ) ( toolbar )
,no-toolbar-click ~MOUS.y ~bankview.y #0010 SUB2 SUB2 #0008 DIV2 #0000 NEQ2 JMP2? ,no-toolbar-click ~MOUS.y ~bankview.y #0010 SUB2 SUB2 8/ #0000 NEQ2 JMP2?
( brush ) ( brush )
,no-brush-click ~MOUS.x ~bankview.x SUB2 #0008 DIV2 #000d LTH2 JMP2? ,no-brush-click ~MOUS.x ~bankview.x SUB2 8/ #000d LTH2 JMP2?
,no-brush-click ~MOUS.x ~bankview.x SUB2 #0008 DIV2 #000f GTH2 JMP2? ,no-brush-click ~MOUS.x ~bankview.x SUB2 8/ #000f GTH2 JMP2?
( select ) ~mouse.x ~bankview.x SUB2 #0008 DIV2 #000d SUB2 SWP POP =bankview.mode ( select ) ~mouse.x ~bankview.x SUB2 8/ #000d SUB2 SWP POP =bankview.mode
( release ) #00 =MOUS.state ( release ) #00 =MOUS.state
,redraw JSR2 ,click-end JMP2 ,redraw JSR2 ,click-end JMP2
@no-brush-click @no-brush-click
,no-load-click ~MOUS.x ~tileview.x SUB2 #0008 DIV2 #000e NEQU2 JMP2? ,no-load-click ~MOUS.x ~tileview.x SUB2 8/ #000e NEQU2 JMP2?
( load ) ,filename =FILE.name #0800 =FILE.length ~bankview.addr =FILE.load ( load ) ,filename =FILE.name #0800 =FILE.length ~bankview.addr =FILE.load
( release ) #00 =MOUS.state ( release ) #00 =MOUS.state
,redraw JSR2 ,click-end JMP2 ,redraw JSR2 ,click-end JMP2
@no-load-click @no-load-click
,no-save-click ~MOUS.x ~tileview.x SUB2 #0008 DIV2 #000f NEQU2 JMP2? ,no-save-click ~MOUS.x ~tileview.x SUB2 8/ #000f NEQU2 JMP2?
( save ) ,filename =FILE.name #0800 =FILE.length ~bankview.addr =FILE.save ( save ) ,filename =FILE.name #0800 =FILE.length ~bankview.addr =FILE.save
( release ) #00 =MOUS.state ( release ) #00 =MOUS.state
,redraw JSR2 ,click-end JMP2 ,redraw JSR2 ,click-end JMP2
@ -108,8 +114,8 @@ BRK
@copy-loop NOP @copy-loop NOP
( load ) ~tileview.addr ~i ADD LDR ( load ) ~tileview.addr ~i ADD LDR
( get touch addr ) ( get touch addr )
~MOUS.x ~bankview.x SUB2 #0008 DIV2 #0008 MUL2 ~MOUS.x ~bankview.x SUB2 STEP8
~MOUS.y ~bankview.y SUB2 #0008 DIV2 #0008 MUL2 #0010 MUL2 ADD2 ~MOUS.y ~bankview.y SUB2 STEP8 #0010 MUL2 ADD2
~bankview.addr ADD2 #00 ~i ADD2 STR ~bankview.addr ADD2 #00 ~i ADD2 STR
( incr ) ~i #01 ADD =i ( incr ) ~i #01 ADD =i
~i #08 LTH ^copy-loop MUL JMP ~i #08 LTH ^copy-loop MUL JMP
@ -121,16 +127,16 @@ BRK
@erase-loop NOP @erase-loop NOP
#00 #00
( get touch addr ) ( get touch addr )
~MOUS.x ~bankview.x SUB2 #0008 DIV2 #0008 MUL2 ~MOUS.x ~bankview.x SUB2 STEP8
~MOUS.y ~bankview.y SUB2 #0008 DIV2 #0008 MUL2 #0010 MUL2 ADD2 ~MOUS.y ~bankview.y SUB2 STEP8 #0010 MUL2 ADD2
~bankview.addr ADD2 #00 ~i ADD2 STR ~bankview.addr ADD2 #00 ~i ADD2 STR
( incr ) ~i #01 ADD =i ( incr ) ~i #01 ADD =i
~i #08 LTH ^erase-loop MUL JMP ~i #08 LTH ^erase-loop MUL JMP
,redraw JSR2 ,click-end JMP2 ,redraw JSR2 ,click-end JMP2
@not-erase-mode @not-erase-mode
~MOUS.x ~bankview.x SUB2 #0008 DIV2 #0008 MUL2 ~MOUS.x ~bankview.x SUB2 STEP8
~MOUS.y ~bankview.y SUB2 #0008 DIV2 #0008 MUL2 #0010 MUL2 ADD2 ~MOUS.y ~bankview.y SUB2 STEP8 #0010 MUL2 ADD2
~bankview.addr ADD2 =tileview.addr ~bankview.addr ADD2 =tileview.addr
,redraw JSR2 ,click-end JMP2 ,redraw JSR2 ,click-end JMP2
@ -142,39 +148,39 @@ BRK
~MOUS.y ~tileview.y GTH2 ~MOUS.y ~tileview.y #0080 ADD2 LTH2 #0101 EQU2 ~MOUS.y ~tileview.y GTH2 ~MOUS.y ~tileview.y #0080 ADD2 LTH2 #0101 EQU2
#0101 NEQ2 ,no-tile-click ROT JMP2? #0101 NEQ2 ,no-tile-click ROT JMP2?
~MOUS.x ~tileview.x SUB2 #0008 DIV2 #0008 MUL2 #0040 DIV2 ~MOUS.x ~tileview.x SUB2 STEP8 #0040 DIV2
~MOUS.y ~tileview.y SUB2 #0008 DIV2 #0008 MUL2 #0040 DIV2 #0002 MUL2 ADD2 ~MOUS.y ~tileview.y SUB2 STEP8 #0040 DIV2 2* ADD2
#0008 MUL2 8*
~tileview.addr ADD2 =addr ( addr offset ) ~tileview.addr ADD2 =addr ( addr offset )
~MOUS.x ~tileview.x SUB2 ~MOUS.x ~tileview.x SUB2 #0040 DIV2 #0040 MUL2 SUB2 =pos.x ~MOUS.x ~tileview.x SUB2 ~MOUS.x ~tileview.x SUB2 #0040 DIV2 #0040 MUL2 SUB2 =pos.x
~MOUS.y ~tileview.y SUB2 ~MOUS.y ~tileview.y SUB2 #0040 DIV2 #0040 MUL2 SUB2 =pos.y ~MOUS.y ~tileview.y SUB2 ~MOUS.y ~tileview.y SUB2 #0040 DIV2 #0040 MUL2 SUB2 =pos.y
,no-fill-mode ~bankview.mode #01 NEQ JMP2? ,no-fill-mode ~bankview.mode #01 NEQ JMP2?
( fill row ) #ff ~addr ~pos.y #0008 DIV2 ADD2 STR ( fill row ) #ff ~addr ~pos.y 8/ ADD2 STR
,redraw JSR2 ,click-end JMP2 ,redraw JSR2 ,click-end JMP2
@no-fill-mode @no-fill-mode
,no-erase-mode ~bankview.mode #02 NEQ JMP2? ,no-erase-mode ~bankview.mode #02 NEQ JMP2?
( erase row ) #00 ~addr ~pos.y #0008 DIV2 ADD2 STR ( erase row ) #00 ~addr ~pos.y 8/ ADD2 STR
,redraw JSR2 ,click-end JMP2 ,redraw JSR2 ,click-end JMP2
@no-erase-mode @no-erase-mode
( load ) ~addr ~pos.y #0008 DIV2 ADD2 LDR ( load ) ~addr ~pos.y 8/ ADD2 LDR
( mask ) #01 #07 ~pos.x #0008 DIV2 SWP POP SUB SHL ( mask ) #01 #07 ~pos.x 8/ SWP POP SUB SHL
XOR XOR
( save ) ~addr ~pos.y #0008 DIV2 ADD2 STR ( save ) ~addr ~pos.y 8/ ADD2 STR
,redraw JSR2 ,click-end JMP2 ,redraw JSR2 ,click-end JMP2
@no-tile-click @no-tile-click
( operations ) ( operations )
,no-operations ~MOUS.y ~tileview.y SUB2 #0008 DIV2 #000c NEQ2 JMP2? ,no-operations ~MOUS.y ~tileview.y SUB2 8/ #000c NEQ2 JMP2?
,no-move-up ~MOUS.x ~tileview.x SUB2 #0008 DIV2 #0011 NEQ2 JMP2? ,no-move-up ~MOUS.x ~tileview.x SUB2 8/ #0011 NEQ2 JMP2?
,op_shiftup JSR2 ,op_shiftup JSR2
( release ) #00 =MOUS.state ( release ) #00 =MOUS.state
,redraw JSR2 ,click-end JMP2 ,redraw JSR2 ,click-end JMP2
@no-move-up @no-move-up
,no-move-down ~MOUS.x ~tileview.x SUB2 #0008 DIV2 #0012 NEQ2 JMP2? ,no-move-down ~MOUS.x ~tileview.x SUB2 8/ #0012 NEQ2 JMP2?
,op_shiftdown JSR2 ,op_shiftdown JSR2
( release ) #00 =MOUS.state ( release ) #00 =MOUS.state
,redraw JSR2 ,click-end JMP2 ,redraw JSR2 ,click-end JMP2
@ -240,11 +246,11 @@ RTN
,tool_selector =SPRT.addr ,tool_selector =SPRT.addr
#01 ~bankview.mode #00 EQU ADD =SPRT.color #01 ~bankview.mode #00 EQU ADD =SPRT.color
~SPRT.x #0008 ADD2 =SPRT.x ~SPRT.x 8+ =SPRT.x
,tool_hand =SPRT.addr ,tool_hand =SPRT.addr
#01 ~bankview.mode #01 EQU ADD =SPRT.color #01 ~bankview.mode #01 EQU ADD =SPRT.color
~SPRT.x #0008 ADD2 =SPRT.x ~SPRT.x 8+ =SPRT.x
,tool_eraser =SPRT.addr ,tool_eraser =SPRT.addr
#01 ~bankview.mode #02 EQU ADD =SPRT.color #01 ~bankview.mode #02 EQU ADD =SPRT.color
@ -266,7 +272,7 @@ RTN
~bankview.x #00 ~i #08 MUL ADD2 =SPRT.x ~bankview.x #00 ~i #08 MUL ADD2 =SPRT.x
~bankview.y #0088 ADD2 =SPRT.y ~bankview.y #0088 ADD2 =SPRT.y
( draw ) #02 =SPRT.color ( draw ) #02 =SPRT.color
~SPRT.addr #0008 ADD2 =SPRT.addr ~SPRT.addr 8+ =SPRT.addr
( incr ) ~i #01 ADD =i ( incr ) ~i #01 ADD =i
,$guides ~i #10 LTH JMP2? ,$guides ~i #10 LTH JMP2?
@ -283,12 +289,12 @@ RTN
,$no-highlight ~SPRT.addr ~tileview.addr #0018 ADD2 GTH2 JMP2? ,$no-highlight ~SPRT.addr ~tileview.addr #0018 ADD2 GTH2 JMP2?
( draw ) #0c =SPRT.color ( draw ) #0c =SPRT.color
$no-highlight $no-highlight
( incr ) ~SPRT.x #0008 ADD2 =SPRT.x ( incr ) ~SPRT.x 8+ =SPRT.x
( incr ) ~SPRT.addr #0008 ADD2 =SPRT.addr ( incr ) ~SPRT.addr 8+ =SPRT.addr
( incr ) ~pt.x #01 ADD =pt.x ( incr ) ~pt.x #01 ADD =pt.x
,$hor ~pt.x #10 LTH JMP2? ,$hor ~pt.x #10 LTH JMP2?
( incr ) ~pt.y #01 ADD =pt.y ( incr ) ~pt.y #01 ADD =pt.y
( incr ) ~SPRT.y #0008 ADD2 =SPRT.y ( incr ) ~SPRT.y 8+ =SPRT.y
,$ver ~pt.y #10 LTH JMP2? ,$ver ~pt.y #10 LTH JMP2?
RTN RTN
@ -317,17 +323,17 @@ RTN
~tileview.x #0040 ADD2 =SPRT.x ~tileview.x #0040 ADD2 =SPRT.x
~tileview.y =SPRT.y ~tileview.y =SPRT.y
~tileview.addr #0008 ADD2 =tileview.addr ~tileview.addr 8+ =tileview.addr
,draw-tileview-icn JSR2 ,draw-tileview-icn JSR2
~tileview.x =SPRT.x ~tileview.x =SPRT.x
~tileview.y #0040 ADD2 =SPRT.y ~tileview.y #0040 ADD2 =SPRT.y
~tileview.addr #0008 ADD2 =tileview.addr ~tileview.addr 8+ =tileview.addr
,draw-tileview-icn JSR2 ,draw-tileview-icn JSR2
~tileview.x #0040 ADD2 =SPRT.x ~tileview.x #0040 ADD2 =SPRT.x
~tileview.y #0040 ADD2 =SPRT.y ~tileview.y #0040 ADD2 =SPRT.y
~tileview.addr #0008 ADD2 =tileview.addr ~tileview.addr 8+ =tileview.addr
,draw-tileview-icn JSR2 ,draw-tileview-icn JSR2
( line hor ) ( line hor )
@ -356,19 +362,19 @@ RTN
~tileview.x #0088 ADD2 =SPRT.x ~tileview.x #0088 ADD2 =SPRT.x
,font_hex #00 ~tileview.addr #00 ~i ADD2 LDR #f0 AND #04 SHR #08 MUL ADD2 =SPRT.addr ,font_hex #00 ~tileview.addr #00 ~i ADD2 LDR #f0 AND #04 SHR #08 MUL ADD2 =SPRT.addr
( draw ) #02 =SPRT.color ( draw ) #02 =SPRT.color
~SPRT.x #0008 ADD2 =SPRT.x ~SPRT.x 8+ =SPRT.x
,font_hex #00 ~tileview.addr #00 ~i ADD2 LDR #0f AND #08 MUL ADD2 =SPRT.addr ,font_hex #00 ~tileview.addr #00 ~i ADD2 LDR #0f AND #08 MUL ADD2 =SPRT.addr
( draw ) #02 =SPRT.color ( draw ) #02 =SPRT.color
( incr ) ~i #01 ADD =i ( incr ) ~i #01 ADD =i
( incr ) ~SPRT.y #0008 ADD2 =SPRT.y ( incr ) ~SPRT.y 8+ =SPRT.y
,$bytes ~i #08 LTH JMP2? ,$bytes ~i #08 LTH JMP2?
( operations ) ( operations )
~SPRT.y #0008 ADD2 =SPRT.y ~SPRT.y 8+ =SPRT.y
,movedown_icn =SPRT.addr ,movedown_icn =SPRT.addr
#01 =SPRT.color #01 =SPRT.color
~SPRT.x #0008 SUB2 =SPRT.x ~SPRT.x 8- =SPRT.x
,moveup_icn =SPRT.addr ,moveup_icn =SPRT.addr
#01 =SPRT.color #01 =SPRT.color
@ -381,12 +387,12 @@ RTN
~tileview.x #0088 ADD2 =SPRT.x ~tileview.x #0088 ADD2 =SPRT.x
$tiles-hor $tiles-hor
( draw ) #03 =SPRT.color ( draw ) #03 =SPRT.color
( incr ) ~SPRT.x #0008 ADD2 =SPRT.x ( incr ) ~SPRT.x 8+ =SPRT.x
( incr ) ~SPRT.addr #0008 ADD2 =SPRT.addr ( incr ) ~SPRT.addr 8+ =SPRT.addr
( incr ) ~pt.x #01 ADD =pt.x ( incr ) ~pt.x #01 ADD =pt.x
,$tiles-hor ~pt.x #02 LTH JMP2? ,$tiles-hor ~pt.x #02 LTH JMP2?
( incr ) ~pt.y #01 ADD =pt.y ( incr ) ~pt.y #01 ADD =pt.y
( incr ) ~SPRT.y #0008 ADD2 =SPRT.y ( incr ) ~SPRT.y 8+ =SPRT.y
,$tiles-ver ~pt.y #02 LTH JMP2? ,$tiles-ver ~pt.y #02 LTH JMP2?
RTN RTN
@ -400,12 +406,12 @@ RTN
( get bit ) ( get bit )
,blank_icn #00 ,blank_icn #00
~tileview.addr #00 ~pt.y ADD2 LDR #07 ~pt.x SUB SHR #01 AND ( get bit ) ~tileview.addr #00 ~pt.y ADD2 LDR #07 ~pt.x SUB SHR #01 AND ( get bit )
#0008 MUL2 ADD2 =SPRT.addr ( add *8 ) 8* ADD2 =SPRT.addr ( add *8 )
( draw ) #01 =SPRT.color ( draw ) #01 =SPRT.color
( incr ) ~SPRT.x #0008 ADD2 =SPRT.x ( incr ) ~SPRT.x 8+ =SPRT.x
( incr ) ~pt.x #01 ADD =pt.x ( incr ) ~pt.x #01 ADD =pt.x
,$hor ~pt.x #08 LTH JMP2? ,$hor ~pt.x #08 LTH JMP2?
( incr ) ~SPRT.y #0008 ADD2 =SPRT.y ( incr ) ~SPRT.y 8+ =SPRT.y
( incr ) ~pt.y #01 ADD =pt.y ( incr ) ~pt.y #01 ADD =pt.y
~SPRT.x #0040 SUB2 =SPRT.x ~SPRT.x #0040 SUB2 =SPRT.x
,$ver ~pt.y #08 LTH JMP2? ,$ver ~pt.y #08 LTH JMP2?
@ -442,14 +448,14 @@ RTN
=addr =addr
,font_hex #00 ,addr LDR #f0 AND #04 SHR #08 MUL ADD2 =SPRT.addr ,font_hex #00 ,addr LDR #f0 AND #04 SHR #08 MUL ADD2 =SPRT.addr
( draw ) #02 =SPRT.color ( draw ) #02 =SPRT.color
~SPRT.x #0008 ADD2 =SPRT.x ~SPRT.x 8+ =SPRT.x
,font_hex #00 ,addr LDR #0f AND #08 MUL ADD2 =SPRT.addr ,font_hex #00 ,addr LDR #0f AND #08 MUL ADD2 =SPRT.addr
( draw ) #02 =SPRT.color ( draw ) #02 =SPRT.color
~SPRT.x #0008 ADD2 =SPRT.x ~SPRT.x 8+ =SPRT.x
,font_hex #00 ,addr #0001 ADD2 LDR #f0 AND #04 SHR #08 MUL ADD2 =SPRT.addr ,font_hex #00 ,addr ++ LDR #f0 AND #04 SHR #08 MUL ADD2 =SPRT.addr
( draw ) #02 =SPRT.color ( draw ) #02 =SPRT.color
~SPRT.x #0008 ADD2 =SPRT.x ~SPRT.x 8+ =SPRT.x
,font_hex #00 ,addr #0001 ADD2 LDR #0f AND #08 MUL ADD2 =SPRT.addr ,font_hex #00 ,addr ++ LDR #0f AND #08 MUL ADD2 =SPRT.addr
( draw ) #02 =SPRT.color ( draw ) #02 =SPRT.color
RTN RTN
@ -460,7 +466,7 @@ RTN
( load ) =color =rect.y2 =rect.x2 DUP2 =SCRN.y =rect.y1 DUP2 =SCRN.x =rect.x1 ( load ) =color =rect.y2 =rect.x2 DUP2 =SCRN.y =rect.y1 DUP2 =SCRN.x =rect.x1
$hor NOP $hor NOP
( incr ) ~SCRN.x #0001 ADD2 =SCRN.x ( incr ) ~SCRN.x ++ =SCRN.x
( draw ) ~rect.y1 =SCRN.y ~color =SCRN.color ( draw ) ~rect.y1 =SCRN.y ~color =SCRN.color
( draw ) ~rect.y2 =SCRN.y ~color =SCRN.color ( draw ) ~rect.y2 =SCRN.y ~color =SCRN.color
~SCRN.x ~rect.x2 LTH2 ^$hor MUL JMP ~SCRN.x ~rect.x2 LTH2 ^$hor MUL JMP
@ -468,8 +474,8 @@ RTN
$ver NOP $ver NOP
( draw ) ~rect.x1 =SCRN.x ~color =SCRN.color ( draw ) ~rect.x1 =SCRN.x ~color =SCRN.color
( draw ) ~rect.x2 =SCRN.x ~color =SCRN.color ( draw ) ~rect.x2 =SCRN.x ~color =SCRN.color
( incr ) ~SCRN.y #0001 ADD2 =SCRN.y ( incr ) ~SCRN.y ++ =SCRN.y
~SCRN.y ~rect.y2 #0001 ADD2 LTH2 ^$ver MUL JMP ~SCRN.y ~rect.y2 ++ LTH2 ^$ver MUL JMP
RTN RTN