uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit 8e2a8df848f4ae2bfe775263a786b5d67103dece
parent 47a57952e87d071246c0ce8315c0276142511771
Author: neauoire <aliceffekt@gmail.com>
Date:   Fri, 26 Mar 2021 11:19:19 -0700

JNZ now uses the flag last

Diffstat:
Mbuild.sh | 2+-
Mprojects/examples/dev.controller.usm | 14+++++++-------
Mprojects/examples/dev.keys.usm | 7+++++--
Mprojects/examples/dev.mouse.usm | 7+++----
Mprojects/examples/dev.screen.usm | 50+++++++++++++++++++++++++-------------------------
Mprojects/examples/gui.editor.usm | 12++++++------
Mprojects/examples/gui.hover.usm | 20++++++++++----------
Mprojects/examples/gui.picture.usm | 4++--
Mprojects/examples/gui.shapes.usm | 24++++++++++++------------
Mprojects/software/left.usm | 118++++++++++++++++++++++++++++++++++++++++----------------------------------------
Mprojects/software/nasu.usm | 66+++++++++++++++++++++++++++++++++---------------------------------
Mprojects/software/noodle.usm | 174++++++++++++++++++++++++++++++++++++++++----------------------------------------
Msrc/uxn.c | 4++--
13 files changed, 252 insertions(+), 250 deletions(-)

