uxn

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

commit a0f54f118b6c214e47e3ff5037bdb4014dcc9ec5
parent 4d478833d39abccdc2ff3ff301ca9462a4a92eeb
Author: neauoire <aliceffekt@gmail.com>
Date:   Fri, 26 Mar 2021 09:53:17 -0700

Removed special case in JNZ

Diffstat:
Mbuild.sh | 2+-
Mprojects/software/left.usm | 119+++++++++++++++++++++++++++++++++++++++----------------------------------------
Mprojects/software/nasu.usm | 67+++++++++++++++++++++++++++++++++----------------------------------
Mprojects/software/noodle.usm | 175+++++++++++++++++++++++++++++++++++++++----------------------------------------
Dprojects/tests/generic.usm | 9---------
Msrc/uxn.c | 4++--
6 files changed, 182 insertions(+), 194 deletions(-)

diff --git a/build.sh b/build.sh @@ -28,7 +28,7 @@ else fi echo "Assembling.." -./bin/assembler projects/software/nasu.usm bin/boot.rom +./bin/assembler projects/software/noodle.usm bin/boot.rom echo "Running.." if [ "${2}" = '--cli' ]; diff --git a/projects/software/left.usm b/projects/software/left.usm @@ -16,8 +16,7 @@ ) %RTN { JMP2r } -%RTN? { JNZ2r } -%JMP2? { JNZ2 } +%RTN? { #00 EQU #02 SWP JNZ STH2r JMP2 } %++ { #0001 ADD2 } %-- { #0001 SUB2 } %8/ { #0003 SFT2 } %8* { #0030 SFT2 } @@ -70,62 +69,62 @@ BRK ( ctrl ) - ,ctrl-end ~Controller #00 EQU ~lock #00 NEQ #0000 NEQ2 JMP2? + ,ctrl-end ~Controller #00 EQU ~lock #00 NEQ #0000 NEQ2 JNZ2 ( lock ) #04 =lock - ,no-ctrl-up ~Controller #10 NEQ JMP2? - ( clamp ) ,no-ctrl-up ~position.y #0000 EQU2 JMP2? + ,no-ctrl-up ~Controller #10 NEQ JNZ2 + ( clamp ) ,no-ctrl-up ~position.y #0000 EQU2 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 JMP2? + ,no-ctrl-down ~Controller #20 NEQ 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 JMP2? - ( clamp ) ,no-ctrl-left ~selection.from ,document.body EQU2 JMP2? + ,no-ctrl-left ~Controller #40 NEQ JNZ2 + ( clamp ) ,no-ctrl-left ~selection.from ,document.body EQU2 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 JMP2? + ,no-ctrl-right ~Controller #80 NEQ 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 JMP2? - ,no-aup ~Controller #04 SFT #01 NEQ JMP2? + ,no-alt ~Controller #0f AND #02 NEQ JNZ2 + ,no-aup ~Controller #04 SFT #01 NEQ JNZ2 ,find-wordstart JSR2 =selection.to ,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 @no-aup - ,no-adown ~Controller #04 SFT #02 NEQ JMP2? + ,no-adown ~Controller #04 SFT #02 NEQ JNZ2 ,find-wordend JSR2 =selection.to ,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 @no-adown - ,no-aleft ~Controller #04 SFT #04 NEQ JMP2? + ,no-aleft ~Controller #04 SFT #04 NEQ JNZ2 ~selection.to -- =selection.to ,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 @no-aleft - ,no-aright ~Controller #04 SFT #08 NEQ JMP2? + ,no-aright ~Controller #04 SFT #08 NEQ 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 JMP2? - ,no-cup ~Controller #04 SFT #01 NEQ JMP2? + ,no-ctrl ~Controller #0f AND #01 NEQ JNZ2 + ,no-cup ~Controller #04 SFT #01 NEQ JNZ2 #0004 ,scroll-up JSR2 ,redraw JSR2 ,ctrl-end JMP2 @no-cup - ,no-cdown ~Controller #04 SFT #02 NEQ JMP2? + ,no-cdown ~Controller #04 SFT #02 NEQ JNZ2 #0004 ,scroll-down JSR2 ,redraw JSR2 ,ctrl-end JMP2 @no-cdown - ,no-cleft ~Controller #04 SFT #04 NEQ JMP2? + ,no-cleft ~Controller #04 SFT #04 NEQ JNZ2 ,goto-linestart JSR2 ,redraw JSR2 ,ctrl-end JMP2 @no-cleft - ,no-cright ~Controller #04 SFT #08 NEQ JMP2? + ,no-cright ~Controller #04 SFT #08 NEQ JNZ2 ,goto-lineend JSR2 ,redraw JSR2 ,ctrl-end JMP2 @no-cright @no-ctrl @@ -134,11 +133,11 @@ BRK ( keys ) - ,no-keys ~Keys #00 EQU JMP2? + ,no-keys ~Keys #00 EQU JNZ2 - ,$no-backspace ~Keys #08 NEQ JMP2? + ,$no-backspace ~Keys #08 NEQ JNZ2 ( erase ) - ,$erase-multiple ~selection.to ~selection.from SUB2 #0001 NEQ2 JMP2? + ,$erase-multiple ~selection.to ~selection.from SUB2 #0001 NEQ2 JNZ2 ~selection.to ~selection.from SUB2 ,shift-left JSR2 ,$erase-end JMP2 $erase-multiple @@ -163,28 +162,28 @@ BRK ( mouse ) - ,no-change ~Mouse.state ~touch.state EQU JMP2? + ,no-change ~Mouse.state ~touch.state EQU JNZ2 #0000 =Sprite.x ~Screen.height 8- =Sprite.y ,mouse00icn =Sprite.addr - ,nobutton1 ~Mouse.state #01 NEQ JMP2? ,mouse01icn =Sprite.addr @nobutton1 - ,nobutton2 ~Mouse.state #10 NEQ JMP2? ,mouse10icn =Sprite.addr @nobutton2 - ,nobutton3 ~Mouse.state #11 NEQ JMP2? ,mouse11icn =Sprite.addr @nobutton3 + ,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 #01 =Sprite.color @no-change - ,touch-end ~Mouse.state #00 EQU JMP2? + ,touch-end ~Mouse.state #00 EQU JNZ2 - ,touch-linebar ~Mouse.x #0010 LTH2 JMP2? - ,touch-body ~Mouse.x ~Screen.width 8- LTH2 JMP2? + ,touch-linebar ~Mouse.x #0010 LTH2 JNZ2 + ,touch-body ~Mouse.x ~Screen.width 8- LTH2 JNZ2 ,touch-scrollbar JMP2 @touch-end ~Mouse.state =touch.state - ( unlock ) ,skip-unlock ~lock #00 EQU JMP2? ~lock #01 SUB =lock @skip-unlock + ( unlock ) ,skip-unlock ~lock #00 EQU JNZ2 ~lock #01 SUB =lock @skip-unlock ,draw-cursor JSR2 @@ -192,11 +191,11 @@ BRK @touch-scrollbar - ,$no-up ~Mouse.y #0008 GTH2 JMP2? + ,$no-up ~Mouse.y #0008 GTH2 JNZ2 ( decr ) ~scroll.y #00 ~scroll.y #0000 NEQ2 SUB2 =scroll.y ^$end JMP $no-up - ,$no-down ~Mouse.y ~Screen.height 8- LTH2 JMP2? + ,$no-down ~Mouse.y ~Screen.height 8- LTH2 JNZ2 ( incr ) ~scroll.y ++ =scroll.y ^$end JMP $no-down @@ -221,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 JMP2? + ,$no-chord-cut ~Mouse.chord #01 NEQ JNZ2 ,cut JSR2 ( release ) #00 DUP =Mouse.state =Mouse.chord ^$end JMP $no-chord-cut - ,$no-chord-paste ~Mouse.chord #10 NEQ JMP2? + ,$no-chord-paste ~Mouse.chord #10 NEQ JNZ2 ,paste JSR2 ( release ) #00 DUP =Mouse.state =Mouse.chord ^$end JMP $no-chord-paste - ,$end ~Mouse.state #11 EQU JMP2? + ,$end ~Mouse.state #11 EQU JNZ2 - ,$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 JNZ2 ( on drag ) ,find-selection JSR2 ++ =selection.to ,clamp-selection JSR2 @@ -261,7 +260,7 @@ RTN @scroll-up ( length ) - DUP2 ~scroll.y LTH2 ,$clamp ROT JMP2? + DUP2 ~scroll.y LTH2 ,$clamp ROT JNZ2 #0000 =scroll.y POP2 RTN $clamp ~scroll.y SWP2 SUB2 =scroll.y @@ -301,10 +300,10 @@ RTN @follow-selection - ,$no-up ~position.y ~scroll.y GTH2 JMP2? + ,$no-up ~position.y ~scroll.y GTH2 JNZ2 ~position.y =scroll.y RTN $no-up - ,$no-down ~position.y ~Screen.height #0010 SUB2 8/ ~scroll.y ADD2 LTH2 JMP2? + ,$no-down ~position.y ~Screen.height #0010 SUB2 8/ ~scroll.y ADD2 LTH2 JNZ2 ~position.y ~Screen.height #0010 SUB2 8/ SUB2 =scroll.y RTN $no-down @@ -348,9 +347,9 @@ RTN ~selection.to =j $loop NOP ( decr ) ~j -- =j - ,$end ~j PEK2 #20 EQU JMP2? - ,$end ~j PEK2 #0a EQU JMP2? - ,$end ~j PEK2 #0d EQU JMP2? + ,$end ~j PEK2 #20 EQU JNZ2 + ,$end ~j PEK2 #0a EQU JNZ2 + ,$end ~j PEK2 #0d EQU JNZ2 ~j ,document.body GTH2 ^$loop MUL JMP $end ( return ) ~j -- @@ -362,9 +361,9 @@ RTN ~selection.to =j $loop NOP ( incr ) ~j ++ =j - ,$end ~j PEK2 #20 EQU JMP2? - ,$end ~j PEK2 #0a EQU JMP2? - ,$end ~j PEK2 #0d EQU JMP2? + ,$end ~j PEK2 #20 EQU JNZ2 + ,$end ~j PEK2 #0a EQU JNZ2 + ,$end ~j PEK2 #0d EQU JNZ2 ~j ,document.body GTH2 ^$loop MUL JMP $end ( return ) ~j ++ @@ -376,8 +375,8 @@ RTN #0000 =j $loop NOP ( incr ) ~j ++ =j - ,$end ~selection.from ~j SUB2 PEK2 #0a EQU JMP2? - ,$end ~selection.from ~j SUB2 PEK2 #0d EQU JMP2? + ,$end ~selection.from ~j SUB2 PEK2 #0a EQU JNZ2 + ,$end ~selection.from ~j SUB2 PEK2 #0d EQU JNZ2 ~selection.from ~j SUB2 ,document.body GTH2 ^$loop MUL JMP $end ( return ) ~j @@ -388,8 +387,8 @@ RTN ,document.body =j #0000 =pt.y $loop NOP - ,$end ~pt.y ~position.y -- GTH2 JMP2? - ,$no-space ~j PEK2 #0a NEQ ~j PEK2 #0d NEQ #0101 EQU2 JMP2? + ,$end ~pt.y ~position.y -- GTH2 JNZ2 + ,$no-space ~j PEK2 #0a NEQ ~j PEK2 #0d NEQ #0101 EQU2 JNZ2 ( incr ) ~pt.y ++ =pt.y $no-space ( incr ) ~j ++ =j @@ -404,8 +403,8 @@ RTN ,find-line JSR2 ( find line ) #0000 =pt.x $loop NOP - ,$end ~j ~pt.x ADD2 PEK2 #0a EQU JMP2? - ,$end ~j ~pt.x ADD2 PEK2 #0d EQU JMP2? + ,$end ~j ~pt.x ADD2 PEK2 #0a EQU JNZ2 + ,$end ~j ~pt.x ADD2 PEK2 #0d EQU JNZ2 ( incr ) ~pt.x ++ =pt.x ~pt.x ~position.x -- LTH2 ^$loop MUL JMP $end @@ -449,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 JMP2? + ,$no-space ~selection.from PEK2 #0a NEQ ~selection.from PEK2 #0d NEQ #0101 EQU2 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 JMP2? + ,$no-reached ~pt.y ~position.y -- GTH2 ~pt.x ~position.x -- GTH2 #0101 NEQ2 JNZ2 ~selection.from ++ =selection.to RTN $no-reached ( incr ) ~pt.x ++ =pt.x ( incr ) ~selection.from ++ =selection.from - ,$loop ~selection.from PEK2 #00 NEQ JMP2? + ,$loop ~selection.from PEK2 #00 NEQ JNZ2 RTN @@ -531,8 +530,8 @@ RTN ( scroll to position ) #0000 =j ( j is linebreaks ) $find-offset NOP - ,$find-offset-end ~scroll.y ~j EQU2 JMP2? - ,$no-break ~textarea.addr PEK2 #0a NEQ ~textarea.addr PEK2 #0d NEQ #0101 EQU2 JMP2? + ,$find-offset-end ~scroll.y ~j EQU2 JNZ2 + ,$no-break ~textarea.addr PEK2 #0a NEQ ~textarea.addr PEK2 #0d NEQ #0101 EQU2 JNZ2 ( incr ) ~j ++ =j $no-break ( incr ) ~textarea.addr ++ =textarea.addr @@ -544,7 +543,7 @@ RTN $loop - ,$end ~Sprite.y ~Screen.height #0010 SUB2 GTH2 JMP2? + ,$end ~Sprite.y ~Screen.height #0010 SUB2 GTH2 JNZ2 ( get character ) ,font #00 ~i PEK2 #20 SUB 8* ADD2 =Sprite.addr @@ -554,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 JMP2? + ,$no-linebreak ~i PEK2 #0a NEQ ~i PEK2 #0d NEQ #0101 EQU2 JNZ2 ( draw linebreak ) ,linebreak_icn =Sprite.addr ( draw ) #02 @@ -566,7 +565,7 @@ RTN ( incr ) ~Sprite.x 8+ =Sprite.x ,font =Sprite.addr #01 =Sprite.color - ,$fill-clear ~Sprite.x ~Screen.width 8- LTH2 JMP2? + ,$fill-clear ~Sprite.x ~Screen.width 8- LTH2 JNZ2 ( draw line number ) @@ -586,7 +585,7 @@ RTN ( incr ) ~i ++ =i ( incr ) ~Sprite.x #0007 ADD2 =Sprite.x - ,$loop ~i PEK2 #00 NEQ JMP2? + ,$loop ~i PEK2 #00 NEQ JNZ2 $end diff --git a/projects/software/nasu.usm b/projects/software/nasu.usm @@ -8,8 +8,7 @@ ) %RTN { JMP2r } -%RTN? { JNZ2r } -%JMP2? { JNZ2 } +%RTN? { #00 EQU #02 SWP JNZ STH2r JMP2 } %STEP8 { #0033 SFT2 } %++ { #0001 ADD2 } @@ -63,28 +62,28 @@ BRK ( keyboard controls ) - ,no-key ~Keys #00 EQU JMP2? + ,no-key ~Keys #00 EQU JNZ2 - ,no-key ~Keys #31 LTH JMP2? - ,no-key ~Keys #33 GTH JMP2? + ,no-key ~Keys #31 LTH JNZ2 + ,no-key ~Keys #33 GTH JNZ2 ( select ) ~Keys #31 SUB =bankview.mode ( release ) #00 =Keys ,redraw JSR2 @no-key - ,no-ctrl ~Controller.buttons #00 EQU JMP2? + ,no-ctrl ~Controller.buttons #00 EQU JNZ2 - ,no-ctrl-up ~Controller.buttons #10 EQU JMP2? + ,no-ctrl-up ~Controller.buttons #10 EQU JNZ2 ~tileview.addr #0080 ADD2 =tileview.addr @no-ctrl-up - ,no-ctrl-down ~Controller.buttons #20 EQU JMP2? + ,no-ctrl-down ~Controller.buttons #20 EQU JNZ2 ~tileview.addr #0080 SUB2 =tileview.addr @no-ctrl-down - ,no-ctrl-left ~Controller.buttons #40 EQU JMP2? + ,no-ctrl-left ~Controller.buttons #40 EQU JNZ2 ~tileview.addr 8+ =tileview.addr @no-ctrl-left - ,no-ctrl-right ~Controller.buttons #80 EQU JMP2? + ,no-ctrl-right ~Controller.buttons #80 EQU JNZ2 ~tileview.addr 8- =tileview.addr @no-ctrl-right ~tileview.addr #0800 DIV2 #0800 MUL2 =bankview.addr @@ -94,27 +93,27 @@ BRK ( mouse controls ) - ,click-end ~Mouse.state #00 EQU JMP2? + ,click-end ~Mouse.state #00 EQU JNZ2 ( toolbar ) - ,no-toolbar-click ~Mouse.y ~bankview.y #0010 SUB2 SUB2 8/ #0000 NEQ2 JMP2? + ,no-toolbar-click ~Mouse.y ~bankview.y #0010 SUB2 SUB2 8/ #0000 NEQ2 JNZ2 ( brush ) - ,no-brush-click ~Mouse.x ~bankview.x SUB2 8/ #000d LTH2 JMP2? - ,no-brush-click ~Mouse.x ~bankview.x SUB2 8/ #000f GTH2 JMP2? + ,no-brush-click ~Mouse.x ~bankview.x SUB2 8/ #000d LTH2 JNZ2 + ,no-brush-click ~Mouse.x ~bankview.x SUB2 8/ #000f GTH2 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 JMP2? + ,no-load-click ~Mouse.x ~tileview.x SUB2 8/ #000e NEQU2 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 JMP2? + ,no-save-click ~Mouse.x ~tileview.x SUB2 8/ #000f NEQU2 JNZ2 ( save ) ,filepath =File.name #0800 =File.length ~bankview.addr =File.save ( release ) #00 =Mouse.state ,redraw JSR2 ,click-end JMP2 @@ -126,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 JMP2? + #0101 NEQ2 ,no-bank-click ROT JNZ2 - ,not-copy-mode ~bankview.mode #01 NEQ JMP2? + ,not-copy-mode ~bankview.mode #01 NEQ JNZ2 #00 =i @copy-loop NOP ( load ) ~tileview.addr ~i ADD PEK2 @@ -141,7 +140,7 @@ BRK ,redraw JSR2 ,click-end JMP2 @not-copy-mode - ,not-erase-mode ~bankview.mode #02 NEQ JMP2? + ,not-erase-mode ~bankview.mode #02 NEQ JNZ2 #00 =i @erase-loop NOP #00 @@ -165,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 JMP2? + #0101 NEQ2 ,no-tile-click ROT JNZ2 ~Mouse.x ~tileview.x SUB2 STEP8 #0040 DIV2 ~Mouse.y ~tileview.y SUB2 STEP8 #0040 DIV2 2* ADD2 @@ -173,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 JMP2? + ,no-erase-mode ~Mouse.state #10 NEQ JNZ2 ( load ) ~addr ~pos.y 8/ ADD2 PEK2 ( mask ) #01 #07 ~pos.x 8/ SWP POP SUB SFL #ff EOR AND @@ -190,15 +189,15 @@ BRK ( operations ) - ,no-operations ~Mouse.y ~tileview.y SUB2 8/ #000c NEQ2 JMP2? + ,no-operations ~Mouse.y ~tileview.y SUB2 8/ #000c NEQ2 JNZ2 - ,no-move-up ~Mouse.x ~tileview.x SUB2 8/ #0011 NEQ2 JMP2? + ,no-move-up ~Mouse.x ~tileview.x SUB2 8/ #0011 NEQ2 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 JMP2? + ,no-move-down ~Mouse.x ~tileview.x SUB2 8/ #0012 NEQ2 JNZ2 ,op_shiftdown JSR2 ( release ) #00 =Mouse.state ,redraw JSR2 ,click-end JMP2 @@ -298,7 +297,7 @@ RTN ( draw ) #02 =Sprite.color ~Sprite.addr 8+ =Sprite.addr ( incr ) ~i #01 ADD =i - ,$guides ~i #10 LTH JMP2? + ,$guides ~i #10 LTH JNZ2 ( body ) @@ -315,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 JMP2? + ,$hor ~pt.x #10 LTH JNZ2 ( incr ) ~pt.y #01 ADD =pt.y ( incr ) ~Sprite.y 8+ =Sprite.y - ,$ver ~pt.y #10 LTH JMP2? + ,$ver ~pt.y #10 LTH JNZ2 RTN @@ -365,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 JMP2? + ~Screen.x ~tileview.x #0082 ADD2 LTH2 ,$line-hor ROT JNZ2 ( line ver ) ~tileview.y =Screen.y @@ -373,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 JMP2? + ~Screen.y ~tileview.y #0081 ADD2 LTH2 ,$line-ver ROT JNZ2 ( rewind ) ~tileview.addr #0018 SUB2 =tileview.addr @@ -390,7 +389,7 @@ RTN ( draw ) #02 =Sprite.color ( incr ) ~i #01 ADD =i ( incr ) ~Sprite.y 8+ =Sprite.y - ,$bytes ~i #08 LTH JMP2? + ,$bytes ~i #08 LTH JNZ2 ( operations ) @@ -413,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 JMP2? + ,$tiles-hor ~pt.x #02 LTH JNZ2 ( incr ) ~pt.y #01 ADD =pt.y ( incr ) ~Sprite.y 8+ =Sprite.y - ,$tiles-ver ~pt.y #02 LTH JMP2? + ,$tiles-ver ~pt.y #02 LTH JNZ2 RTN @@ -433,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 JMP2? + ,$hor ~pt.x #08 LTH 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 JMP2? + ,$ver ~pt.y #08 LTH JNZ2 RTN diff --git a/projects/software/noodle.usm b/projects/software/noodle.usm @@ -17,9 +17,8 @@ - Zoom drawing with other tools ) -%JMP? { JNZ } -%JMP2? { JNZ2 } %RTN { JMP2r } +%RTN? { #00 EQU #02 SWP JNZ STH2r JMP2 } %ABS2 { DUP2 #000f SFT2 EQU #04 SWP JNZ #ffff MUL2 } %STEP8 { #0033 SFT2 } %MOD8 { #0007 AND2 } @@ -112,7 +111,7 @@ BRK ,draw-cursor JSR2 ( release drag ) - ,$no-release ~Mouse.state #00 EQU ~brush.drag #01 EQU #0101 NEQ2 JMP2? + ,$no-release ~Mouse.state #00 EQU ~brush.drag #01 EQU #0101 NEQ2 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 @@ -124,32 +123,32 @@ BRK $no-release ( operations on release line/rect ) - ,$no-touch-change ~Mouse.state ~brush.last EQU JMP2? - ,$no-touch-change ~Mouse.x CLN2r ~canvas.x1 GTS2 STH2r ~canvas.x2 LTS2 #0101 NEQ2 JMP2? - ,$no-touch-change ~Mouse.y CLN2r ~canvas.y1 GTS2 STH2r ~canvas.y2 LTS2 #0101 NEQ2 JMP2? - ,$no-touch-ondown ~Mouse.state #00 EQU JMP2? + ,$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 ( on down ) ~Mouse.x =cursor.dx ~Mouse.y =cursor.dy $no-touch-ondown - ,$no-touch-onup ~Mouse.state #00 NEQ JMP2? + ,$no-touch-onup ~Mouse.state #00 NEQ JNZ2 ( on up ) - ,$no-touch-line ~brush.tool #02 NEQ JMP2? + ,$no-touch-line ~brush.tool #02 NEQ 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 JMP2? + ,$no-touch-rect ~brush.tool #03 NEQ 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 JMP2? + ,$no-touch ~Mouse.state #00 EQU JNZ2 ( drag ) - ,$no-drag ~Controller #02 NEQ JMP2? - ,$no-drag-start ~brush.drag #00 NEQ JMP2? + ,$no-drag ~Controller #02 NEQ JNZ2 + ,$no-drag-start ~brush.drag #00 NEQ JNZ2 ~canvas.x1 =origin.x1 ~canvas.y1 =origin.y1 ~canvas.x2 =origin.x2 @@ -166,8 +165,8 @@ BRK $no-drag ( in sizepane ) - ,$no-touch-sizepane ~Mouse.x CLN2r ~sizepane.x1 GTH2 STH2r ~sizepane.x2 LTH2 #0101 NEQ2 JMP2? - ,$no-touch-sizepane ~Mouse.y CLN2r ~sizepane.y1 GTH2 STH2r ~sizepane.y2 LTH2 #0101 NEQ2 JMP2? + ,$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 ( release ) #00 =Mouse.state #01 =brush.tool ~Mouse.x ~sizepane.x1 SUB2 8/ SWP POP =brush.size @@ -177,8 +176,8 @@ BRK $no-touch-sizepane ( in pattpane ) - ,$no-touch-pattpane ~Mouse.x CLN2r ~pattpane.x1 GTH2 STH2r ~pattpane.x2 LTH2 #0101 NEQ2 JMP2? - ,$no-touch-pattpane ~Mouse.y CLN2r ~pattpane.y1 GTH2 STH2r ~pattpane.y2 LTH2 #0101 NEQ2 JMP2? + ,$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 ( release ) #00 =Mouse.state ~Mouse.x ~pattpane.x1 SUB2 8/ SWP POP =brush.patt ( draw ) ,draw-pattpane JSR2 @@ -186,8 +185,8 @@ BRK $no-touch-pattpane ( in toolpane ) - ,$no-touch-toolpane ~Mouse.x CLN2r ~toolpane.x1 GTH2 STH2r ~toolpane.x2 LTH2 #0101 NEQ2 JMP2? - ,$no-touch-toolpane ~Mouse.y CLN2r ~toolpane.y1 GTH2 STH2r ~toolpane.y2 LTH2 #0101 NEQ2 JMP2? + ,$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 ( release ) #00 =Mouse.state ~Mouse.x ~toolpane.x1 SUB2 8/ SWP POP =brush.tool ( draw ) ,draw-toolpane JSR2 @@ -195,23 +194,23 @@ BRK $no-touch-toolpane ( in canvas ) - ,$no-touch-canvas ~Mouse.x CLN2r ~canvas.x1 GTS2 STH2r ~canvas.x2 LTS2 #0101 NEQ2 JMP2? - ,$no-touch-canvas ~Mouse.y CLN2r ~canvas.y1 GTS2 STH2r ~canvas.y2 LTS2 #0101 NEQ2 JMP2? + ,$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 ( set cursor operation ) - ,add-pixel ,$no-oper ~Mouse.state #01 EQU JMP2? POP2 ,remove-pixel $no-oper =brush.oper + ,add-pixel ,$no-oper ~Mouse.state #01 EQU JNZ2 POP2 ,remove-pixel $no-oper =brush.oper - ,$no-touch-pen ~brush.tool #00 NEQ JMP2? + ,$no-touch-pen ~brush.tool #00 NEQ 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 JMP2? + ,$no-touch-brush ~brush.tool #01 NEQ 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 JMP2? + ,$no-touch-zoom ~brush.tool #04 NEQ JNZ2 ~zoom.active #00 EQU =zoom.active ( release ) #00 =Mouse.state ~Mouse.x ~canvas.x1 SUB2 ~canvas.w 2/ SUB2 =zoom.x @@ -223,14 +222,14 @@ BRK $no-touch-canvas ( background interface ) - ,$no-touch-background ~Mouse.y STEP8 ~Screen.height #0010 SUB2 NEQ2 JMP2? + ,$no-touch-background ~Mouse.y STEP8 ~Screen.height #0010 SUB2 NEQ2 JNZ2 ~Mouse.x ~Screen.width #0020 SUB2 SUB2 8/ - DUP2 #0001 NEQ2 ,$no-load-button ROT JMP2? + DUP2 #0001 NEQ2 ,$no-load-button ROT JNZ2 ,filepath ,load-file JSR2 ,draw-canvas JSR2 ( release ) #00 =Mouse.state $no-load-button - DUP2 #0002 NEQ2 ,$no-save-button ROT JMP2? + DUP2 #0002 NEQ2 ,$no-save-button ROT JNZ2 ,filepath ,save-file JSR2 ( release ) #00 =Mouse.state $no-save-button @@ -243,34 +242,34 @@ BRK $no-touch ~Controller.buttons #f0 AND - DUP #04 SFT #01 AND #01 NEQ ,$no-up ROT JMP2? + DUP #04 SFT #01 AND #01 NEQ ,$no-up ROT JNZ2 ( move ) ~zoom.y -- =zoom.y $no-up - DUP #05 SFT #01 AND #01 NEQ ,$no-down ROT JMP2? + DUP #05 SFT #01 AND #01 NEQ ,$no-down ROT JNZ2 ( move ) ~zoom.y ++ =zoom.y $no-down - DUP #06 SFT #01 AND #01 NEQ ,$no-left ROT JMP2? + DUP #06 SFT #01 AND #01 NEQ ,$no-left ROT JNZ2 ( move ) ~zoom.x -- =zoom.x $no-left - DUP #07 SFT #01 AND #01 NEQ ,$no-right ROT JMP2? + DUP #07 SFT #01 AND #01 NEQ ,$no-right ROT JNZ2 ( move ) ~zoom.x ++ =zoom.x $no-right - #00 EQU #04 SWP JMP? ,draw-canvas JSR2 + #00 EQU #04 SWP JNZ ,draw-canvas JSR2 - ,$no-keys ~Keys #00 EQU JMP2? + ,$no-keys ~Keys #00 EQU JNZ2 ~Keys - DUP #20 NEQ ,$no-space ROT JMP2? + DUP #20 NEQ ,$no-space ROT JNZ2 ( toggle zoom ) ~zoom.active #00 EQU =zoom.active ,redraw JSR2 $no-space - DUP #08 NEQ ,$no-backspace ROT JMP2? + DUP #08 NEQ ,$no-backspace ROT JNZ2 ( erase ) ,clear JSR2 $no-backspace - DUP #71 NEQ ,$no-qkey ROT JMP2? + DUP #71 NEQ ,$no-qkey ROT JNZ2 ( tool0 ) #00 =brush.tool ,draw-toolpane JSR2 $no-qkey - DUP #77 NEQ ,$no-wkey ROT JMP2? + DUP #77 NEQ ,$no-wkey ROT JNZ2 ( tool0 ) #01 =brush.tool ,draw-toolpane JSR2 $no-wkey - DUP #65 NEQ ,$no-ekey ROT JMP2? + DUP #65 NEQ ,$no-ekey ROT JNZ2 ( tool0 ) #02 =brush.tool ,draw-toolpane JSR2 $no-ekey - DUP #72 NEQ ,$no-rkey ROT JMP2? + DUP #72 NEQ ,$no-rkey ROT JNZ2 ( tool0 ) #03 =brush.tool ,draw-toolpane JSR2 $no-rkey - DUP #74 NEQ ,$no-tkey ROT JMP2? + DUP #74 NEQ ,$no-tkey ROT JNZ2 ( tool0 ) #04 =brush.tool ,draw-toolpane JSR2 $no-tkey DUP - DUP #30 GTH SWP #39 LTH #0101 NEQ2 ,$no-numkey ROT JMP2? + DUP #30 GTH SWP #39 LTH #0101 NEQ2 ,$no-numkey ROT JNZ2 ( size ) ~Keys #31 SUB =brush.size ,draw-sizepane JSR2 $no-numkey POP ( release ) #00 =Keys @@ -289,7 +288,7 @@ BRK $loop NOP OVR2 #00 ROT ROT POK2 ( incr ) SWP2 #0001 ADD2 SWP2 - OVR2 OVR2 LTH2 ^$loop SWP JMP? + OVR2 OVR2 LTH2 ^$loop SWP JNZ POP2 POP2 ,redraw JSR2 @@ -321,7 +320,7 @@ RTN ( load ) =line.y1 =line.x1 =line.y2 =line.x2 ( trim if zoomed ) - ,$no-zoom ~zoom.active #01 NEQ JMP2? + ,$no-zoom ~zoom.active #01 NEQ 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 @@ -335,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 JMP2? + ,$end ~line.x2 ~line.x1 EQU2 ~line.y2 ~line.y1 EQU2 #0101 EQU2 JNZ2 ~line.e1 #0002 MUL2 =line.e2 - ,$skipy ~line.e2 ~line.dy LTS2 JMP2? + ,$skipy ~line.e2 ~line.dy LTS2 JNZ2 ~line.e1 ~line.dy ADD2 =line.e1 ~line.x2 ~line.sx ADD2 =line.x2 $skipy - ,$skipx ~line.e2 ~line.dx GTS2 JMP2? + ,$skipx ~line.e2 ~line.dx GTS2 JNZ2 ~line.e1 ~line.dx ADD2 =line.e1 ~line.y2 ~line.sy ADD2 =line.y2 $skipx @@ -361,7 +360,7 @@ RTN ( load ) =rect.y2 =rect.x2 =rect.y1 =rect.x1 ( trim if zoomed ) - ,$no-zoom ~zoom.active #01 NEQ JMP2? + ,$no-zoom ~zoom.active #01 NEQ 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 @@ -375,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 JMP2? + ,$no-pixel ,patternize JSR2 #00 EQU JNZ2 ( draw ) ~pt2.x ~pt2.y ~brush.oper JSR2 $no-pixel ( incr ) ~pt2.x ++ =pt2.x - ,$hor ~pt2.x ~rect.x2 LTS2 JMP2? + ,$hor ~pt2.x ~rect.x2 LTS2 JNZ2 ~pt2.y ++ =pt2.y - ,$ver ~pt2.y ~rect.y2 LTS2 JMP2? + ,$ver ~pt2.y ~rect.y2 LTS2 JNZ2 ,draw-canvas JSR2 ,draw-toolpane JSR2 @@ -395,7 +394,7 @@ RTN #0003 SUB2 =pt0.y #0003 SUB2 =pt0.x ( cursor offset ) ( trim if zoomed ) - ,$no-zoom ~zoom.active #01 NEQ JMP2? + ,$no-zoom ~zoom.active #01 NEQ JNZ2 ~pt0.x 8/ ~zoom.x ADD2 #0003 SUB2 =pt0.x ~pt0.y 8/ ~zoom.y ADD2 #0003 SUB2 =pt0.y $no-zoom @@ -406,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 JMP2? - ,$no-pixel ,patternize JSR2 #00 EQU JMP2? + #00 EQU ,$no-pixel ROT JNZ2 + ,$no-pixel ,patternize JSR2 #00 EQU 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 JMP2? + ,$hor ~px.x #08 LTH JNZ2 ( incr ) ~px.y #01 ADD =px.y - ,$ver ~px.y #08 LTH JMP2? + ,$ver ~px.y #08 LTH JNZ2 ,draw-canvas JSR2 ,draw-toolpane JSR2 @@ -424,44 +423,44 @@ RTN @patternize - ,$noplain ~brush.patt #00 NEQ JMP2? + ,$noplain ~brush.patt #00 NEQ JNZ2 #01 RTN $noplain - ,$notone1 ~brush.patt #01 NEQ JMP2? + ,$notone1 ~brush.patt #01 NEQ 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 JMP2? + ,$notone2 ~brush.patt #02 NEQ 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 JMP2? + ,$notone3 ~brush.patt #03 NEQ 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 JMP2? + ,$notone4 ~brush.patt #04 NEQ 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 JMP2? + ,$notone5 ~brush.patt #05 NEQ 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 JMP2? + ,$notone6 ~brush.patt #06 NEQ JNZ2 ~pt0.x #00 ~px.x ADD2 #0001 AND2 SWP POP RTN $notone6 - ,$notone7 ~brush.patt #07 NEQ JMP2? + ,$notone7 ~brush.patt #07 NEQ JNZ2 ~pt0.y #00 ~px.y ADD2 #0001 AND2 SWP POP RTN $notone7 @@ -513,7 +512,7 @@ RTN @draw-canvas - ,draw-canvas-zoom ~zoom.active #01 EQU JMP2? + ,draw-canvas-zoom ~zoom.active #01 EQU JNZ2 ~canvas.y1 =Sprite.y ,data =Sprite.addr @@ -523,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 JMP2? + ,$hor ~Sprite.x ~canvas.x2 NEQ2 JNZ2 ( incr ) ~Sprite.y 8+ =Sprite.y - ,$ver ~Sprite.y ~canvas.y2 NEQ2 JMP2? + ,$ver ~Sprite.y ~canvas.y2 NEQ2 JNZ2 RTN @@ -542,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 JMP2? + ,$hor ~Sprite.x ~canvas.x2 NEQ2 JNZ2 ( incr ) ~Sprite.y 8+ =Sprite.y ( incr ) ~pt1.y ++ =pt1.y - ,$ver ~Sprite.y ~canvas.y2 NEQ2 JMP2? + ,$ver ~Sprite.y ~canvas.y2 NEQ2 JNZ2 RTN @@ -556,7 +555,7 @@ RTN #0000 EQU2 ~Mouse.state #00 NEQ - #0101 EQU2 JNZ2r ( Return if unchanged ) + #0101 EQU2 RTN? ( Return if unchanged ) ,blank_icn =Sprite.addr @@ -575,20 +574,20 @@ RTN ~Mouse.y =cursor.y ( draw size cursor ) - ,$outside-canvas ~brush.tool #01 NEQ JMP2? - ,$outside-canvas ~Mouse.x CLN2r ~canvas.x1 GTH2 STH2r ~canvas.x2 LTH2 #0101 NEQ2 JMP2? - ,$outside-canvas ~Mouse.y CLN2r ~canvas.y1 GTH2 STH2r ~canvas.y2 LTH2 #0101 NEQ2 JMP2? + ,$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 ( 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 JMP2? - ,$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 JMP2? - ,$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 JMP2? + ,$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 ( do not draw size when holding alt ) - ,$outside-canvas ~Controller #02 EQU JMP2? + ,$outside-canvas ~Controller #02 EQU 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 JMP2? + ,$outside-canvas ~Mouse.state #00 EQU JNZ2 RTN $outside-canvas @@ -612,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 JMP2? + ,$tools ~Sprite.x ~toolpane.x2 LTH2 JNZ2 - ,$no-zoom ~zoom.active #01 NEQ JMP2? + ,$no-zoom ~zoom.active #01 NEQ JNZ2 ~Sprite.x #0008 SUB2 =Sprite.x ,tool_icn #0028 ADD2 =Sprite.addr #01 #04 ~brush.tool EQU #02 MUL ADD =Sprite.color @@ -635,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 JMP2? + ,$patterns ~Sprite.x ~pattpane.x2 LTH2 JNZ2 RTN @@ -652,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 JMP2? + ,$patterns ~Sprite.x ~sizepane.x2 LTH2 JNZ2 RTN @@ -664,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 JMP? + OVR2 OVR2 LTH2 ^$draw-hor SWP JNZ POP2 POP2 ( draw ver line ) @@ -673,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 JMP? + OVR2 OVR2 LTH2 ^$draw-ver SWP JNZ POP2 POP2 ( draw save/load/guides icons ) @@ -712,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 JMP2? + ,$hor ~Screen.x ~rect.x2 NEQ2 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 JMP2? + ,$ver ~Screen.y ~rect.y2 ++ NEQ2 JNZ2 RTN @@ -730,9 +729,9 @@ RTN $hor ( draw ) ~color =Screen.color ( incr ) ~Screen.x ++ =Screen.x - ,$hor ~Screen.x ~rect.x2 NEQ2 JMP2? + ,$hor ~Screen.x ~rect.x2 NEQ2 JNZ2 ( incr ) ~Screen.y ++ =Screen.y - ,$ver ~Screen.y ~rect.y2 NEQ2 JMP2? + ,$ver ~Screen.y ~rect.y2 NEQ2 JNZ2 RTN diff --git a/projects/tests/generic.usm b/projects/tests/generic.usm @@ -1,9 +0,0 @@ -|0100 ;Console { pad 8 char 1 byte 1 short 2 } -|01F0 .RESET .FRAME .ERROR ( vectors ) - -@RESET - -BRK - -@FRAME BRK -@ERROR BRK 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->wst), b; if (getflag(&u->status, FLAG_RETURN) && !a) return; 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 (a) u->ram.ptr += (Sint8)b; } 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); if (getflag(&u->status, FLAG_RETURN) && !a) return; Uint16 b = pop16(u->src); if (a) u->ram.ptr = b; } +void op_jnz16(Uxn *u) { Uint8 a = pop8(&u->wst); Uint16 b = pop16(u->src); if (a) u->ram.ptr = b; } 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)); }