diff --git a/build.sh b/build.sh @@ -28,7 +28,7 @@ else fi echo "Assembling.." -./bin/assembler projects/examples/gui.shapes.usm bin/boot.rom +./bin/assembler projects/software/noodle.usm bin/boot.rom echo "Running.." if [ "${2}" = '--cli' ]; diff --git a/projects/examples/dev.controller.usm b/projects/examples/dev.controller.usm @@ -30,7 +30,7 @@ BRK @FRAME - ,on-ctrl-arrows ~Controller.p1 JNZ2 + ~Controller.p1 ,on-ctrl-arrows JNZ2 BRK @@ -42,21 +42,21 @@ BRK ( hold ctrl key to change slime color ) ~Controller.p1 #0f AND - DUP #01 NEQ ,$no-ctrl ROT JNZ2 #05 =slime $no-ctrl - DUP #02 NEQ ,$no-alt ROT JNZ2 #0f =slime $no-alt + DUP #01 NEQ ,$no-ctrl JNZ2 #05 =slime $no-ctrl + DUP #02 NEQ ,$no-alt JNZ2 #0f =slime $no-alt POP ( clear ) #10 =Sprite.color ( detect movement ) ~Controller.p1 #f0 AND - DUP #04 SFT #01 AND #01 NEQ ,$no-up ROT JNZ2 + DUP #04 SFT #01 AND #01 NEQ ,$no-up JNZ2 ( move ) ~Sprite.y -- =Sprite.y ,up_icn =Sprite.addr $no-up - DUP #05 SFT #01 AND #01 NEQ ,$no-down ROT JNZ2 + DUP #05 SFT #01 AND #01 NEQ ,$no-down JNZ2 ( move ) ~Sprite.y ++ =Sprite.y ,down_icn =Sprite.addr $no-down - DUP #06 SFT #01 AND #01 NEQ ,$no-left ROT JNZ2 + DUP #06 SFT #01 AND #01 NEQ ,$no-left JNZ2 ( move ) ~Sprite.x -- =Sprite.x ,left_icn =Sprite.addr $no-left - DUP #07 SFT #01 AND #01 NEQ ,$no-right ROT JNZ2 + DUP #07 SFT #01 AND #01 NEQ ,$no-right JNZ2 ( move ) ~Sprite.x ++ =Sprite.x ,right_icn =Sprite.addr $no-right POP diff --git a/projects/examples/dev.keys.usm b/projects/examples/dev.keys.usm @@ -15,9 +15,10 @@ @FRAME - ~Keys #00 EQU BRK? + ~Keys #00 EQU ,$end JNZ2 - ,$no-return ~Keys #0d NEQ JNZ2 + ( enter key ) + ~Keys #0d NEQ ,$no-return JNZ2 #0000 =Sprite.x ( incr ) ~Sprite.y 8+ =Sprite.y ( release ) #00 =Keys @@ -29,6 +30,8 @@ ( incr ) ~Sprite.x 8+ =Sprite.x ( release ) #00 =Keys + $end + BRK @font ( spectrum-zx font ) diff --git a/projects/examples/dev.mouse.usm b/projects/examples/dev.mouse.usm @@ -27,11 +27,10 @@ BRK ,draw-cursor JSR2 - ,$no-touch ~Mouse.state #00 EQU JNZ2 + ~Mouse.state #00 EQU ,$no-touch JNZ2 ~Mouse.x =circle.xc ~Mouse.y =circle.yc #0000 =circle.r - $no-touch ( draw ) @@ -66,7 +65,7 @@ RTN ( draw ) ,$seg JSR2 $loop ( incr ) ~circle.x ++ =circle.x - ,$else ~circle.d #0000 #0001 ADD2 LTS2 JNZ2 + ~circle.d #0000 #0001 ADD2 LTS2 ,$else JNZ2 ( decr ) ~circle.y -- =circle.y ~circle.x ~circle.y SUB2 #0004 MUL2 ~circle.d ADD2 #000a ADD2 =circle.d ,$end JMP2 @@ -74,7 +73,7 @@ RTN ~circle.x #0004 MUL2 ~circle.d ADD2 #0006 ADD2 =circle.d $end ( draw ) ,$seg JSR2 - ,$loop ~circle.y ~circle.x #0001 SUB2 GTS2 JNZ2 + ~circle.y ~circle.x #0001 SUB2 GTS2 ,$loop JNZ2 RTN $seg ~circle.xc ~circle.x ADD2 =Screen.x ~circle.yc ~circle.y ADD2 =Screen.y ~color =Screen.color diff --git a/projects/examples/dev.screen.usm b/projects/examples/dev.screen.usm @@ -50,29 +50,29 @@ ( draw hor line ) #0000 =Screen.x ~center.y =Screen.y #0000 ~Screen.width ( from/to ) - $draw-hor NOP + $draw-hor ( draw ) #01 =Screen.color ( incr ) SWP2 #0002 ADD2 DUP2 =Screen.x SWP2 - OVR2 OVR2 LTH2 ^$draw-hor SWP JNZ + OVR2 OVR2 LTH2 ^$draw-hor JNZ POP2 POP2 ( draw ver line ) ~center.x =Screen.x #0000 =Screen.y #0000 ~Screen.height ( from/to ) - $draw-ver NOP + $draw-ver ( draw ) #02 =Screen.color ( incr ) SWP2 #0002 ADD2 DUP2 =Screen.y SWP2 - OVR2 OVR2 LTH2 ^$draw-ver SWP JNZ + OVR2 OVR2 LTH2 ^$draw-ver JNZ POP2 POP2 ( draw blending modes ) #0020 =Sprite.x #0020 =Sprite.y ,icon_icn =Sprite.addr #00 #10 - $draw-blends NOP + $draw-blends ( move ) OVR #00 SWP #0008 MUL2 #0020 ADD2 =Sprite.x ( draw ) OVR =Sprite.color ( incr ) SWP #01 ADD SWP - DUP2 LTH ^$draw-blends SWP JNZ + DUP2 LTH ^$draw-blends JNZ POP POP ,update-theme JSR2 @@ -82,28 +82,28 @@ BRK @FRAME - ,$no-touch ~Mouse.state #00 EQU JNZ2 + ~Mouse.state #00 EQU ,$no-touch JNZ2 ~Mouse.y ~window.y1 SUB2 STEP8 - DUP2 #0010 NEQ2 ,$no-touch-red ROT JNZ2 - ,$no-touch-red ~Mouse.x ~window.x1 #0050 ADD2 LTH2 JNZ2 - ,$no-touch-red ~Mouse.x ~window.x1 #008c ADD2 GTH2 JNZ2 + DUP2 #0010 NEQ2 ,$no-touch-red JNZ2 + ~Mouse.x ~window.x1 #0050 ADD2 LTH2 ,$no-touch-red JNZ2 + ~Mouse.x ~window.x1 #008c ADD2 GTH2 ,$no-touch-red JNZ2 ( get new value ) ~Mouse.x ~window.x1 SUB2 #0050 SUB2 #0004 DIV2 S2B ,theme.r1 #00 ~selection ADD2 POK2 $no-touch-red - DUP2 #0020 NEQ2 ,$no-touch-green ROT JNZ2 - ,$no-touch-green ~Mouse.x ~window.x1 #0050 ADD2 LTH2 JNZ2 - ,$no-touch-green ~Mouse.x ~window.x1 #008c ADD2 GTH2 JNZ2 + DUP2 #0020 NEQ2 ,$no-touch-green JNZ2 + ~Mouse.x ~window.x1 #0050 ADD2 LTH2 ,$no-touch-green JNZ2 + ~Mouse.x ~window.x1 #008c ADD2 GTH2 ,$no-touch-green JNZ2 ( get new value ) ~Mouse.x ~window.x1 SUB2 #0050 SUB2 #0004 DIV2 S2B ,theme.g1 #00 ~selection ADD2 POK2 $no-touch-green - DUP2 #0030 NEQ2 ,$no-touch-blue ROT JNZ2 - ,$no-touch-blue ~Mouse.x ~window.x1 #0050 ADD2 LTH2 JNZ2 - ,$no-touch-blue ~Mouse.x ~window.x1 #008c ADD2 GTH2 JNZ2 + DUP2 #0030 NEQ2 ,$no-touch-blue JNZ2 + ~Mouse.x ~window.x1 #0050 ADD2 LTH2 ,$no-touch-blue JNZ2 + ~Mouse.x ~window.x1 #008c ADD2 GTH2 ,$no-touch-blue JNZ2 ( get new value ) ~Mouse.x ~window.x1 SUB2 #0050 SUB2 #0004 DIV2 S2B ,theme.b1 #00 ~selection ADD2 POK2 $no-touch-blue - DUP2 #0040 NEQ2 ,$no-touch-radio ROT JNZ2 - ,$no-touch-radio ~Mouse.x ~window.x1 #0050 ADD2 LTH2 JNZ2 - ,$no-touch-radio ~Mouse.x ~window.x1 #008c ADD2 GTH2 JNZ2 + DUP2 #0040 NEQ2 ,$no-touch-radio JNZ2 + ~Mouse.x ~window.x1 #0050 ADD2 LTH2 ,$no-touch-radio JNZ2 + ~Mouse.x ~window.x1 #008c ADD2 GTH2 ,$no-touch-radio JNZ2 ~Mouse.x ~window.x1 SUB2 #0050 SUB2 STEP8 2/ #0008 DIV2 S2B =selection $no-touch-radio @@ -228,7 +228,7 @@ RTN $loop ( incr ) ~Sprite.x 8+ =Sprite.x ( draw ) #05 =Sprite.color - ,$loop ~Sprite.x ~slider.x2 #0008 ADD2 LTH2 JNZ2 + ~Sprite.x ~slider.x2 #0008 ADD2 LTH2 ,$loop JNZ2 ( incr ) ~Sprite.x #0004 ADD2 =Sprite.x ,sliderc_icn =Sprite.addr @@ -248,9 +248,9 @@ RTN $hor ( draw ) ~color =Screen.color ( incr ) ~Screen.x ++ =Screen.x - ,$hor ~Screen.x ~rect.x2 LTH2 JNZ2 + ~Screen.x ~rect.x2 LTH2 ,$hor JNZ2 ( incr ) ~Screen.y ++ =Screen.y - ,$ver ~Screen.y ~rect.y2 LTH2 JNZ2 + ~Screen.y ~rect.y2 LTH2 ,$ver JNZ2 RTN @@ -261,13 +261,13 @@ RTN ( incr ) ~Screen.x ++ =Screen.x ( draw ) ~rect.y1 =Screen.y ~color =Screen.color ( draw ) ~rect.y2 =Screen.y ~color =Screen.color - ,$hor ~Screen.x ~rect.x2 LTH2 JNZ2 + ~Screen.x ~rect.x2 LTH2 ,$hor JNZ2 ~rect.y1 =Screen.y $ver ( draw ) ~rect.x1 =Screen.x ~color =Screen.color ( draw ) ~rect.x2 =Screen.x ~color =Screen.color ( incr ) ~Screen.y ++ =Screen.y - ,$ver ~Screen.y ~rect.y2 ++ LTH2 JNZ2 + ~Screen.y ~rect.y2 ++ LTH2 ,$ver JNZ2 RTN @@ -278,7 +278,7 @@ RTN ( draw ) DUP2 PEK2 #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr ~color =Sprite.color ( incr ) ++ ( incr ) ~Sprite.x 8+ =Sprite.x - DUP2 PEK2 #00 NEQ ,$loop ROT JNZ2 + DUP2 PEK2 #00 NEQ ,$loop JNZ2 POP2 RTN diff --git a/projects/examples/gui.editor.usm b/projects/examples/gui.editor.usm @@ -34,15 +34,15 @@ BRK @FRAME - ,no-ctrl ~Controller.buttons #00 EQU JNZ2 + ~Controller.buttons #00 EQU ,no-ctrl JNZ2 - ,no-ctrl-up ~Controller.buttons #10 EQU JNZ2 + ~Controller.buttons #10 EQU ,no-ctrl-up JNZ2 ~editor.addr #0001 ADD2 =editor.addr ,draw-window JSR2 ,draw-editor JSR2 @no-ctrl-up - ,no-ctrl-down ~Controller.buttons #20 EQU JNZ2 + ~Controller.buttons #20 EQU ,no-ctrl-down JNZ2 ~editor.addr #0001 SUB2 =editor.addr ,draw-window JSR2 ,draw-editor JSR2 @@ -50,7 +50,7 @@ BRK @no-ctrl - ,no-click ~Mouse.state #00 EQU JNZ2 + ~Mouse.state #00 EQU ,no-click JNZ2 ( load ) ~editor.addr ~Mouse.y ~editor.y1 SUB2 #0008 DIV2 ADD2 PEK2 ( mask ) #01 #07 ~Mouse.x ~editor.x1 SUB2 #0008 DIV2 SWP POP SUB #40 SFT SFT @@ -93,10 +93,10 @@ RTN ( draw ) #08 =Sprite.color ( incr ) ~Sprite.x #0008 ADD2 =Sprite.x ( incr ) ~pixel.x #01 ADD =pixel.x - ,$hor ~Sprite.x ~editor.x1 #0040 ADD2 LTH2 JNZ2 + ~Sprite.x ~editor.x1 #0040 ADD2 LTH2 ,$hor JNZ2 ( incr ) ~Sprite.y #0008 ADD2 =Sprite.y ( incr ) ~pixel.y #01 ADD =pixel.y - ,$ver ~Sprite.y ~editor.y1 #0040 ADD2 LTH2 JNZ2 + ~Sprite.y ~editor.y1 #0040 ADD2 LTH2 ,$ver JNZ2 ~editor.addr =Sprite.addr ~window.y1 =Sprite.y ~window.x2 #0008 SUB2 =Sprite.x diff --git a/projects/examples/gui.hover.usm b/projects/examples/gui.hover.usm @@ -1,7 +1,7 @@ ( draw routines ) %RTN { JMP2r } -%RTN? { #00 EQU #02 SWP JNZ STH2r JMP2 } +%RTN? { #00 EQU #02 JNZ STH2r JMP2 } ;color { byte 1 } ;pointer { x 2 y 2 sprite 2 } @@ -33,22 +33,22 @@ BRK ( matrix comparison ) ~Mouse.x ~r1.x1 GTH2 ~Mouse.x ~r1.x2 LTH2 #0101 EQU2 ~Mouse.y ~r1.y1 GTH2 ~Mouse.y ~r1.y2 LTH2 #0101 EQU2 - #0101 NEQ2 ,$draw1 ROT JNZ2 #02 =color ,hand_icn =pointer.sprite + #0101 NEQ2 ,$draw1 JNZ2 #02 =color ,hand_icn =pointer.sprite $draw1 ~r1.x1 ~r1.y1 ~r1.x2 ~r1.y2 ~color ,line-rect JSR2 #01 =color ( 2-step comparison ) - ,$draw2 ~Mouse.x ~r2.x1 GTH2 ~Mouse.x ~r2.x2 LTH2 #0101 NEQ2 JNZ2 - ,$draw2 ~Mouse.y ~r2.y1 GTH2 ~Mouse.y ~r2.y2 LTH2 #0101 NEQ2 JNZ2 + ~Mouse.x ~r2.x1 GTH2 ~Mouse.x ~r2.x2 LTH2 #0101 NEQ2 ,$draw2 JNZ2 + ~Mouse.y ~r2.y1 GTH2 ~Mouse.y ~r2.y2 LTH2 #0101 NEQ2 ,$draw2 JNZ2 #03 =color ,hand_icn =pointer.sprite $draw2 ~r2.x1 ~r2.y1 ~r2.x2 ~r2.y2 ~color ,line-rect JSR2 #01 =color ( 4-step comparison ) - ,$draw3 ~Mouse.x ~r3.x1 LTH2 JNZ2 - ,$draw3 ~Mouse.x ~r3.x2 GTH2 JNZ2 - ,$draw3 ~Mouse.y ~r3.y1 LTH2 JNZ2 - ,$draw3 ~Mouse.y ~r3.y2 GTH2 JNZ2 + ~Mouse.x ~r3.x1 LTH2 ,$draw3 JNZ2 + ~Mouse.x ~r3.x2 GTH2 ,$draw3 JNZ2 + ~Mouse.y ~r3.y1 LTH2 ,$draw3 JNZ2 + ~Mouse.y ~r3.y2 GTH2 ,$draw3 JNZ2 #02 =color ,hand_icn =pointer.sprite $draw3 ~r3.x1 ~r3.y1 ~r3.x2 ~r3.y2 ~color ,line-rect JSR2 @@ -82,13 +82,13 @@ RTN ( incr ) ~Screen.x #0001 ADD2 =Screen.x ( draw ) ~rect.y1 =Screen.y ~color =Screen.color ( draw ) ~rect.y2 =Screen.y ~color =Screen.color - ,$hor ~Screen.x ~rect.x2 LTH2 JNZ2 + ~Screen.x ~rect.x2 LTH2 ,$hor JNZ2 ~rect.y1 =Screen.y $ver ( draw ) ~rect.x1 =Screen.x ~color =Screen.color ( draw ) ~rect.x2 =Screen.x ~color =Screen.color ( incr ) ~Screen.y #0001 ADD2 =Screen.y - ,$ver ~Screen.y ~rect.y2 #0001 ADD2 LTH2 JNZ2 + ~Screen.y ~rect.y2 #0001 ADD2 LTH2 ,$ver JNZ2 RTN diff --git a/projects/examples/gui.picture.usm b/projects/examples/gui.picture.usm @@ -25,9 +25,9 @@ BRK ( draw ) ~pict.color =Sprite.color ( incr ) ~Sprite.x #0008 ADD2 =Sprite.x ( incr ) ~Sprite.addr #0008 ADD2 =Sprite.addr - ,$hor ~Sprite.x ~pict.width ~pict.x ADD2 LTH2 JNZ2 + ~Sprite.x ~pict.width ~pict.x ADD2 LTH2 ,$hor JNZ2 ( incr ) ~Sprite.y #0008 ADD2 =Sprite.y - ,$ver ~Sprite.y ~pict.height ~pict.y ADD2 LTH2 JNZ2 + ~Sprite.y ~pict.height ~pict.y ADD2 LTH2 ,$ver JNZ2 RTN diff --git a/projects/examples/gui.shapes.usm b/projects/examples/gui.shapes.usm @@ -4,7 +4,7 @@ %++ { #0001 ADD2 } %-- { #0001 SUB2 } %8+ { #0008 ADD2 } -%ABS2 { DUP2 #000f SFT2 EQU #04 SWP JNZ #ffff MUL2 } +%ABS2 { DUP2 #000f SFT2 EQU #04 JNZ #ffff MUL2 } ;pict { x 2 y 2 width 2 height 2 color 1 addr 2 } ;rect { x1 2 y1 2 x2 2 y2 2 } @@ -53,13 +53,13 @@ BRK ~line.dx ~line.dy ADD2 =line.e1 $loop ~line.x =Screen.x ~line.y =Screen.y ~color =Screen.color - ,$end ~line.x ~line.x0 EQU2 ~line.y ~line.y0 EQU2 #0101 EQU2 JNZ2 + ~line.x ~line.x0 EQU2 ~line.y ~line.y0 EQU2 #0101 EQU2 ,$end JNZ2 ~line.e1 #0002 MUL2 =line.e2 - ,$skipy ~line.e2 ~line.dy LTS2 JNZ2 + ~line.e2 ~line.dy LTS2 ,$skipy JNZ2 ~line.e1 ~line.dy ADD2 =line.e1 ~line.x ~line.sx ADD2 =line.x $skipy - ,$skipx ~line.e2 ~line.dx GTS2 JNZ2 + ~line.e2 ~line.dx GTS2 ,$skipx JNZ2 ~line.e1 ~line.dx ADD2 =line.e1 ~line.y ~line.sy ADD2 =line.y $skipx @@ -76,13 +76,13 @@ RTN ( incr ) ~Screen.x ++ =Screen.x ( draw ) ~rect.y1 =Screen.y ~color =Screen.color ( draw ) ~rect.y2 =Screen.y ~color =Screen.color - ,$hor ~Screen.x ~rect.x2 LTH2 JNZ2 + ~Screen.x ~rect.x2 LTH2 ,$hor JNZ2 ~rect.y1 =Screen.y $ver ( draw ) ~rect.x1 =Screen.x ~color =Screen.color ( draw ) ~rect.x2 =Screen.x ~color =Screen.color ( incr ) ~Screen.y ++ =Screen.y - ,$ver ~Screen.y ~rect.y2 ++ LTH2 JNZ2 + ~Screen.y ~rect.y2 ++ LTH2 ,$ver JNZ2 RTN @@ -94,9 +94,9 @@ RTN $hor ( draw ) ~color =Screen.color ( incr ) ~Screen.x ++ =Screen.x - ,$hor ~Screen.x ~rect.x2 LTH2 JNZ2 + ~Screen.x ~rect.x2 LTH2 ,$hor JNZ2 ( incr ) ~Screen.y ++ =Screen.y - ,$ver ~Screen.y ~rect.y2 LTH2 JNZ2 + ~Screen.y ~rect.y2 LTH2 ,$ver JNZ2 RTN @@ -109,9 +109,9 @@ RTN ( draw ) ~pict.color =Sprite.color ( incr ) ~Sprite.x 8+ =Sprite.x ( incr ) ~Sprite.addr 8+ =Sprite.addr - ,$hor ~Sprite.x ~pict.width ~pict.x ADD2 LTH2 JNZ2 + ~Sprite.x ~pict.width ~pict.x ADD2 LTH2 ,$hor JNZ2 ( incr ) ~Sprite.y 8+ =Sprite.y - ,$ver ~Sprite.y ~pict.height ~pict.y ADD2 LTH2 JNZ2 + ~Sprite.y ~pict.height ~pict.y ADD2 LTH2 ,$ver JNZ2 RTN @@ -123,7 +123,7 @@ RTN ( draw ) ,$seg JSR2 $loop ( incr ) ~circle.x ++ =circle.x - ,$else ~circle.d #0000 #0001 ADD2 LTS2 JNZ2 + ~circle.d #0000 #0001 ADD2 LTS2 ,$else JNZ2 ( decr ) ~circle.y -- =circle.y ~circle.x ~circle.y SUB2 #0004 MUL2 ~circle.d ADD2 #000a ADD2 =circle.d ,$end JMP2 @@ -131,7 +131,7 @@ RTN ~circle.x #0004 MUL2 ~circle.d ADD2 #0006 ADD2 =circle.d $end ( draw ) ,$seg JSR2 - ,$loop ~circle.y ~circle.x #0001 SUB2 GTS2 JNZ2 + ~circle.y ~circle.x #0001 SUB2 GTS2 ,$loop JNZ2 RTN $seg ~circle.xc ~circle.x ADD2 =Screen.x ~circle.yc ~circle.y ADD2 =Screen.y ~color =Screen.color diff --git a/projects/software/left.usm b/projects/software/left.usm @@ -16,7 +16,7 @@ ) %RTN { JMP2r } -%RTN? { #00 EQU #02 SWP JNZ STH2r JMP2 } +%RTN? { #00 EQU #02 JNZ STH2r JMP2 } %++ { #0001 ADD2 } %-- { #0001 SUB2 } %8/ { #0003 SFT2 } %8* { #0030 SFT2 } @@ -69,62 +69,62 @@ BRK ( ctrl ) - ,ctrl-end ~Controller #00 EQU ~lock #00 NEQ #0000 NEQ2 JNZ2 + ~Controller #00 EQU ~lock #00 NEQ #0000 NEQ2 ,ctrl-end JNZ2 ( lock ) #04 =lock - ,no-ctrl-up ~Controller #10 NEQ JNZ2 - ( clamp ) ,no-ctrl-up ~position.y #0000 EQU2 JNZ2 + ~Controller #10 NEQ ,no-ctrl-up JNZ2 + ( clamp ) ~position.y #0000 EQU2 ,no-ctrl-up JNZ2 ,find-lineoffset JSR2 =position.x ~position.y -- =position.y ,find-selection JSR2 DUP2 =selection.from ++ =selection.to ,clamp-selection JSR2 ,follow-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 @no-ctrl-up - ,no-ctrl-down ~Controller #20 NEQ JNZ2 + ~Controller #20 NEQ ,no-ctrl-down JNZ2 ,find-lineoffset JSR2 =position.x ~position.y ++ =position.y ,find-selection JSR2 DUP2 =selection.from ++ =selection.to ,clamp-selection JSR2 ,follow-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 @no-ctrl-down - ,no-ctrl-left ~Controller #40 NEQ JNZ2 - ( clamp ) ,no-ctrl-left ~selection.from ,document.body EQU2 JNZ2 + ~Controller #40 NEQ ,no-ctrl-left JNZ2 + ( clamp ) ~selection.from ,document.body EQU2 ,no-ctrl-left JNZ2 ~selection.from -- DUP2 =selection.from ++ =selection.to ,clamp-selection JSR2 ,follow-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 @no-ctrl-left - ,no-ctrl-right ~Controller #80 NEQ JNZ2 + ~Controller #80 NEQ ,no-ctrl-right JNZ2 ~selection.from ++ DUP2 =selection.from ++ =selection.to ,clamp-selection JSR2 ,follow-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 @no-ctrl-right ( alt ) - ,no-alt ~Controller #0f AND #02 NEQ JNZ2 - ,no-aup ~Controller #04 SFT #01 NEQ JNZ2 + ~Controller #0f AND #02 NEQ ,no-alt JNZ2 + ~Controller #04 SFT #01 NEQ ,no-aup JNZ2 ,find-wordstart JSR2 =selection.to ,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 @no-aup - ,no-adown ~Controller #04 SFT #02 NEQ JNZ2 + ~Controller #04 SFT #02 NEQ ,no-adown JNZ2 ,find-wordend JSR2 =selection.to ,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 @no-adown - ,no-aleft ~Controller #04 SFT #04 NEQ JNZ2 + ~Controller #04 SFT #04 NEQ ,no-aleft JNZ2 ~selection.to -- =selection.to ,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 @no-aleft - ,no-aright ~Controller #04 SFT #08 NEQ JNZ2 + ~Controller #04 SFT #08 NEQ ,no-aright JNZ2 ~selection.to ++ =selection.to ,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 @no-aright @no-alt ( ctrl ) - ,no-ctrl ~Controller #0f AND #01 NEQ JNZ2 - ,no-cup ~Controller #04 SFT #01 NEQ JNZ2 + ~Controller #0f AND #01 NEQ ,no-ctrl JNZ2 + ~Controller #04 SFT #01 NEQ ,no-cup JNZ2 #0004 ,scroll-up JSR2 ,redraw JSR2 ,ctrl-end JMP2 @no-cup - ,no-cdown ~Controller #04 SFT #02 NEQ JNZ2 + ~Controller #04 SFT #02 NEQ ,no-cdown JNZ2 #0004 ,scroll-down JSR2 ,redraw JSR2 ,ctrl-end JMP2 @no-cdown - ,no-cleft ~Controller #04 SFT #04 NEQ JNZ2 + ~Controller #04 SFT #04 NEQ ,no-cleft JNZ2 ,goto-linestart JSR2 ,redraw JSR2 ,ctrl-end JMP2 @no-cleft - ,no-cright ~Controller #04 SFT #08 NEQ JNZ2 + ~Controller #04 SFT #08 NEQ ,no-cright JNZ2 ,goto-lineend JSR2 ,redraw JSR2 ,ctrl-end JMP2 @no-cright @no-ctrl @@ -133,11 +133,11 @@ BRK ( keys ) - ,no-keys ~Keys #00 EQU JNZ2 + ~Keys #00 EQU ,no-keys JNZ2 - ,$no-backspace ~Keys #08 NEQ JNZ2 + ~Keys #08 NEQ ,$no-backspace JNZ2 ( erase ) - ,$erase-multiple ~selection.to ~selection.from SUB2 #0001 NEQ2 JNZ2 + ~selection.to ~selection.from SUB2 #0001 NEQ2 ,$erase-multiple JNZ2 ~selection.to ~selection.from SUB2 ,shift-left JSR2 ,$erase-end JMP2 $erase-multiple @@ -162,28 +162,28 @@ BRK ( mouse ) - ,no-change ~Mouse.state ~touch.state EQU JNZ2 + ~Mouse.state ~touch.state EQU ,no-change JNZ2 #0000 =Sprite.x ~Screen.height 8- =Sprite.y ,mouse00icn =Sprite.addr - ,nobutton1 ~Mouse.state #01 NEQ JNZ2 ,mouse01icn =Sprite.addr @nobutton1 - ,nobutton2 ~Mouse.state #10 NEQ JNZ2 ,mouse10icn =Sprite.addr @nobutton2 - ,nobutton3 ~Mouse.state #11 NEQ JNZ2 ,mouse11icn =Sprite.addr @nobutton3 + ~Mouse.state #01 NEQ ,nobutton1 JNZ2 ,mouse01icn =Sprite.addr @nobutton1 + ~Mouse.state #10 NEQ ,nobutton2 JNZ2 ,mouse10icn =Sprite.addr @nobutton2 + ~Mouse.state #11 NEQ ,nobutton3 JNZ2 ,mouse11icn =Sprite.addr @nobutton3 #01 =Sprite.color @no-change - ,touch-end ~Mouse.state #00 EQU JNZ2 + ~Mouse.state #00 EQU ,touch-end JNZ2 - ,touch-linebar ~Mouse.x #0010 LTH2 JNZ2 - ,touch-body ~Mouse.x ~Screen.width 8- LTH2 JNZ2 + ~Mouse.x #0010 LTH2 ,touch-linebar JNZ2 + ~Mouse.x ~Screen.width 8- LTH2 ,touch-body JNZ2 ,touch-scrollbar JMP2 @touch-end ~Mouse.state =touch.state - ( unlock ) ,skip-unlock ~lock #00 EQU JNZ2 ~lock #01 SUB =lock @skip-unlock + ( unlock ) ~lock #00 EQU ,skip-unlock JNZ2 ~lock #01 SUB =lock @skip-unlock ,draw-cursor JSR2 @@ -191,11 +191,11 @@ BRK @touch-scrollbar - ,$no-up ~Mouse.y #0008 GTH2 JNZ2 + ~Mouse.y #0008 GTH2 ,$no-up JNZ2 ( decr ) ~scroll.y #00 ~scroll.y #0000 NEQ2 SUB2 =scroll.y ^$end JMP $no-up - ,$no-down ~Mouse.y ~Screen.height 8- LTH2 JNZ2 + ~Mouse.y ~Screen.height 8- LTH2 ,$no-down JNZ2 ( incr ) ~scroll.y ++ =scroll.y ^$end JMP $no-down @@ -220,20 +220,20 @@ RTN ~Mouse.y 8/ ~scroll.y ADD2 =position.y ~Mouse.x ~textarea.x1 SUB2 #0007 ADD2 #0007 DIV2 =position.x - ,$no-chord-cut ~Mouse.chord #01 NEQ JNZ2 + ~Mouse.chord #01 NEQ ,$no-chord-cut JNZ2 ,cut JSR2 ( release ) #00 DUP =Mouse.state =Mouse.chord ^$end JMP $no-chord-cut - ,$no-chord-paste ~Mouse.chord #10 NEQ JNZ2 + ~Mouse.chord #10 NEQ ,$no-chord-paste JNZ2 ,paste JSR2 ( release ) #00 DUP =Mouse.state =Mouse.chord ^$end JMP $no-chord-paste - ,$end ~Mouse.state #11 EQU JNZ2 + ~Mouse.state #11 EQU ,$end JNZ2 - ,$no-drag ~Mouse.state ~touch.state NEQ ~Controller #0f AND #02 NEQ #0101 EQU2 JNZ2 + ~Mouse.state ~touch.state NEQ ~Controller #0f AND #02 NEQ #0101 EQU2 ,$no-drag JNZ2 ( on drag ) ,find-selection JSR2 ++ =selection.to ,clamp-selection JSR2 @@ -260,7 +260,7 @@ RTN @scroll-up ( length ) - DUP2 ~scroll.y LTH2 ,$clamp ROT JNZ2 + DUP2 ~scroll.y LTH2 ,$clamp JNZ2 #0000 =scroll.y POP2 RTN $clamp ~scroll.y SWP2 SUB2 =scroll.y @@ -300,10 +300,10 @@ RTN @follow-selection - ,$no-up ~position.y ~scroll.y GTH2 JNZ2 + ~position.y ~scroll.y GTH2 ,$no-up JNZ2 ~position.y =scroll.y RTN $no-up - ,$no-down ~position.y ~Screen.height #0010 SUB2 8/ ~scroll.y ADD2 LTH2 JNZ2 + ~position.y ~Screen.height #0010 SUB2 8/ ~scroll.y ADD2 LTH2 ,$no-down JNZ2 ~position.y ~Screen.height #0010 SUB2 8/ SUB2 =scroll.y RTN $no-down @@ -347,9 +347,9 @@ RTN ~selection.to =j $loop NOP ( decr ) ~j -- =j - ,$end ~j PEK2 #20 EQU JNZ2 - ,$end ~j PEK2 #0a EQU JNZ2 - ,$end ~j PEK2 #0d EQU JNZ2 + ~j PEK2 #20 EQU ,$end JNZ2 + ~j PEK2 #0a EQU ,$end JNZ2 + ~j PEK2 #0d EQU ,$end JNZ2 ~j ,document.body GTH2 ^$loop MUL JMP $end ( return ) ~j -- @@ -361,9 +361,9 @@ RTN ~selection.to =j $loop NOP ( incr ) ~j ++ =j - ,$end ~j PEK2 #20 EQU JNZ2 - ,$end ~j PEK2 #0a EQU JNZ2 - ,$end ~j PEK2 #0d EQU JNZ2 + ~j PEK2 #20 EQU ,$end JNZ2 + ~j PEK2 #0a EQU ,$end JNZ2 + ~j PEK2 #0d EQU ,$end JNZ2 ~j ,document.body GTH2 ^$loop MUL JMP $end ( return ) ~j ++ @@ -375,8 +375,8 @@ RTN #0000 =j $loop NOP ( incr ) ~j ++ =j - ,$end ~selection.from ~j SUB2 PEK2 #0a EQU JNZ2 - ,$end ~selection.from ~j SUB2 PEK2 #0d EQU JNZ2 + ~selection.from ~j SUB2 PEK2 #0a EQU ,$end JNZ2 + ~selection.from ~j SUB2 PEK2 #0d EQU ,$end JNZ2 ~selection.from ~j SUB2 ,document.body GTH2 ^$loop MUL JMP $end ( return ) ~j @@ -387,8 +387,8 @@ RTN ,document.body =j #0000 =pt.y $loop NOP - ,$end ~pt.y ~position.y -- GTH2 JNZ2 - ,$no-space ~j PEK2 #0a NEQ ~j PEK2 #0d NEQ #0101 EQU2 JNZ2 + ~pt.y ~position.y -- GTH2 ,$end JNZ2 + ~j PEK2 #0a NEQ ~j PEK2 #0d NEQ #0101 EQU2 ,$no-space JNZ2 ( incr ) ~pt.y ++ =pt.y $no-space ( incr ) ~j ++ =j @@ -403,8 +403,8 @@ RTN ,find-line JSR2 ( find line ) #0000 =pt.x $loop NOP - ,$end ~j ~pt.x ADD2 PEK2 #0a EQU JNZ2 - ,$end ~j ~pt.x ADD2 PEK2 #0d EQU JNZ2 + ~j ~pt.x ADD2 PEK2 #0a EQU ,$end JNZ2 + ~j ~pt.x ADD2 PEK2 #0d EQU ,$end JNZ2 ( incr ) ~pt.x ++ =pt.x ~pt.x ~position.x -- LTH2 ^$loop MUL JMP $end @@ -448,17 +448,17 @@ RTN ,document.body =selection.from #0000 =pt.x #0000 =pt.y $loop - ,$no-space ~selection.from PEK2 #0a NEQ ~selection.from PEK2 #0d NEQ #0101 EQU2 JNZ2 + ~selection.from PEK2 #0a NEQ ~selection.from PEK2 #0d NEQ #0101 EQU2 ,$no-space JNZ2 ( incr ) ~pt.y ++ =pt.y #0000 =pt.x $no-space - ,$no-reached ~pt.y ~position.y -- GTH2 ~pt.x ~position.x -- GTH2 #0101 NEQ2 JNZ2 + ~pt.y ~position.y -- GTH2 ~pt.x ~position.x -- GTH2 #0101 NEQ2 ,$no-reached JNZ2 ~selection.from ++ =selection.to RTN $no-reached ( incr ) ~pt.x ++ =pt.x ( incr ) ~selection.from ++ =selection.from - ,$loop ~selection.from PEK2 #00 NEQ JNZ2 + ~selection.from PEK2 #00 NEQ ,$loop JNZ2 RTN @@ -530,8 +530,8 @@ RTN ( scroll to position ) #0000 =j ( j is linebreaks ) $find-offset NOP - ,$find-offset-end ~scroll.y ~j EQU2 JNZ2 - ,$no-break ~textarea.addr PEK2 #0a NEQ ~textarea.addr PEK2 #0d NEQ #0101 EQU2 JNZ2 + ~scroll.y ~j EQU2 ,$find-offset-end JNZ2 + ~textarea.addr PEK2 #0a NEQ ~textarea.addr PEK2 #0d NEQ #0101 EQU2 ,$no-break JNZ2 ( incr ) ~j ++ =j $no-break ( incr ) ~textarea.addr ++ =textarea.addr @@ -543,7 +543,7 @@ RTN $loop - ,$end ~Sprite.y ~Screen.height #0010 SUB2 GTH2 JNZ2 + ~Sprite.y ~Screen.height #0010 SUB2 GTH2 ,$end JNZ2 ( get character ) ,font #00 ~i PEK2 #20 SUB 8* ADD2 =Sprite.addr @@ -553,7 +553,7 @@ RTN ~i ~selection.to LTH2 #0101 EQU2 #05 MUL ADD ~i ~selection.from EQU2 ADD =Sprite.color - ,$no-linebreak ~i PEK2 #0a NEQ ~i PEK2 #0d NEQ #0101 EQU2 JNZ2 + ~i PEK2 #0a NEQ ~i PEK2 #0d NEQ #0101 EQU2 ,$no-linebreak JNZ2 ( draw linebreak ) ,linebreak_icn =Sprite.addr ( draw ) #02 @@ -565,7 +565,7 @@ RTN ( incr ) ~Sprite.x 8+ =Sprite.x ,font =Sprite.addr #01 =Sprite.color - ,$fill-clear ~Sprite.x ~Screen.width 8- LTH2 JNZ2 + ~Sprite.x ~Screen.width 8- LTH2 ,$fill-clear JNZ2 ( draw line number ) @@ -585,7 +585,7 @@ RTN ( incr ) ~i ++ =i ( incr ) ~Sprite.x #0007 ADD2 =Sprite.x - ,$loop ~i PEK2 #00 NEQ JNZ2 + ~i PEK2 #00 NEQ ,$loop JNZ2 $end diff --git a/projects/software/nasu.usm b/projects/software/nasu.usm @@ -8,7 +8,7 @@ ) %RTN { JMP2r } -%RTN? { #00 EQU #02 SWP JNZ STH2r JMP2 } +%RTN? { #00 EQU #02 JNZ STH2r JMP2 } %STEP8 { #0033 SFT2 } %++ { #0001 ADD2 } @@ -62,28 +62,28 @@ BRK ( keyboard controls ) - ,no-key ~Keys #00 EQU JNZ2 + ~Keys #00 EQU ,no-key JNZ2 - ,no-key ~Keys #31 LTH JNZ2 - ,no-key ~Keys #33 GTH JNZ2 + ~Keys #31 LTH ,no-key JNZ2 + ~Keys #33 GTH ,no-key JNZ2 ( select ) ~Keys #31 SUB =bankview.mode ( release ) #00 =Keys ,redraw JSR2 @no-key - ,no-ctrl ~Controller.buttons #00 EQU JNZ2 + ~Controller.buttons #00 EQU ,no-ctrl JNZ2 - ,no-ctrl-up ~Controller.buttons #10 EQU JNZ2 + ~Controller.buttons #10 EQU ,no-ctrl-up JNZ2 ~tileview.addr #0080 ADD2 =tileview.addr @no-ctrl-up - ,no-ctrl-down ~Controller.buttons #20 EQU JNZ2 + ~Controller.buttons #20 EQU ,no-ctrl-down JNZ2 ~tileview.addr #0080 SUB2 =tileview.addr @no-ctrl-down - ,no-ctrl-left ~Controller.buttons #40 EQU JNZ2 + ~Controller.buttons #40 EQU ,no-ctrl-left JNZ2 ~tileview.addr 8+ =tileview.addr @no-ctrl-left - ,no-ctrl-right ~Controller.buttons #80 EQU JNZ2 + ~Controller.buttons #80 EQU ,no-ctrl-right JNZ2 ~tileview.addr 8- =tileview.addr @no-ctrl-right ~tileview.addr #0800 DIV2 #0800 MUL2 =bankview.addr @@ -93,27 +93,27 @@ BRK ( mouse controls ) - ,click-end ~Mouse.state #00 EQU JNZ2 + ~Mouse.state #00 EQU ,click-end JNZ2 ( toolbar ) - ,no-toolbar-click ~Mouse.y ~bankview.y #0010 SUB2 SUB2 8/ #0000 NEQ2 JNZ2 + ~Mouse.y ~bankview.y #0010 SUB2 SUB2 8/ #0000 NEQ2 ,no-toolbar-click JNZ2 ( brush ) - ,no-brush-click ~Mouse.x ~bankview.x SUB2 8/ #000d LTH2 JNZ2 - ,no-brush-click ~Mouse.x ~bankview.x SUB2 8/ #000f GTH2 JNZ2 + ~Mouse.x ~bankview.x SUB2 8/ #000d LTH2 ,no-brush-click JNZ2 + ~Mouse.x ~bankview.x SUB2 8/ #000f GTH2 ,no-brush-click JNZ2 ( select ) ~mouse.x ~bankview.x SUB2 8/ #000d SUB2 SWP POP =bankview.mode ( release ) #00 =Mouse.state ,redraw JSR2 ,click-end JMP2 @no-brush-click - ,no-load-click ~Mouse.x ~tileview.x SUB2 8/ #000e NEQU2 JNZ2 + ~Mouse.x ~tileview.x SUB2 8/ #000e NEQU2 ,no-load-click JNZ2 ( load ) ,filepath =File.name #0800 =File.length ~bankview.addr =File.load ( release ) #00 =Mouse.state ,redraw JSR2 ,click-end JMP2 @no-load-click - ,no-save-click ~Mouse.x ~tileview.x SUB2 8/ #000f NEQU2 JNZ2 + ~Mouse.x ~tileview.x SUB2 8/ #000f NEQU2 ,no-save-click JNZ2 ( save ) ,filepath =File.name #0800 =File.length ~bankview.addr =File.save ( release ) #00 =Mouse.state ,redraw JSR2 ,click-end JMP2 @@ -125,9 +125,9 @@ BRK ~Mouse.x ~bankview.x GTH2 ~Mouse.x ~bankview.x #0080 ADD2 LTH2 #0101 EQU2 ~Mouse.y ~bankview.y GTH2 ~Mouse.y ~bankview.y #0080 ADD2 LTH2 #0101 EQU2 - #0101 NEQ2 ,no-bank-click ROT JNZ2 + #0101 NEQ2 ,no-bank-click JNZ2 - ,not-copy-mode ~bankview.mode #01 NEQ JNZ2 + ~bankview.mode #01 NEQ ,not-copy-mode JNZ2 #00 =i @copy-loop NOP ( load ) ~tileview.addr ~i ADD PEK2 @@ -140,7 +140,7 @@ BRK ,redraw JSR2 ,click-end JMP2 @not-copy-mode - ,not-erase-mode ~bankview.mode #02 NEQ JNZ2 + ~bankview.mode #02 NEQ ,not-erase-mode JNZ2 #00 =i @erase-loop NOP #00 @@ -164,7 +164,7 @@ BRK ~Mouse.x ~tileview.x GTH2 ~Mouse.x ~tileview.x #0080 ADD2 LTH2 #0101 EQU2 ~Mouse.y ~tileview.y GTH2 ~Mouse.y ~tileview.y #0080 ADD2 LTH2 #0101 EQU2 - #0101 NEQ2 ,no-tile-click ROT JNZ2 + #0101 NEQ2 ,no-tile-click JNZ2 ~Mouse.x ~tileview.x SUB2 STEP8 #0040 DIV2 ~Mouse.y ~tileview.y SUB2 STEP8 #0040 DIV2 2* ADD2 @@ -172,7 +172,7 @@ BRK ~tileview.addr ADD2 =addr ( addr offset ) ~Mouse.x ~tileview.x SUB2 ~Mouse.x ~tileview.x SUB2 #0040 DIV2 #0040 MUL2 SUB2 =pos.x ~Mouse.y ~tileview.y SUB2 ~Mouse.y ~tileview.y SUB2 #0040 DIV2 #0040 MUL2 SUB2 =pos.y - ,no-erase-mode ~Mouse.state #10 NEQ JNZ2 + ~Mouse.state #10 NEQ ,no-erase-mode JNZ2 ( load ) ~addr ~pos.y 8/ ADD2 PEK2 ( mask ) #01 #07 ~pos.x 8/ SWP POP SUB SFL #ff EOR AND @@ -189,15 +189,15 @@ BRK ( operations ) - ,no-operations ~Mouse.y ~tileview.y SUB2 8/ #000c NEQ2 JNZ2 + ~Mouse.y ~tileview.y SUB2 8/ #000c NEQ2 ,no-operations JNZ2 - ,no-move-up ~Mouse.x ~tileview.x SUB2 8/ #0011 NEQ2 JNZ2 + ~Mouse.x ~tileview.x SUB2 8/ #0011 NEQ2 ,no-move-up JNZ2 ,op_shiftup JSR2 ( release ) #00 =Mouse.state ,redraw JSR2 ,click-end JMP2 @no-move-up - ,no-move-down ~Mouse.x ~tileview.x SUB2 8/ #0012 NEQ2 JNZ2 + ~Mouse.x ~tileview.x SUB2 8/ #0012 NEQ2 ,no-move-down JNZ2 ,op_shiftdown JSR2 ( release ) #00 =Mouse.state ,redraw JSR2 ,click-end JMP2 @@ -297,7 +297,7 @@ RTN ( draw ) #02 =Sprite.color ~Sprite.addr 8+ =Sprite.addr ( incr ) ~i #01 ADD =i - ,$guides ~i #10 LTH JNZ2 + ~i #10 LTH ,$guides JNZ2 ( body ) @@ -314,10 +314,10 @@ RTN ( incr ) ~Sprite.x 8+ =Sprite.x ( incr ) ~Sprite.addr 8+ =Sprite.addr ( incr ) ~pt.x #01 ADD =pt.x - ,$hor ~pt.x #10 LTH JNZ2 + ~pt.x #10 LTH ,$hor JNZ2 ( incr ) ~pt.y #01 ADD =pt.y ( incr ) ~Sprite.y 8+ =Sprite.y - ,$ver ~pt.y #10 LTH JNZ2 + ~pt.y #10 LTH ,$ver JNZ2 RTN @@ -364,7 +364,7 @@ RTN $line-hor ( draw ) #03 =Screen.color ( incr ) ~Screen.x #0002 ADD2 =Screen.x - ~Screen.x ~tileview.x #0082 ADD2 LTH2 ,$line-hor ROT JNZ2 + ~Screen.x ~tileview.x #0082 ADD2 LTH2 ,$line-hor JNZ2 ( line ver ) ~tileview.y =Screen.y @@ -372,7 +372,7 @@ RTN $line-ver ( draw ) #03 =Screen.color ( incr ) ~Screen.y #0002 ADD2 =Screen.y - ~Screen.y ~tileview.y #0081 ADD2 LTH2 ,$line-ver ROT JNZ2 + ~Screen.y ~tileview.y #0081 ADD2 LTH2 ,$line-ver JNZ2 ( rewind ) ~tileview.addr #0018 SUB2 =tileview.addr @@ -389,7 +389,7 @@ RTN ( draw ) #02 =Sprite.color ( incr ) ~i #01 ADD =i ( incr ) ~Sprite.y 8+ =Sprite.y - ,$bytes ~i #08 LTH JNZ2 + ~i #08 LTH ,$bytes JNZ2 ( operations ) @@ -412,10 +412,10 @@ RTN ( incr ) ~Sprite.x 8+ =Sprite.x ( incr ) ~Sprite.addr 8+ =Sprite.addr ( incr ) ~pt.x #01 ADD =pt.x - ,$tiles-hor ~pt.x #02 LTH JNZ2 + ~pt.x #02 LTH ,$tiles-hor JNZ2 ( incr ) ~pt.y #01 ADD =pt.y ( incr ) ~Sprite.y 8+ =Sprite.y - ,$tiles-ver ~pt.y #02 LTH JNZ2 + ~pt.y #02 LTH ,$tiles-ver JNZ2 RTN @@ -432,11 +432,11 @@ RTN ( draw ) #01 =Sprite.color ( incr ) ~Sprite.x 8+ =Sprite.x ( incr ) ~pt.x #01 ADD =pt.x - ,$hor ~pt.x #08 LTH JNZ2 + ~pt.x #08 LTH ,$hor JNZ2 ( incr ) ~Sprite.y 8+ =Sprite.y ( incr ) ~pt.y #01 ADD =pt.y ~Sprite.x #0040 SUB2 =Sprite.x - ,$ver ~pt.y #08 LTH JNZ2 + ~pt.y #08 LTH ,$ver JNZ2 RTN diff --git a/projects/software/noodle.usm b/projects/software/noodle.usm @@ -18,8 +18,8 @@ ) %RTN { JMP2r } -%RTN? { #00 EQU #02 SWP JNZ STH2r JMP2 } -%ABS2 { DUP2 #000f SFT2 EQU #04 SWP JNZ #ffff MUL2 } +%RTN? { #00 EQU #02 JNZ STH2r JMP2 } +%ABS2 { DUP2 #000f SFT2 EQU #04 JNZ #ffff MUL2 } %STEP8 { #0033 SFT2 } %MOD8 { #0007 AND2 } %SFL { #40 SFT SFT } @@ -111,7 +111,7 @@ BRK ,draw-cursor JSR2 ( release drag ) - ,$no-release ~Mouse.state #00 EQU ~brush.drag #01 EQU #0101 NEQ2 JNZ2 + ~Mouse.state #00 EQU ~brush.drag #01 EQU #0101 NEQ2 ,$no-release JNZ2 ~origin.x1 #0002 SUB2 ~origin.y1 #0002 SUB2 ~origin.x2 #0002 ADD2 ~origin.y2 #0002 ADD2 #00 ,fill-rect JSR2 ~canvas.x1 -- ~canvas.y1 -- ~canvas.x2 ~canvas.y2 #10 ,line-rect JSR2 ,draw-background JSR2 @@ -123,32 +123,32 @@ BRK $no-release ( operations on release line/rect ) - ,$no-touch-change ~Mouse.state ~brush.last EQU JNZ2 - ,$no-touch-change ~Mouse.x CLN2r ~canvas.x1 GTS2 STH2r ~canvas.x2 LTS2 #0101 NEQ2 JNZ2 - ,$no-touch-change ~Mouse.y CLN2r ~canvas.y1 GTS2 STH2r ~canvas.y2 LTS2 #0101 NEQ2 JNZ2 - ,$no-touch-ondown ~Mouse.state #00 EQU JNZ2 + ~Mouse.state ~brush.last EQU ,$no-touch-change JNZ2 + ~Mouse.x CLN2r ~canvas.x1 GTS2 STH2r ~canvas.x2 LTS2 #0101 NEQ2 ,$no-touch-change JNZ2 + ~Mouse.y CLN2r ~canvas.y1 GTS2 STH2r ~canvas.y2 LTS2 #0101 NEQ2 ,$no-touch-change JNZ2 + ~Mouse.state #00 EQU ,$no-touch-ondown JNZ2 ( on down ) ~Mouse.x =cursor.dx ~Mouse.y =cursor.dy $no-touch-ondown - ,$no-touch-onup ~Mouse.state #00 NEQ JNZ2 + ~Mouse.state #00 NEQ ,$no-touch-onup JNZ2 ( on up ) - ,$no-touch-line ~brush.tool #02 NEQ JNZ2 + ~brush.tool #02 NEQ ,$no-touch-line JNZ2 ~cursor.dx ~canvas.x1 SUB2 ~cursor.dy ~canvas.y1 SUB2 ~Mouse.x ~canvas.x1 SUB2 ~Mouse.y ~canvas.y1 SUB2 ,paint-line JSR2 ,$touch-end JMP2 $no-touch-line - ,$no-touch-rect ~brush.tool #03 NEQ JNZ2 + ~brush.tool #03 NEQ ,$no-touch-rect JNZ2 ~cursor.dx ~canvas.x1 SUB2 ~cursor.dy ~canvas.y1 SUB2 ~Mouse.x ~canvas.x1 SUB2 ~Mouse.y ~canvas.y1 SUB2 ,paint-rect JSR2 ,$touch-end JMP2 $no-touch-rect $no-touch-onup $no-touch-change - ,$no-touch ~Mouse.state #00 EQU JNZ2 + ~Mouse.state #00 EQU ,$no-touch JNZ2 ( drag ) - ,$no-drag ~Controller #02 NEQ JNZ2 - ,$no-drag-start ~brush.drag #00 NEQ JNZ2 + ~Controller #02 NEQ ,$no-drag JNZ2 + ~brush.drag #00 NEQ ,$no-drag-start JNZ2 ~canvas.x1 =origin.x1 ~canvas.y1 =origin.y1 ~canvas.x2 =origin.x2 @@ -165,8 +165,8 @@ BRK $no-drag ( in sizepane ) - ,$no-touch-sizepane ~Mouse.x CLN2r ~sizepane.x1 GTH2 STH2r ~sizepane.x2 LTH2 #0101 NEQ2 JNZ2 - ,$no-touch-sizepane ~Mouse.y CLN2r ~sizepane.y1 GTH2 STH2r ~sizepane.y2 LTH2 #0101 NEQ2 JNZ2 + ~Mouse.x CLN2r ~sizepane.x1 GTH2 STH2r ~sizepane.x2 LTH2 #0101 NEQ2 ,$no-touch-sizepane JNZ2 + ~Mouse.y CLN2r ~sizepane.y1 GTH2 STH2r ~sizepane.y2 LTH2 #0101 NEQ2 ,$no-touch-sizepane JNZ2 ( release ) #00 =Mouse.state #01 =brush.tool ~Mouse.x ~sizepane.x1 SUB2 8/ SWP POP =brush.size @@ -176,8 +176,8 @@ BRK $no-touch-sizepane ( in pattpane ) - ,$no-touch-pattpane ~Mouse.x CLN2r ~pattpane.x1 GTH2 STH2r ~pattpane.x2 LTH2 #0101 NEQ2 JNZ2 - ,$no-touch-pattpane ~Mouse.y CLN2r ~pattpane.y1 GTH2 STH2r ~pattpane.y2 LTH2 #0101 NEQ2 JNZ2 + ~Mouse.x CLN2r ~pattpane.x1 GTH2 STH2r ~pattpane.x2 LTH2 #0101 NEQ2 ,$no-touch-pattpane JNZ2 + ~Mouse.y CLN2r ~pattpane.y1 GTH2 STH2r ~pattpane.y2 LTH2 #0101 NEQ2 ,$no-touch-pattpane JNZ2 ( release ) #00 =Mouse.state ~Mouse.x ~pattpane.x1 SUB2 8/ SWP POP =brush.patt ( draw ) ,draw-pattpane JSR2 @@ -185,8 +185,8 @@ BRK $no-touch-pattpane ( in toolpane ) - ,$no-touch-toolpane ~Mouse.x CLN2r ~toolpane.x1 GTH2 STH2r ~toolpane.x2 LTH2 #0101 NEQ2 JNZ2 - ,$no-touch-toolpane ~Mouse.y CLN2r ~toolpane.y1 GTH2 STH2r ~toolpane.y2 LTH2 #0101 NEQ2 JNZ2 + ~Mouse.x CLN2r ~toolpane.x1 GTH2 STH2r ~toolpane.x2 LTH2 #0101 NEQ2 ,$no-touch-toolpane JNZ2 + ~Mouse.y CLN2r ~toolpane.y1 GTH2 STH2r ~toolpane.y2 LTH2 #0101 NEQ2 ,$no-touch-toolpane JNZ2 ( release ) #00 =Mouse.state ~Mouse.x ~toolpane.x1 SUB2 8/ SWP POP =brush.tool ( draw ) ,draw-toolpane JSR2 @@ -194,23 +194,23 @@ BRK $no-touch-toolpane ( in canvas ) - ,$no-touch-canvas ~Mouse.x CLN2r ~canvas.x1 GTS2 STH2r ~canvas.x2 LTS2 #0101 NEQ2 JNZ2 - ,$no-touch-canvas ~Mouse.y CLN2r ~canvas.y1 GTS2 STH2r ~canvas.y2 LTS2 #0101 NEQ2 JNZ2 + ~Mouse.x CLN2r ~canvas.x1 GTS2 STH2r ~canvas.x2 LTS2 #0101 NEQ2 ,$no-touch-canvas JNZ2 + ~Mouse.y CLN2r ~canvas.y1 GTS2 STH2r ~canvas.y2 LTS2 #0101 NEQ2 ,$no-touch-canvas JNZ2 ( set cursor operation ) - ,add-pixel ,$no-oper ~Mouse.state #01 EQU JNZ2 POP2 ,remove-pixel $no-oper =brush.oper + ,add-pixel ~Mouse.state #01 EQU ,$no-oper JNZ2 POP2 ,remove-pixel $no-oper =brush.oper - ,$no-touch-pen ~brush.tool #00 NEQ JNZ2 + ~brush.tool #00 NEQ ,$no-touch-pen JNZ2 ~cursor.x0 ~canvas.x1 SUB2 ~cursor.y0 ~canvas.y1 SUB2 ~Mouse.x ~canvas.x1 SUB2 ~Mouse.y ~canvas.y1 SUB2 ,paint-line JSR2 ,$touch-end JMP2 $no-touch-pen - ,$no-touch-brush ~brush.tool #01 NEQ JNZ2 + ~brush.tool #01 NEQ ,$no-touch-brush JNZ2 ~Mouse.x ~canvas.x1 SUB2 ~Mouse.y ~canvas.y1 SUB2 ,paint-brush JSR2 ,$touch-end JMP2 $no-touch-brush - ,$no-touch-zoom ~brush.tool #04 NEQ JNZ2 + ~brush.tool #04 NEQ ,$no-touch-zoom JNZ2 ~zoom.active #00 EQU =zoom.active ( release ) #00 =Mouse.state ~Mouse.x ~canvas.x1 SUB2 ~canvas.w 2/ SUB2 =zoom.x @@ -222,14 +222,14 @@ BRK $no-touch-canvas ( background interface ) - ,$no-touch-background ~Mouse.y STEP8 ~Screen.height #0010 SUB2 NEQ2 JNZ2 + ~Mouse.y STEP8 ~Screen.height #0010 SUB2 NEQ2 ,$no-touch-background JNZ2 ~Mouse.x ~Screen.width #0020 SUB2 SUB2 8/ - DUP2 #0001 NEQ2 ,$no-load-button ROT JNZ2 + DUP2 #0001 NEQ2 ,$no-load-button JNZ2 ,filepath ,load-file JSR2 ,draw-canvas JSR2 ( release ) #00 =Mouse.state $no-load-button - DUP2 #0002 NEQ2 ,$no-save-button ROT JNZ2 + DUP2 #0002 NEQ2 ,$no-save-button JNZ2 ,filepath ,save-file JSR2 ( release ) #00 =Mouse.state $no-save-button @@ -242,34 +242,34 @@ BRK $no-touch ~Controller.buttons #f0 AND - DUP #04 SFT #01 AND #01 NEQ ,$no-up ROT JNZ2 + DUP #04 SFT #01 AND #01 NEQ ,$no-up JNZ2 ( move ) ~zoom.y -- =zoom.y $no-up - DUP #05 SFT #01 AND #01 NEQ ,$no-down ROT JNZ2 + DUP #05 SFT #01 AND #01 NEQ ,$no-down JNZ2 ( move ) ~zoom.y ++ =zoom.y $no-down - DUP #06 SFT #01 AND #01 NEQ ,$no-left ROT JNZ2 + DUP #06 SFT #01 AND #01 NEQ ,$no-left JNZ2 ( move ) ~zoom.x -- =zoom.x $no-left - DUP #07 SFT #01 AND #01 NEQ ,$no-right ROT JNZ2 + DUP #07 SFT #01 AND #01 NEQ ,$no-right JNZ2 ( move ) ~zoom.x ++ =zoom.x $no-right - #00 EQU #04 SWP JNZ ,draw-canvas JSR2 + #00 EQU #04 JNZ ,draw-canvas JSR2 - ,$no-keys ~Keys #00 EQU JNZ2 + ~Keys #00 EQU ,$no-keys JNZ2 ~Keys - DUP #20 NEQ ,$no-space ROT JNZ2 + DUP #20 NEQ ,$no-space JNZ2 ( toggle zoom ) ~zoom.active #00 EQU =zoom.active ,redraw JSR2 $no-space - DUP #08 NEQ ,$no-backspace ROT JNZ2 + DUP #08 NEQ ,$no-backspace JNZ2 ( erase ) ,clear JSR2 $no-backspace - DUP #71 NEQ ,$no-qkey ROT JNZ2 + DUP #71 NEQ ,$no-qkey JNZ2 ( tool0 ) #00 =brush.tool ,draw-toolpane JSR2 $no-qkey - DUP #77 NEQ ,$no-wkey ROT JNZ2 + DUP #77 NEQ ,$no-wkey JNZ2 ( tool0 ) #01 =brush.tool ,draw-toolpane JSR2 $no-wkey - DUP #65 NEQ ,$no-ekey ROT JNZ2 + DUP #65 NEQ ,$no-ekey JNZ2 ( tool0 ) #02 =brush.tool ,draw-toolpane JSR2 $no-ekey - DUP #72 NEQ ,$no-rkey ROT JNZ2 + DUP #72 NEQ ,$no-rkey JNZ2 ( tool0 ) #03 =brush.tool ,draw-toolpane JSR2 $no-rkey - DUP #74 NEQ ,$no-tkey ROT JNZ2 + DUP #74 NEQ ,$no-tkey JNZ2 ( tool0 ) #04 =brush.tool ,draw-toolpane JSR2 $no-tkey DUP - DUP #30 GTH SWP #39 LTH #0101 NEQ2 ,$no-numkey ROT JNZ2 + DUP #30 GTH SWP #39 LTH #0101 NEQ2 ,$no-numkey JNZ2 ( size ) ~Keys #31 SUB =brush.size ,draw-sizepane JSR2 $no-numkey POP ( release ) #00 =Keys @@ -288,7 +288,7 @@ BRK $loop NOP OVR2 #00 ROT ROT POK2 ( incr ) SWP2 #0001 ADD2 SWP2 - OVR2 OVR2 LTH2 ^$loop SWP JNZ + OVR2 OVR2 LTH2 ^$loop JNZ POP2 POP2 ,redraw JSR2 @@ -320,7 +320,7 @@ RTN ( load ) =line.y1 =line.x1 =line.y2 =line.x2 ( trim if zoomed ) - ,$no-zoom ~zoom.active #01 NEQ JNZ2 + ~zoom.active #01 NEQ ,$no-zoom JNZ2 ~line.x1 8/ ~zoom.x ADD2 =line.x1 ~line.y1 8/ ~zoom.y ADD2 =line.y1 ~line.x2 8/ ~zoom.x ADD2 =line.x2 @@ -334,13 +334,13 @@ RTN ~line.dx ~line.dy ADD2 =line.e1 $loop ( paint ) ~line.x2 ~line.y2 ~brush.oper JSR2 - ,$end ~line.x2 ~line.x1 EQU2 ~line.y2 ~line.y1 EQU2 #0101 EQU2 JNZ2 + ~line.x2 ~line.x1 EQU2 ~line.y2 ~line.y1 EQU2 #0101 EQU2 ,$end JNZ2 ~line.e1 #0002 MUL2 =line.e2 - ,$skipy ~line.e2 ~line.dy LTS2 JNZ2 + ~line.e2 ~line.dy LTS2 ,$skipy JNZ2 ~line.e1 ~line.dy ADD2 =line.e1 ~line.x2 ~line.sx ADD2 =line.x2 $skipy - ,$skipx ~line.e2 ~line.dx GTS2 JNZ2 + ~line.e2 ~line.dx GTS2 ,$skipx JNZ2 ~line.e1 ~line.dx ADD2 =line.e1 ~line.y2 ~line.sy ADD2 =line.y2 $skipx @@ -360,7 +360,7 @@ RTN ( load ) =rect.y2 =rect.x2 =rect.y1 =rect.x1 ( trim if zoomed ) - ,$no-zoom ~zoom.active #01 NEQ JNZ2 + ~zoom.active #01 NEQ ,$no-zoom JNZ2 ~rect.x1 8/ ~zoom.x ADD2 =rect.x1 ~rect.y1 8/ ~zoom.y ADD2 =rect.y1 ~rect.x2 8/ ~zoom.x ADD2 #0001 ADD2 =rect.x2 @@ -374,13 +374,13 @@ RTN ~rect.x1 =pt2.x $hor ~pt2.x SWP POP =px.x ~pt2.y SWP POP =px.y - ,$no-pixel ,patternize JSR2 #00 EQU JNZ2 + ,patternize JSR2 #00 EQU ,$no-pixel JNZ2 ( draw ) ~pt2.x ~pt2.y ~brush.oper JSR2 $no-pixel ( incr ) ~pt2.x ++ =pt2.x - ,$hor ~pt2.x ~rect.x2 LTS2 JNZ2 + ~pt2.x ~rect.x2 LTS2 ,$hor JNZ2 ~pt2.y ++ =pt2.y - ,$ver ~pt2.y ~rect.y2 LTS2 JNZ2 + ~pt2.y ~rect.y2 LTS2 ,$ver JNZ2 ,draw-canvas JSR2 ,draw-toolpane JSR2 @@ -394,7 +394,7 @@ RTN #0003 SUB2 =pt0.y #0003 SUB2 =pt0.x ( cursor offset ) ( trim if zoomed ) - ,$no-zoom ~zoom.active #01 NEQ JNZ2 + ~zoom.active #01 NEQ ,$no-zoom JNZ2 ~pt0.x 8/ ~zoom.x ADD2 #0003 SUB2 =pt0.x ~pt0.y 8/ ~zoom.y ADD2 #0003 SUB2 =pt0.y $no-zoom @@ -405,14 +405,14 @@ RTN $hor ( addr ) ,size_icn #00 ~brush.size 8* ADD2 ( byte ) #00 ~px.y ADD2 PEK2 #07 ~px.x SUB SFT #01 AND - #00 EQU ,$no-pixel ROT JNZ2 - ,$no-pixel ,patternize JSR2 #00 EQU JNZ2 + #00 EQU ,$no-pixel JNZ2 + ,patternize JSR2 #00 EQU ,$no-pixel JNZ2 ~pt0.x #00 ~px.x ADD2 ~pt0.y #00 ~px.y ADD2 ~brush.oper JSR2 $no-pixel ( incr ) ~px.x #01 ADD =px.x - ,$hor ~px.x #08 LTH JNZ2 + ~px.x #08 LTH ,$hor JNZ2 ( incr ) ~px.y #01 ADD =px.y - ,$ver ~px.y #08 LTH JNZ2 + ~px.y #08 LTH ,$ver JNZ2 ,draw-canvas JSR2 ,draw-toolpane JSR2 @@ -423,44 +423,44 @@ RTN @patternize - ,$noplain ~brush.patt #00 NEQ JNZ2 + ~brush.patt #00 NEQ ,$noplain JNZ2 #01 RTN $noplain - ,$notone1 ~brush.patt #01 NEQ JNZ2 + ~brush.patt #01 NEQ ,$notone1 JNZ2 ~pt0.x #00 ~px.x ADD2 ~pt0.y #00 ~px.y ADD2 ADD2 #0001 AND2 #0000 EQU2 ~pt0.x #00 ~px.x ADD2 ~pt0.y #00 ~px.y ADD2 SUB2 #0001 AND2 #0000 EQU2 #0101 EQU2 RTN $notone1 - ,$notone2 ~brush.patt #02 NEQ JNZ2 + ~brush.patt #02 NEQ ,$notone2 JNZ2 ~pt0.x #00 ~px.x ADD2 ~pt0.y #00 ~px.y ADD2 ADD2 #0003 AND2 #0000 EQU2 ~pt0.x #00 ~px.x ADD2 ~pt0.y #00 ~px.y ADD2 SUB2 #0003 AND2 #0000 EQU2 #0101 EQU2 RTN $notone2 - ,$notone3 ~brush.patt #03 NEQ JNZ2 + ~brush.patt #03 NEQ ,$notone3 JNZ2 ~pt0.x #00 ~px.x ADD2 ~pt0.y #00 ~px.y ADD2 ADD2 #0005 AND2 #0000 EQU2 ~pt0.x #00 ~px.x ADD2 ~pt0.y #00 ~px.y ADD2 SUB2 #0005 AND2 #0000 EQU2 #0101 EQU2 RTN $notone3 - ,$notone4 ~brush.patt #04 NEQ JNZ2 + ~brush.patt #04 NEQ ,$notone4 JNZ2 ~pt0.x #00 ~px.x ADD2 ~pt0.y #00 ~px.y ADD2 ADD2 #0003 AND2 #0000 EQU2 RTN $notone4 - ,$notone5 ~brush.patt #05 NEQ JNZ2 + ~brush.patt #05 NEQ ,$notone5 JNZ2 ~pt0.x #00 ~px.x ADD2 ~pt0.y #00 ~px.y ADD2 SUB2 #0003 AND2 #0000 EQU2 RTN $notone5 - ,$notone6 ~brush.patt #06 NEQ JNZ2 + ~brush.patt #06 NEQ ,$notone6 JNZ2 ~pt0.x #00 ~px.x ADD2 #0001 AND2 SWP POP RTN $notone6 - ,$notone7 ~brush.patt #07 NEQ JNZ2 + ~brush.patt #07 NEQ ,$notone7 JNZ2 ~pt0.y #00 ~px.y ADD2 #0001 AND2 SWP POP RTN $notone7 @@ -512,7 +512,7 @@ RTN @draw-canvas - ,draw-canvas-zoom ~zoom.active #01 EQU JNZ2 + ~zoom.active #01 EQU ,draw-canvas-zoom JNZ2 ~canvas.y1 =Sprite.y ,data =Sprite.addr @@ -522,9 +522,9 @@ RTN ( draw ) #09 =Sprite.color ( incr ) ~Sprite.x 8+ =Sprite.x ( incr ) ~Sprite.addr 8+ =Sprite.addr - ,$hor ~Sprite.x ~canvas.x2 NEQ2 JNZ2 + ~Sprite.x ~canvas.x2 NEQ2 ,$hor JNZ2 ( incr ) ~Sprite.y 8+ =Sprite.y - ,$ver ~Sprite.y ~canvas.y2 NEQ2 JNZ2 + ~Sprite.y ~canvas.y2 NEQ2 ,$ver JNZ2 RTN @@ -541,10 +541,10 @@ RTN ( draw ) #09 =Sprite.color ( incr ) ~Sprite.x 8+ =Sprite.x ( incr ) ~pt1.x ++ =pt1.x - ,$hor ~Sprite.x ~canvas.x2 NEQ2 JNZ2 + ~Sprite.x ~canvas.x2 NEQ2 ,$hor JNZ2 ( incr ) ~Sprite.y 8+ =Sprite.y ( incr ) ~pt1.y ++ =pt1.y - ,$ver ~Sprite.y ~canvas.y2 NEQ2 JNZ2 + ~Sprite.y ~canvas.y2 NEQ2 ,$ver JNZ2 RTN @@ -574,20 +574,20 @@ RTN ~Mouse.y =cursor.y ( draw size cursor ) - ,$outside-canvas ~brush.tool #01 NEQ JNZ2 - ,$outside-canvas ~Mouse.x CLN2r ~canvas.x1 GTH2 STH2r ~canvas.x2 LTH2 #0101 NEQ2 JNZ2 - ,$outside-canvas ~Mouse.y CLN2r ~canvas.y1 GTH2 STH2r ~canvas.y2 LTH2 #0101 NEQ2 JNZ2 + ~brush.tool #01 NEQ ,$outside-canvas JNZ2 + ~Mouse.x CLN2r ~canvas.x1 GTH2 STH2r ~canvas.x2 LTH2 #0101 NEQ2 ,$outside-canvas JNZ2 + ~Mouse.y CLN2r ~canvas.y1 GTH2 STH2r ~canvas.y2 LTH2 #0101 NEQ2 ,$outside-canvas JNZ2 ( do not draw size in toolpane ) - ,$outside-canvas ~Mouse.x CLN2r ~toolpane.x1 GTH2 STH2r ~toolpane.x2 LTH2 #0101 EQU2 ~Mouse.y CLN2r ~toolpane.y1 GTH2 STH2r ~toolpane.y2 LTH2 #0101 EQU2 #0101 EQU2 JNZ2 - ,$outside-canvas ~Mouse.x CLN2r ~sizepane.x1 GTH2 STH2r ~sizepane.x2 LTH2 #0101 EQU2 ~Mouse.y CLN2r ~sizepane.y1 GTH2 STH2r ~sizepane.y2 LTH2 #0101 EQU2 #0101 EQU2 JNZ2 - ,$outside-canvas ~Mouse.x CLN2r ~pattpane.x1 GTH2 STH2r ~pattpane.x2 LTH2 #0101 EQU2 ~Mouse.y CLN2r ~pattpane.y1 GTH2 STH2r ~pattpane.y2 LTH2 #0101 EQU2 #0101 EQU2 JNZ2 + ~Mouse.x CLN2r ~toolpane.x1 GTH2 STH2r ~toolpane.x2 LTH2 #0101 EQU2 ~Mouse.y CLN2r ~toolpane.y1 GTH2 STH2r ~toolpane.y2 LTH2 #0101 EQU2 #0101 EQU2 ,$outside-canvas JNZ2 + ~Mouse.x CLN2r ~sizepane.x1 GTH2 STH2r ~sizepane.x2 LTH2 #0101 EQU2 ~Mouse.y CLN2r ~sizepane.y1 GTH2 STH2r ~sizepane.y2 LTH2 #0101 EQU2 #0101 EQU2 ,$outside-canvas JNZ2 + ~Mouse.x CLN2r ~pattpane.x1 GTH2 STH2r ~pattpane.x2 LTH2 #0101 EQU2 ~Mouse.y CLN2r ~pattpane.y1 GTH2 STH2r ~pattpane.y2 LTH2 #0101 EQU2 #0101 EQU2 ,$outside-canvas JNZ2 ( do not draw size when holding alt ) - ,$outside-canvas ~Controller #02 EQU JNZ2 + ~Controller #02 EQU ,$outside-canvas JNZ2 ~cursor.x #0003 SUB2 =Sprite.x ~cursor.y #0003 SUB2 =Sprite.y ,brush_view #00 ~brush.size 8* ADD2 =Sprite.addr #11 ~Mouse.state #02 MUL ADD =Sprite.color - ,$outside-canvas ~Mouse.state #00 EQU JNZ2 + ~Mouse.state #00 EQU ,$outside-canvas JNZ2 RTN $outside-canvas @@ -611,9 +611,9 @@ RTN ( draw ) #01 ~Sprite.x ~pattpane.x1 SUB2 8/ SWP POP ~brush.tool EQU #02 MUL ADD =Sprite.color ( incr ) ~Sprite.x 8+ =Sprite.x ( incr ) ~Sprite.addr 8+ =Sprite.addr - ,$tools ~Sprite.x ~toolpane.x2 LTH2 JNZ2 + ~Sprite.x ~toolpane.x2 LTH2 ,$tools JNZ2 - ,$no-zoom ~zoom.active #01 NEQ JNZ2 + ~zoom.active #01 NEQ ,$no-zoom JNZ2 ~Sprite.x #0008 SUB2 =Sprite.x ,tool_icn #0028 ADD2 =Sprite.addr #01 #04 ~brush.tool EQU #02 MUL ADD =Sprite.color @@ -634,7 +634,7 @@ RTN ( draw ) #01 ~Sprite.x ~pattpane.x1 SUB2 8/ SWP POP ~brush.patt EQU #02 MUL ADD =Sprite.color ( incr ) ~Sprite.x 8+ =Sprite.x ( incr ) ~Sprite.addr 8+ =Sprite.addr - ,$patterns ~Sprite.x ~pattpane.x2 LTH2 JNZ2 + ~Sprite.x ~pattpane.x2 LTH2 ,$patterns JNZ2 RTN @@ -651,7 +651,7 @@ RTN ( draw ) #01 ~Sprite.x ~sizepane.x1 SUB2 8/ SWP POP ~brush.size EQU #02 MUL ADD =Sprite.color ( incr ) ~Sprite.x 8+ =Sprite.x ( incr ) ~Sprite.addr 8+ =Sprite.addr - ,$patterns ~Sprite.x ~sizepane.x2 LTH2 JNZ2 + ~Sprite.x ~sizepane.x2 LTH2 ,$patterns JNZ2 RTN @@ -663,7 +663,7 @@ RTN $draw-hor NOP ( draw ) #01 =Screen.color ( incr ) SWP2 #0002 ADD2 DUP2 =Screen.x SWP2 - OVR2 OVR2 LTH2 ^$draw-hor SWP JNZ + OVR2 OVR2 LTH2 ^$draw-hor JNZ POP2 POP2 ( draw ver line ) @@ -672,7 +672,7 @@ RTN $draw-ver NOP ( draw ) #01 =Screen.color ( incr ) SWP2 #0002 ADD2 DUP2 =Screen.y SWP2 - OVR2 OVR2 LTH2 ^$draw-ver SWP JNZ + OVR2 OVR2 LTH2 ^$draw-ver JNZ POP2 POP2 ( draw save/load/guides icons ) @@ -711,13 +711,13 @@ RTN ( incr ) ~Screen.x ++ =Screen.x ( draw ) ~rect.y1 =Screen.y ~color =Screen.color ( draw ) ~rect.y2 =Screen.y ~color =Screen.color - ,$hor ~Screen.x ~rect.x2 NEQ2 JNZ2 + ~Screen.x ~rect.x2 NEQ2 ,$hor JNZ2 ~rect.y1 =Screen.y $ver ( draw ) ~rect.x1 =Screen.x ~color =Screen.color ( draw ) ~rect.x2 =Screen.x ~color =Screen.color ( incr ) ~Screen.y ++ =Screen.y - ,$ver ~Screen.y ~rect.y2 ++ NEQ2 JNZ2 + ~Screen.y ~rect.y2 ++ NEQ2 ,$ver JNZ2 RTN @@ -729,9 +729,9 @@ RTN $hor ( draw ) ~color =Screen.color ( incr ) ~Screen.x ++ =Screen.x - ,$hor ~Screen.x ~rect.x2 NEQ2 JNZ2 + ~Screen.x ~rect.x2 NEQ2 ,$hor JNZ2 ( incr ) ~Screen.y ++ =Screen.y - ,$ver ~Screen.y ~rect.y2 NEQ2 JNZ2 + ~Screen.y ~rect.y2 NEQ2 ,$ver JNZ2 RTN diff --git a/src/uxn.c b/src/uxn.c @@ -46,7 +46,7 @@ void op_lth(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); push8(u->src, b void op_gts(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); push8(u->src, (Sint8)b > (Sint8)a); } void op_lts(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); push8(u->src, (Sint8)b < (Sint8)a); } void op_jmp(Uxn *u) { Uint8 a = pop8(u->src); u->ram.ptr += (Sint8)a; } -void op_jnz(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); if (a) u->ram.ptr += (Sint8)b; } +void op_jnz(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); if (b) u->ram.ptr += (Sint8)a; } void op_jsr(Uxn *u) { Uint8 a = pop8(u->src); push16(u->dst, u->ram.ptr); u->ram.ptr += (Sint8)a; } /* Memory */ void op_pek(Uxn *u) { Uint8 a = pop8(u->src); push8(u->src, mempeek8(u, a)); } @@ -80,7 +80,7 @@ void op_lth16(Uxn *u) { Uint16 a = pop16(u->src), b = pop16(u->src); push8(u->sr void op_gts16(Uxn *u) { Uint16 a = pop16(u->src), b = pop16(u->src); push8(u->src, (Sint16)b > (Sint16)a); } void op_lts16(Uxn *u) { Uint16 a = pop16(u->src), b = pop16(u->src); push8(u->src, (Sint16)b < (Sint16)a); } void op_jmp16(Uxn *u) { u->ram.ptr = pop16(u->src); } -void op_jnz16(Uxn *u) { Uint8 a = pop8(&u->wst); Uint16 b = pop16(u->src); if (a) u->ram.ptr = b; } +void op_jnz16(Uxn *u) { Uint16 a = pop16(u->src); Uint8 b = pop8(u->src); if (b) u->ram.ptr = a; } void op_jsr16(Uxn *u) { push16(u->dst, u->ram.ptr); u->ram.ptr = pop16(u->src); } /* Memory(16-bits) */ void op_pek16(Uxn *u) { Uint16 a = pop16(u->src); push8(u->src, mempeek8(u, a)); }