uxn

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

commit e3e2b792a613bf1fdec38ef0b06cb5aae91c3e3a
parent 607f1b567fc4c7c26e2b395c55a5165bceec4060
Author: neauoire <aliceffekt@gmail.com>
Date:   Wed, 10 Mar 2021 19:41:46 -0800

Started migrating to relative jumps

Diffstat:
MREADME.md | 3+++
Mbuild.sh | 2+-
Mprojects/examples/dev.console.usm | 6+++---
Mprojects/examples/dev.ctrl.usm | 20++++++++++----------
Mprojects/examples/dev.key.usm | 62+++++++++++++++++++++++++++++++-------------------------------
Mprojects/examples/dev.mouse.usm | 94++++++++++++++++++++++++++++++++++++++++----------------------------------------
Mprojects/examples/dev.screen.usm | 16++++++++--------
Mprojects/examples/gui.hover.usm | 30+++++++++++++++---------------
Mprojects/examples/gui.label.usm | 24++++++++++++------------
Mprojects/examples/gui.picture.usm | 10+++++-----
Mprojects/examples/gui.shapes.usm | 46+++++++++++++++++++++++-----------------------
Mprojects/examples/win.editor.usm | 72++++++++++++++++++++++++++++++++++++------------------------------------
Mprojects/software/left.usm | 231+++++++++++++++++++++++++++++++++++++++----------------------------------------
Mprojects/software/nasu.usm | 132++++++++++++++++++++++++++++++++++++++++----------------------------------------
Muxn.c | 8+++++---
15 files changed, 380 insertions(+), 376 deletions(-)

diff --git a/README.md b/README.md @@ -95,6 +95,9 @@ RTS - Includes - Defines +- Jump relative +- Local loops +- Jump helpers ## Palettes diff --git a/build.sh b/build.sh @@ -20,5 +20,5 @@ cc -std=c89 -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wextra -Werr # cc uxn.c emulator.c -std=c89 -Os -DNDEBUG -g0 -s -Wall -Wno-unknown-pragmas -L/usr/local/lib -lSDL2 -o bin/emulator # run -./bin/assembler projects/software/left.usm bin/boot.rom +./bin/assembler projects/software/nasu.usm bin/boot.rom ./bin/emulator bin/boot.rom diff --git a/projects/examples/dev.console.usm b/projects/examples/dev.console.usm @@ -4,8 +4,8 @@ |0100 @RESET - ,text1 ,print-label JSR - ,text2 ,print-label JSR + ,text1 ,print-label JSR2 + ,text2 ,print-label JSR2 #ab =dev/console.byte #cdef =dev/console.short @@ -16,7 +16,7 @@ BRK @print-label-loop DUP2 LDR =dev/console.char ( write pointer value to console ) #0001 ADD2 ( increment string pointer ) - DUP2 LDR #00 NEQ ,print-label-loop ROT JMP? POP2 ( while *ptr!=0 goto loop ) + DUP2 LDR #00 NEQ ,print-label-loop ROT JMP2? POP2 ( while *ptr!=0 goto loop ) POP2 RTS diff --git a/projects/examples/dev.ctrl.usm b/projects/examples/dev.ctrl.usm @@ -21,33 +21,33 @@ BRK #0a =slime-color ( hold ctrl key to change slime color ) - ,no-ctrl ~dev/ctrl.buttons #0f AND #01 NEQ JMP? POP2 + ,no-ctrl ~dev/ctrl.buttons #0f AND #01 NEQ JMP2? POP2 #05 =slime-color @no-ctrl ( hold alt key to change slime color ) - ,no-alt ~dev/ctrl.buttons #0f AND #02 NEQ JMP? POP2 + ,no-alt ~dev/ctrl.buttons #0f AND #02 NEQ JMP2? POP2 #0f =slime-color @no-alt ( detect movement ) - ,no-up ~dev/ctrl.buttons #f0 AND #10 NEQ JMP? POP2 + ,no-up ~dev/ctrl.buttons #f0 AND #10 NEQ JMP2? POP2 ( clear ) #10 =dev/sprite.color ( move ) ~dev/sprite.y #0001 SUB2 =dev/sprite.y ,up_icn =dev/sprite.addr - ( draw ) ,redraw JSR BRK + ( draw ) ,redraw JSR2 BRK @no-up - ,no-down ~dev/ctrl.buttons #f0 AND #20 NEQ JMP? POP2 + ,no-down ~dev/ctrl.buttons #f0 AND #20 NEQ JMP2? POP2 ( clear ) #10 =dev/sprite.color ( move ) ~dev/sprite.y #0001 ADD2 =dev/sprite.y ,down_icn =dev/sprite.addr - ( draw ) ,redraw JSR BRK + ( draw ) ,redraw JSR2 BRK @no-down - ,no-left ~dev/ctrl.buttons #f0 AND #40 NEQ JMP? POP2 + ,no-left ~dev/ctrl.buttons #f0 AND #40 NEQ JMP2? POP2 ( clear ) #10 =dev/sprite.color ( move ) ~dev/sprite.x #0001 SUB2 =dev/sprite.x ,left_icn =dev/sprite.addr - ( draw ) ,redraw JSR BRK + ( draw ) ,redraw JSR2 BRK @no-left - ,no-right ~dev/ctrl.buttons #f0 AND #80 NEQ JMP? POP2 + ,no-right ~dev/ctrl.buttons #f0 AND #80 NEQ JMP2? POP2 ( clear ) #10 =dev/sprite.color ( move ) ~dev/sprite.x #0001 ADD2 =dev/sprite.x ,right_icn =dev/sprite.addr - ( draw ) ,redraw JSR BRK + ( draw ) ,redraw JSR2 BRK @no-right BRK diff --git a/projects/examples/dev.key.usm b/projects/examples/dev.key.usm @@ -19,39 +19,39 @@ |0100 @RESET #0080 =textarea.x1 #0060 =textarea.y1 #00c0 =textarea.x2 #0090 =textarea.y2 ,body =textarea.addr - ,redraw JSR - ,redraw-window JSR + ,redraw JSR2 + ,redraw-window JSR2 BRK |0200 @FRAME - ,do-cursor JSR - ,do-textarea JSR + ,do-cursor JSR2 + ,do-textarea JSR2 BRK @redraw-window - #0000 #0000 ~dev/screen.width ~dev/screen.height #01 ,pattern ,tile-rect JSR + #0000 #0000 ~dev/screen.width ~dev/screen.height #01 ,pattern ,tile-rect JSR2 ( dropshadow ) - ~textarea.x2 #0001 ADD2 ~textarea.y1 ~textarea.x2 #0004 ADD2 ~textarea.y2 #0004 ADD2 #01 ,fill-rect JSR - ~textarea.x1 ~textarea.y2 #0001 ADD2 ~textarea.x2 #0001 ADD2 ~textarea.y2 #0004 ADD2 #01 ,fill-rect JSR - ~textarea.x1 #0001 SUB2 ~textarea.y1 #0001 SUB2 ~textarea.x2 ~textarea.y2 #00 ,line-rect JSR - ~textarea.x1 #0002 SUB2 ~textarea.y1 #0002 SUB2 ~textarea.x2 #0001 ADD2 ~textarea.y2 #0001 ADD2 #01 ,line-rect JSR + ~textarea.x2 #0001 ADD2 ~textarea.y1 ~textarea.x2 #0004 ADD2 ~textarea.y2 #0004 ADD2 #01 ,fill-rect JSR2 + ~textarea.x1 ~textarea.y2 #0001 ADD2 ~textarea.x2 #0001 ADD2 ~textarea.y2 #0004 ADD2 #01 ,fill-rect JSR2 + ~textarea.x1 #0001 SUB2 ~textarea.y1 #0001 SUB2 ~textarea.x2 ~textarea.y2 #00 ,line-rect JSR2 + ~textarea.x1 #0002 SUB2 ~textarea.y1 #0002 SUB2 ~textarea.x2 #0001 ADD2 ~textarea.y2 #0001 ADD2 #01 ,line-rect JSR2 RTS @redraw - ~textarea.x1 ~textarea.y1 ~textarea.x2 ~textarea.y2 #01 ,fill-rect JSR - ~textarea.x1 ~textarea.y1 #04 ~textarea.addr ,draw-textarea JSR + ~textarea.x1 ~textarea.y1 ~textarea.x2 ~textarea.y2 #01 ,fill-rect JSR2 + ~textarea.x1 ~textarea.y1 #04 ~textarea.addr ,draw-textarea JSR2 RTS @blink-cursor - ,skip ~timer #10 LTH JMP? POP2 + ,skip ~timer #10 LTH JMP2? POP2 #00 =timer ~blink #00 EQU =blink ,cursor =dev/sprite.addr @@ -70,9 +70,9 @@ RTS @tile-rect-hor ( draw ) ~color =dev/sprite.color ( incr ) ~dev/sprite.x #0008 ADD2 =dev/sprite.x - ,tile-rect-hor ~dev/sprite.x ~rect.x2 LTH2 JMP? POP2 + ,tile-rect-hor ~dev/sprite.x ~rect.x2 LTH2 JMP2? POP2 ( incr ) ~dev/sprite.y #0008 ADD2 =dev/sprite.y - ,tile-rect-ver ~dev/sprite.y ~rect.y2 LTH2 JMP? POP2 + ,tile-rect-ver ~dev/sprite.y ~rect.y2 LTH2 JMP2? POP2 RTS @@ -84,9 +84,9 @@ RTS @fill-rect-hor ( draw ) ~color =dev/screen.color ( incr ) ~dev/screen.x #0001 ADD2 =dev/screen.x - ,fill-rect-hor ~dev/screen.x ~rect.x2 LTH2 JMP? POP2 + ,fill-rect-hor ~dev/screen.x ~rect.x2 LTH2 JMP2? POP2 ( incr ) ~dev/screen.y #0001 ADD2 =dev/screen.y - ,fill-rect-ver ~dev/screen.y ~rect.y2 LTH2 JMP? POP2 + ,fill-rect-ver ~dev/screen.y ~rect.y2 LTH2 JMP2? POP2 RTS @@ -97,13 +97,13 @@ RTS ( incr ) ~dev/screen.x #0001 ADD2 =dev/screen.x ( draw ) ~rect.y1 =dev/screen.y ~color =dev/screen.color ( draw ) ~rect.y2 =dev/screen.y ~color =dev/screen.color - ,line-rect-hor ~dev/screen.x ~rect.x2 LTH2 JMP? POP2 + ,line-rect-hor ~dev/screen.x ~rect.x2 LTH2 JMP2? POP2 ~rect.y1 =dev/screen.y @line-rect-ver ( draw ) ~rect.x1 =dev/screen.x ~color =dev/screen.color ( draw ) ~rect.x2 =dev/screen.x ~color =dev/screen.color ( incr ) ~dev/screen.y #0001 ADD2 =dev/screen.y - ,line-rect-ver ~dev/screen.y ~rect.y2 #0001 ADD2 LTH2 JMP? POP2 + ,line-rect-ver ~dev/screen.y ~rect.y2 #0001 ADD2 LTH2 JMP2? POP2 RTS @@ -115,7 +115,7 @@ RTS ( draw ) DUP2 LDR #00 SWP #0008 MUL2 ,font ADD2 =dev/sprite.addr ~textarea.color =dev/sprite.color ( detect linebreaks ) - DUP2 LDR #0d NEQ ,no-return ROT JMP? POP2 + DUP2 LDR #0d NEQ ,no-return ROT JMP2? POP2 ~textarea.x1 =dev/sprite.x ( incr ) ~dev/sprite.y #0008 ADD2 =dev/sprite.y ( decr ) ~dev/sprite.x #0008 SUB2 =dev/sprite.x @@ -124,27 +124,27 @@ RTS ( incr ) #0001 ADD2 ( incr ) ~dev/sprite.x #0008 ADD2 =dev/sprite.x - DUP2 LDR #00 NEQ ,draw-textarea-left-loop ROT JMP? POP2 + DUP2 LDR #00 NEQ ,draw-textarea-left-loop ROT JMP2? POP2 POP2 RTS @do-textarea - ( ,blink-cursor JSR ) - ,do-textarea-end ~dev/key #00 EQU JMP? POP2 ( skip on no key ) + ( ,blink-cursor JSR2 ) + ,do-textarea-end ~dev/key #00 EQU JMP2? POP2 ( skip on no key ) ( backspace ) - ,any-key ~dev/key #08 NEQ JMP? POP2 - ,input-end ~textarea.cursor #00 EQU JMP? POP2 + ,any-key ~dev/key #08 NEQ JMP2? POP2 + ,input-end ~textarea.cursor #00 EQU JMP2? POP2 ( decr ) ~textarea.cursor #01 SUB =textarea.cursor #00 ~textarea.addr #00 ~textarea.cursor ADD2 STR - ,input-end JMP + ,input-end JMP2 @any-key ~dev/key ~textarea.addr #00 ~textarea.cursor ADD2 STR ( incr ) ~textarea.cursor #01 ADD =textarea.cursor @input-end #00 =dev/key ( release key ) - ,redraw JSR + ,redraw JSR2 ( add cursor ) ,cursor =dev/sprite.addr #06 =dev/sprite.color @@ -154,10 +154,10 @@ RTS @do-cursor - ,skip-drag ~dev/mouse.state #01 NEQ JMP? POP2 + ,skip-drag ~dev/mouse.state #01 NEQ JMP2? POP2 ~mouse.x =textarea.x1 ~mouse.y =textarea.y1 - ,redraw-window JSR - ,redraw JSR + ,redraw-window JSR2 + ,redraw JSR2 @skip-drag ~mouse.x ~dev/mouse.x NEQU2 @@ -166,10 +166,10 @@ RTS #0000 EQU2 RTS? ( Return if unchanged ) ( clear last cursor ) - #10 ,clear_icn ~mouse.x ~mouse.y ,draw-sprite JSR + #10 ,clear_icn ~mouse.x ~mouse.y ,draw-sprite JSR2 ( record mouse positions ) ~dev/mouse.x =mouse.x ~dev/mouse.y =mouse.y - #12 ,cursor_icn ~mouse.x ~mouse.y ,draw-sprite JSR + #12 ,cursor_icn ~mouse.x ~mouse.y ,draw-sprite JSR2 RTS diff --git a/projects/examples/dev.mouse.usm b/projects/examples/dev.mouse.usm @@ -20,43 +20,43 @@ ~dev/screen.height #0038 SUB2 =cat.y #01 =color ( draw polycat ) - ,draw-polycat JSR + ,draw-polycat JSR2 BRK |0200 @FRAME - ,draw-cursor JSR + ,draw-cursor JSR2 ( reset timer -> move cat tail ) - ,no-click ~dev/mouse.state #00 EQU JMP? POP2 + ,no-click ~dev/mouse.state #00 EQU JMP2? POP2 #50 =timer @no-click ( detect click ) - ,no-click12 ~dev/mouse.state #11 NEQ JMP? POP2 - #0058 #0040 #01 ,mouse12_text ,draw-label JSR - #10 ,cursor_icn ~mouse.x ~mouse.y ,draw-sprite JSR - ~color ,mouse12_icn #0048 #0040 ,draw-sprite JSR - ,end-click JMP + ,no-click12 ~dev/mouse.state #11 NEQ JMP2? POP2 + #0058 #0040 #01 ,mouse12_text ,draw-label JSR2 + #10 ,cursor_icn ~mouse.x ~mouse.y ,draw-sprite JSR2 + ~color ,mouse12_icn #0048 #0040 ,draw-sprite JSR2 + ,end-click JMP2 @no-click12 - ,no-click1 ~dev/mouse.state #01 NEQ JMP? POP2 - #0058 #0040 #01 ,mouse1_text ,draw-label JSR - #12 ,cursor_icn ~mouse.x ~mouse.y ,draw-sprite JSR - ~color ,mouse1_icn #0048 #0040 ,draw-sprite JSR - ,end-click JMP + ,no-click1 ~dev/mouse.state #01 NEQ JMP2? POP2 + #0058 #0040 #01 ,mouse1_text ,draw-label JSR2 + #12 ,cursor_icn ~mouse.x ~mouse.y ,draw-sprite JSR2 + ~color ,mouse1_icn #0048 #0040 ,draw-sprite JSR2 + ,end-click JMP2 @no-click1 - ,no-click2 ~dev/mouse.state #10 NEQ JMP? POP2 - #0058 #0040 #01 ,mouse2_text ,draw-label JSR - #13 ,cursor_icn ~mouse.x ~mouse.y ,draw-sprite JSR - ~color ,mouse2_icn #0048 #0040 ,draw-sprite JSR - ,end-click JMP + ,no-click2 ~dev/mouse.state #10 NEQ JMP2? POP2 + #0058 #0040 #01 ,mouse2_text ,draw-label JSR2 + #13 ,cursor_icn ~mouse.x ~mouse.y ,draw-sprite JSR2 + ~color ,mouse2_icn #0048 #0040 ,draw-sprite JSR2 + ,end-click JMP2 @no-click2 ( default ) - #0058 #0040 #01 ,mouse0_text ,draw-label JSR - ~color ,mouse0_icn #0048 #0040 ,draw-sprite JSR + #0058 #0040 #01 ,mouse0_text ,draw-label JSR2 + ~color ,mouse0_icn #0048 #0040 ,draw-sprite JSR2 @end-click ( animate ) - ,animate-polycat JSR + ,animate-polycat JSR2 ( update last pos ) ~timer #01 ADD =timer @@ -70,57 +70,57 @@ BRK #0000 EQU2 RTS? ( Return if unchanged ) ( clear last cursor ) - #10 ,clear_icn ~mouse.x ~mouse.y ,draw-sprite JSR + #10 ,clear_icn ~mouse.x ~mouse.y ,draw-sprite JSR2 ( record mouse positions ) ~dev/mouse.x =mouse.x ~dev/mouse.y =mouse.y - #11 ,cursor_icn ~mouse.x ~mouse.y ,draw-sprite JSR + #11 ,cursor_icn ~mouse.x ~mouse.y ,draw-sprite JSR2 RTS @draw-polycat ( ears ) - ,polycat ~cat.x ~cat.y ,draw-sprite-chr JSR - ,polycat #0010 ADD2 ~cat.x #0008 ADD2 ~cat.y ,draw-sprite-chr JSR + ,polycat ~cat.x ~cat.y ,draw-sprite-chr JSR2 + ,polycat #0010 ADD2 ~cat.x #0008 ADD2 ~cat.y ,draw-sprite-chr JSR2 ( eye ) - ,polycat #0020 ADD2 ~cat.x ~cat.y #0008 ADD2 ,draw-sprite-chr JSR - ,polycat #0030 ADD2 ~cat.x #0008 ADD2 ~cat.y #0008 ADD2 ,draw-sprite-chr JSR + ,polycat #0020 ADD2 ~cat.x ~cat.y #0008 ADD2 ,draw-sprite-chr JSR2 + ,polycat #0030 ADD2 ~cat.x #0008 ADD2 ~cat.y #0008 ADD2 ,draw-sprite-chr JSR2 ( body ) - ,polycat #00a0 ADD2 ~cat.x ~cat.y #0010 ADD2 ,draw-sprite-chr JSR - ,polycat #00b0 ADD2 ~cat.x #0008 ADD2 ~cat.y #0010 ADD2 ,draw-sprite-chr JSR + ,polycat #00a0 ADD2 ~cat.x ~cat.y #0010 ADD2 ,draw-sprite-chr JSR2 + ,polycat #00b0 ADD2 ~cat.x #0008 ADD2 ~cat.y #0010 ADD2 ,draw-sprite-chr JSR2 RTS @animate-polycat ( tail ) - ~timer #50 NEQ ,animate-polycat-tail-next0 ROT JMP? POP2 - ,polycat #00c0 ADD2 ~cat.x #0008 ADD2 ~cat.y #0010 ADD2 ,draw-sprite-chr JSR + ~timer #50 NEQ ,animate-polycat-tail-next0 ROT JMP2? POP2 + ,polycat #00c0 ADD2 ~cat.x #0008 ADD2 ~cat.y #0010 ADD2 ,draw-sprite-chr JSR2 @animate-polycat-tail-next0 - ~timer #58 NEQ ,animate-polycat-tail-next1 ROT JMP? POP2 - ,polycat #00d0 ADD2 ~cat.x #0008 ADD2 ~cat.y #0010 ADD2 ,draw-sprite-chr JSR + ~timer #58 NEQ ,animate-polycat-tail-next1 ROT JMP2? POP2 + ,polycat #00d0 ADD2 ~cat.x #0008 ADD2 ~cat.y #0010 ADD2 ,draw-sprite-chr JSR2 @animate-polycat-tail-next1 - ~timer #60 NEQ ,animate-polycat-tail-next2 ROT JMP? POP2 - ,polycat #00b0 ADD2 ~cat.x #0008 ADD2 ~cat.y #0010 ADD2 ,draw-sprite-chr JSR + ~timer #60 NEQ ,animate-polycat-tail-next2 ROT JMP2? POP2 + ,polycat #00b0 ADD2 ~cat.x #0008 ADD2 ~cat.y #0010 ADD2 ,draw-sprite-chr JSR2 @animate-polycat-tail-next2 ( look-at ) - ~mouse.x ~cat.x #0008 ADD2 GTH2 ,animate-polycat-right ROT JMP? POP2 - ~mouse.y ~cat.y #0008 ADD2 GTH2 ,animate-polycat-left-down ROT JMP? POP2 - ,polycat #0040 ADD2 ~cat.x ~cat.y #0008 ADD2 ,draw-sprite-chr JSR - ,polycat #0050 ADD2 ~cat.x #0008 ADD2 ~cat.y #0008 ADD2 ,draw-sprite-chr JSR + ~mouse.x ~cat.x #0008 ADD2 GTH2 ,animate-polycat-right ROT JMP2? POP2 + ~mouse.y ~cat.y #0008 ADD2 GTH2 ,animate-polycat-left-down ROT JMP2? POP2 + ,polycat #0040 ADD2 ~cat.x ~cat.y #0008 ADD2 ,draw-sprite-chr JSR2 + ,polycat #0050 ADD2 ~cat.x #0008 ADD2 ~cat.y #0008 ADD2 ,draw-sprite-chr JSR2 RTS @animate-polycat-left-down - ,polycat #0020 ADD2 ~cat.x ~cat.y #0008 ADD2 ,draw-sprite-chr JSR - ,polycat #0030 ADD2 ~cat.x #0008 ADD2 ~cat.y #0008 ADD2 ,draw-sprite-chr JSR + ,polycat #0020 ADD2 ~cat.x ~cat.y #0008 ADD2 ,draw-sprite-chr JSR2 + ,polycat #0030 ADD2 ~cat.x #0008 ADD2 ~cat.y #0008 ADD2 ,draw-sprite-chr JSR2 RTS @animate-polycat-right - ~mouse.y ~cat.y #0008 ADD2 GTH2 ,animate-polycat-right-down ROT JMP? POP2 - ,polycat #0060 ADD2 ~cat.x ~cat.y #0008 ADD2 ,draw-sprite-chr JSR - ,polycat #0070 ADD2 ~cat.x #0008 ADD2 ~cat.y #0008 ADD2 ,draw-sprite-chr JSR + ~mouse.y ~cat.y #0008 ADD2 GTH2 ,animate-polycat-right-down ROT JMP2? POP2 + ,polycat #0060 ADD2 ~cat.x ~cat.y #0008 ADD2 ,draw-sprite-chr JSR2 + ,polycat #0070 ADD2 ~cat.x #0008 ADD2 ~cat.y #0008 ADD2 ,draw-sprite-chr JSR2 RTS @animate-polycat-right-down - ,polycat #0080 ADD2 ~cat.x ~cat.y #0008 ADD2 ,draw-sprite-chr JSR - ,polycat #0090 ADD2 ~cat.x #0008 ADD2 ~cat.y #0008 ADD2 ,draw-sprite-chr JSR + ,polycat #0080 ADD2 ~cat.x ~cat.y #0008 ADD2 ,draw-sprite-chr JSR2 + ,polycat #0090 ADD2 ~cat.x #0008 ADD2 ~cat.y #0008 ADD2 ,draw-sprite-chr JSR2 RTS RTS @@ -133,7 +133,7 @@ RTS ( draw ) DUP2 LDR #00 SWP #0008 MUL2 ,font ADD2 =dev/sprite.addr ~label.color =dev/sprite.color ( incr ) #0001 ADD2 ( incr ) ~dev/sprite.x #0008 ADD2 =dev/sprite.x - DUP2 #0001 ADD2 LDR #00 NEQ ,draw-label-loop ROT JMP? POP2 + DUP2 #0001 ADD2 LDR #00 NEQ ,draw-label-loop ROT JMP2? POP2 POP2 RTS diff --git a/projects/examples/dev.screen.usm b/projects/examples/dev.screen.usm @@ -18,7 +18,7 @@ @draw-hor #03 ~i =dev/screen.x =dev/screen.color ~i #0002 ADD2 =i ( increment ) - ~i ~dev/screen.width LTH2 ,draw-hor ROT JMP? POP2 + ~i ~dev/screen.width LTH2 ,draw-hor ROT JMP2? POP2 ( draw ver line ) #0000 =i @@ -26,13 +26,13 @@ @draw-ver #03 ~i =dev/screen.y =dev/screen.color ~i #0002 ADD2 =i ( increment ) - ~i ~dev/screen.width LTH2 ,draw-ver ROT JMP? POP2 + ~i ~dev/screen.width LTH2 ,draw-ver ROT JMP2? POP2 ( draw blending modes ) @draw-blends - ~j ,icon #00 ~j #0008 MUL2 ~dev/screen.height #0010 SUB2 ,draw-sprite JSR + ~j ,icon #00 ~j #0008 MUL2 ~dev/screen.height #0010 SUB2 ,draw-sprite JSR2 ~j #01 ADD =j - ~j #10 LTH ,draw-blends ROT JMP? POP2 + ~j #10 LTH ,draw-blends ROT JMP2? POP2 ( draw pixel in the middle ) #01 ~centerx ~centery =dev/screen.y =dev/screen.x =dev/screen.color @@ -51,16 +51,16 @@ BRK |c000 @FRAME ( update colors every 40 frames ) - ~timer #40 NEQ ,skip1 ROT JMP? POP2 + ~timer #40 NEQ ,skip1 ROT JMP2? POP2 #0fac =fffa #f0bb =fffc #f053 =fff8 @skip1 - ~timer #80 NEQ ,skip2 ROT JMP? POP2 + ~timer #80 NEQ ,skip2 ROT JMP2? POP2 #00fc =fffc #f0bb =fff8 #f053 =fffa @skip2 - ~timer #c0 NEQ ,skip3 ROT JMP? POP2 + ~timer #c0 NEQ ,skip3 ROT JMP2? POP2 #000f =fff8 #0f0f =fffa #ff00 =fffc @skip3 - ~timer #00 NEQ ,skip4 ROT JMP? POP2 + ~timer #00 NEQ ,skip4 ROT JMP2? POP2 #f0ac =fff8 #f0bb =fffa #f053 =fffc @skip4 ~timer #01 ADD =timer diff --git a/projects/examples/gui.hover.usm b/projects/examples/gui.hover.usm @@ -28,26 +28,26 @@ BRK ( matrix comparison ) ~dev/mouse.x ~r1.x1 GTH2 ~dev/mouse.x ~r1.x2 LTH2 #0101 EQU2 ~dev/mouse.y ~r1.y1 GTH2 ~dev/mouse.y ~r1.y2 LTH2 #0101 EQU2 - #0101 NEQ2 ,draw1 ROT JMP? POP2 #02 =color ,hand_icn =cursor - @draw1 ~r1.x1 ~r1.y1 ~r1.x2 ~r1.y2 ~color ,line-rect JSR + #0101 NEQ2 ,draw1 ROT JMP2? POP2 #02 =color ,hand_icn =cursor + @draw1 ~r1.x1 ~r1.y1 ~r1.x2 ~r1.y2 ~color ,line-rect JSR2 #01 =color ( 2-step comparison ) - ,draw2 ~dev/mouse.x ~r2.x1 GTH2 ~dev/mouse.x ~r2.x2 LTH2 #0101 NEQ2 JMP? POP2 - ,draw2 ~dev/mouse.y ~r2.y1 GTH2 ~dev/mouse.y ~r2.y2 LTH2 #0101 NEQ2 JMP? POP2 + ,draw2 ~dev/mouse.x ~r2.x1 GTH2 ~dev/mouse.x ~r2.x2 LTH2 #0101 NEQ2 JMP2? POP2 + ,draw2 ~dev/mouse.y ~r2.y1 GTH2 ~dev/mouse.y ~r2.y2 LTH2 #0101 NEQ2 JMP2? POP2 #03 =color ,hand_icn =cursor - @draw2 ~r2.x1 ~r2.y1 ~r2.x2 ~r2.y2 ~color ,line-rect JSR + @draw2 ~r2.x1 ~r2.y1 ~r2.x2 ~r2.y2 ~color ,line-rect JSR2 #01 =color ( 4-step comparison ) - ,draw3 ~dev/mouse.x ~r3.x1 LTH2 JMP? POP2 - ,draw3 ~dev/mouse.x ~r3.x2 GTH2 JMP? POP2 - ,draw3 ~dev/mouse.y ~r3.y1 LTH2 JMP? POP2 - ,draw3 ~dev/mouse.y ~r3.y2 GTH2 JMP? POP2 + ,draw3 ~dev/mouse.x ~r3.x1 LTH2 JMP2? POP2 + ,draw3 ~dev/mouse.x ~r3.x2 GTH2 JMP2? POP2 + ,draw3 ~dev/mouse.y ~r3.y1 LTH2 JMP2? POP2 + ,draw3 ~dev/mouse.y ~r3.y2 GTH2 JMP2? POP2 #02 =color ,hand_icn =cursor - @draw3 ~r3.x1 ~r3.y1 ~r3.x2 ~r3.y2 ~color ,line-rect JSR + @draw3 ~r3.x1 ~r3.y1 ~r3.x2 ~r3.y2 ~color ,line-rect JSR2 - ,draw-cursor JSR + ,draw-cursor JSR2 BRK @@ -59,10 +59,10 @@ BRK #0000 EQU2 RTS? ( Return if unchanged ) ( clear last cursor ) - #10 ,clear_icn ~mouse.x ~mouse.y ,draw-sprite JSR + #10 ,clear_icn ~mouse.x ~mouse.y ,draw-sprite JSR2 ( record mouse positions ) ~dev/mouse.x =mouse.x ~dev/mouse.y =mouse.y - #11 ~cursor ~mouse.x ~mouse.y ,draw-sprite JSR + #11 ~cursor ~mouse.x ~mouse.y ,draw-sprite JSR2 RTS @@ -73,13 +73,13 @@ RTS ( incr ) ~dev/screen.x #0001 ADD2 =dev/screen.x ( draw ) ~rect.y1 =dev/screen.y ~color =dev/screen.color ( draw ) ~rect.y2 =dev/screen.y ~color =dev/screen.color - ,line-rect-hor ~dev/screen.x ~rect.x2 LTH2 JMP? POP2 + ,line-rect-hor ~dev/screen.x ~rect.x2 LTH2 JMP2? POP2 ~rect.y1 =dev/screen.y @line-rect-ver ( draw ) ~rect.x1 =dev/screen.x ~color =dev/screen.color ( draw ) ~rect.x2 =dev/screen.x ~color =dev/screen.color ( incr ) ~dev/screen.y #0001 ADD2 =dev/screen.y - ,line-rect-ver ~dev/screen.y ~rect.y2 #0001 ADD2 LTH2 JMP? POP2 + ,line-rect-ver ~dev/screen.y ~rect.y2 #0001 ADD2 LTH2 JMP2? POP2 RTS diff --git a/projects/examples/gui.label.usm b/projects/examples/gui.label.usm @@ -24,13 +24,13 @@ @draw-ver #03 ~i =dev/screen.y =dev/screen.color ~i #0002 ADD2 =i ( increment ) - ~i ~dev/screen.width LTH2 ,draw-ver ROT JMP? POP2 + ~i ~dev/screen.width LTH2 ,draw-ver ROT JMP2? POP2 - ~center.x ~center.y #0010 SUB2 #0c ,text1 ,draw-label-left JSR - ~center.x ~center.y #0c ,text2 ,draw-label-middle JSR - ~center.x ~center.y #0010 ADD2 #0c ,text3 ,draw-label-right JSR - ~center.x ~center.y #0020 ADD2 #0c ,text4 ,draw-label-middle JSR - ~center.x ~center.y #0030 ADD2 #0c ,text5 ,draw-label-middle JSR + ~center.x ~center.y #0010 SUB2 #0c ,text1 ,draw-label-left JSR2 + ~center.x ~center.y #0c ,text2 ,draw-label-middle JSR2 + ~center.x ~center.y #0010 ADD2 #0c ,text3 ,draw-label-right JSR2 + ~center.x ~center.y #0020 ADD2 #0c ,text4 ,draw-label-middle JSR2 + ~center.x ~center.y #0030 ADD2 #0c ,text5 ,draw-label-middle JSR2 BRK @@ -42,7 +42,7 @@ BRK ( draw ) DUP2 LDR #00 SWP #0008 MUL2 ,font ADD2 =dev/sprite.addr ~label.color =dev/sprite.color ( incr ) #0001 ADD2 ( incr ) ~dev/sprite.x #0008 ADD2 =dev/sprite.x - DUP2 #0001 ADD2 LDR #00 NEQ ,draw-label-left-loop ROT JMP? POP2 + DUP2 LDR #00 NEQ ,draw-label-left-loop ROT JMP2? POP2 POP2 RTS @@ -50,13 +50,13 @@ RTS @draw-label-middle ( x y color addr ) ( load ) =label.addr =label.color =dev/sprite.y - ( align ) ~label.addr ,get-text-length JSR #0008 MUL2 #0002 DIV2 SUB2 =dev/sprite.x + ( align ) ~label.addr ,get-text-length JSR2 #0008 MUL2 #0002 DIV2 SUB2 =dev/sprite.x ~label.addr @draw-label-middle-loop ( draw ) DUP2 LDR #00 SWP #0008 MUL2 ,font ADD2 =dev/sprite.addr ~label.color =dev/sprite.color ( incr ) #0001 ADD2 ( incr ) ~dev/sprite.x #0008 ADD2 =dev/sprite.x - DUP2 #0001 ADD2 LDR #00 NEQ ,draw-label-middle-loop ROT JMP? POP2 + DUP2 LDR #00 NEQ ,draw-label-middle-loop ROT JMP2? POP2 POP2 RTS @@ -64,13 +64,13 @@ RTS @draw-label-right ( x y color addr ) ( load ) =label.addr =label.color =dev/sprite.y - ( align ) ~label.addr ,get-text-length JSR #0008 MUL2 SUB2 =dev/sprite.x + ( align ) ~label.addr ,get-text-length JSR2 #0008 MUL2 SUB2 #0008 SUB2 =dev/sprite.x ~label.addr @draw-label-right-loop ( draw ) DUP2 LDR #00 SWP #0008 MUL2 ,font ADD2 =dev/sprite.addr ~label.color =dev/sprite.color ( incr ) #0001 ADD2 ( incr ) ~dev/sprite.x #0008 ADD2 =dev/sprite.x - DUP2 #0001 ADD2 LDR #00 NEQ ,draw-label-right-loop ROT JMP? POP2 + DUP2 LDR #00 NEQ ,draw-label-right-loop ROT JMP2? POP2 POP2 RTS @@ -80,7 +80,7 @@ RTS #0000 ( counter ) @get-text-length-loop ( incr ) #0001 ADD2 OVR2 OVR2 ADD2 - LDR #00 NEQ ,get-text-length-loop ROT JMP? POP2 + LDR #00 NEQ ,get-text-length-loop ROT JMP2? POP2 SWP2 POP2 #0001 SUB2 RTS diff --git a/projects/examples/gui.picture.usm b/projects/examples/gui.picture.usm @@ -9,9 +9,9 @@ |0100 @RESET - #0000 #0000 ~dev/screen.width ~dev/screen.height #01 ,pict_large ,draw-picture JSR - #0008 #0010 #0080 #0080 #01 ,pict_medium ,draw-picture JSR - #00d0 #0090 #0020 #0020 #0a ,pict_small ,draw-picture JSR + #0000 #0000 #0100 #0100 #01 ,pict_large ,draw-picture JSR2 + #0098 #0060 #0080 #0080 #01 ,pict_medium ,draw-picture JSR2 + #0020 #0090 #0020 #0020 #0a ,pict_small ,draw-picture JSR2 BRK @@ -24,9 +24,9 @@ BRK ( draw ) ~pict.color =dev/sprite.color ( incr ) ~dev/sprite.x #0008 ADD2 =dev/sprite.x ( incr ) ~dev/sprite.addr #0008 ADD2 =dev/sprite.addr - ,draw-picture-hor ~dev/sprite.x ~pict.width ~pict.x ADD2 LTH2 JMP? POP2 + ,draw-picture-hor ~dev/sprite.x ~pict.width ~pict.x ADD2 LTH2 JMP2? POP2 ( incr ) ~dev/sprite.y #0008 ADD2 =dev/sprite.y - ,draw-picture-ver ~dev/sprite.y ~pict.height ~pict.y ADD2 LTH2 JMP? POP2 + ,draw-picture-ver ~dev/sprite.y ~pict.height ~pict.y ADD2 LTH2 JMP2? POP2 RTS diff --git a/projects/examples/gui.shapes.usm b/projects/examples/gui.shapes.usm @@ -15,22 +15,22 @@ |0100 @RESET - #0010 #0020 #0040 #0060 #01 ,fill-rect JSR - #0020 #0030 #0050 #0070 #02 ,fill-rect JSR - #0030 #0040 #0060 #0080 #03 ,fill-rect JSR - #0070 #0020 #00a0 #0060 #01 ,line-rect JSR - #0080 #0030 #00b0 #0070 #02 ,line-rect JSR - #0090 #0040 #00c0 #0080 #03 ,line-rect JSR - - #0000 #0080 #0020 #0020 #01 ,pict_small ,draw-picture JSR - #0010 #0088 #0020 #0020 #02 ,pict_small ,draw-picture JSR - #0020 #0090 #0020 #0020 #03 ,pict_small ,draw-picture JSR - #0030 #0098 #0020 #0020 #04 ,pict_small ,draw-picture JSR - - #0028 #0068 #01 ,text ,draw-label JSR - #0038 #0078 #02 ,text ,draw-label JSR - #0048 #0088 #03 ,text ,draw-label JSR - #0058 #0098 #04 ,text ,draw-label JSR + #0010 #0020 #0040 #0060 #01 ,fill-rect JSR2 + #0020 #0030 #0050 #0070 #02 ,fill-rect JSR2 + #0030 #0040 #0060 #0080 #03 ,fill-rect JSR2 + #0070 #0020 #00a0 #0060 #01 ,line-rect JSR2 + #0080 #0030 #00b0 #0070 #02 ,line-rect JSR2 + #0090 #0040 #00c0 #0080 #03 ,line-rect JSR2 + + #0000 #0080 #0020 #0020 #01 ,pict_small ,draw-picture JSR2 + #0010 #0088 #0020 #0020 #02 ,pict_small ,draw-picture JSR2 + #0020 #0090 #0020 #0020 #03 ,pict_small ,draw-picture JSR2 + #0030 #0098 #0020 #0020 #04 ,pict_small ,draw-picture JSR2 + + #0028 #0068 #01 ,text ,draw-label JSR2 + #0038 #0078 #02 ,text ,draw-label JSR2 + #0048 #0088 #03 ,text ,draw-label JSR2 + #0058 #0098 #04 ,text ,draw-label JSR2 BRK @@ -41,13 +41,13 @@ BRK ( incr ) ~dev/screen.x #0001 ADD2 =dev/screen.x ( draw ) ~rect.y1 =dev/screen.y ~color =dev/screen.color ( draw ) ~rect.y2 =dev/screen.y ~color =dev/screen.color - ,line-rect-hor ~dev/screen.x ~rect.x2 LTH2 JMP? POP2 + ,line-rect-hor ~dev/screen.x ~rect.x2 LTH2 JMP2? POP2 ~rect.y1 =dev/screen.y @line-rect-ver ( draw ) ~rect.x1 =dev/screen.x ~color =dev/screen.color ( draw ) ~rect.x2 =dev/screen.x ~color =dev/screen.color ( incr ) ~dev/screen.y #0001 ADD2 =dev/screen.y - ,line-rect-ver ~dev/screen.y ~rect.y2 #0001 ADD2 LTH2 JMP? POP2 + ,line-rect-ver ~dev/screen.y ~rect.y2 #0001 ADD2 LTH2 JMP2? POP2 RTS @@ -59,9 +59,9 @@ RTS @fill-rect-hor ( draw ) ~color =dev/screen.color ( incr ) ~dev/screen.x #0001 ADD2 =dev/screen.x - ,fill-rect-hor ~dev/screen.x ~rect.x2 LTH2 JMP? POP2 + ,fill-rect-hor ~dev/screen.x ~rect.x2 LTH2 JMP2? POP2 ( incr ) ~dev/screen.y #0001 ADD2 =dev/screen.y - ,fill-rect-ver ~dev/screen.y ~rect.y2 LTH2 JMP? POP2 + ,fill-rect-ver ~dev/screen.y ~rect.y2 LTH2 JMP2? POP2 RTS @@ -74,9 +74,9 @@ RTS ( draw ) ~pict.color =dev/sprite.color ( incr ) ~dev/sprite.x #0008 ADD2 =dev/sprite.x ( incr ) ~dev/sprite.addr #0008 ADD2 =dev/sprite.addr - ,draw-picture-hor ~dev/sprite.x ~pict.width ~pict.x ADD2 LTH2 JMP? POP2 + ,draw-picture-hor ~dev/sprite.x ~pict.width ~pict.x ADD2 LTH2 JMP2? POP2 ( incr ) ~dev/sprite.y #0008 ADD2 =dev/sprite.y - ,draw-picture-ver ~dev/sprite.y ~pict.height ~pict.y ADD2 LTH2 JMP? POP2 + ,draw-picture-ver ~dev/sprite.y ~pict.height ~pict.y ADD2 LTH2 JMP2? POP2 RTS @@ -87,7 +87,7 @@ RTS ( draw ) DUP2 LDR #00 SWP #0008 MUL2 ,font ADD2 =dev/sprite.addr ~label.color =dev/sprite.color ( incr ) #0001 ADD2 ( incr ) ~dev/sprite.x #0008 ADD2 =dev/sprite.x - DUP2 LDR #00 NEQ ,draw-label-loop ROT JMP? POP2 + DUP2 LDR #00 NEQ ,draw-label-loop ROT JMP2? POP2 POP2 RTS diff --git a/projects/examples/win.editor.usm b/projects/examples/win.editor.usm @@ -31,51 +31,51 @@ ( starting addr ) ,pattern =editor.addr - ,draw-window JSR - ,draw-editor JSR + ,draw-window JSR2 + ,draw-editor JSR2 BRK |0200 @FRAME - ,no-ctrl ~dev/ctrl.buttons #00 EQU JMP? POP2 + ,no-ctrl ~dev/ctrl.buttons #00 EQU JMP2? POP2 - ,no-ctrl-up ~dev/ctrl.buttons #10 EQU JMP? POP2 + ,no-ctrl-up ~dev/ctrl.buttons #10 EQU JMP2? POP2 ~editor.addr #0001 ADD2 =editor.addr - ,draw-window JSR - ,draw-editor JSR + ,draw-window JSR2 + ,draw-editor JSR2 @no-ctrl-up - ,no-ctrl-down ~dev/ctrl.buttons #20 EQU JMP? POP2 + ,no-ctrl-down ~dev/ctrl.buttons #20 EQU JMP2? POP2 ~editor.addr #0001 SUB2 =editor.addr - ,draw-window JSR - ,draw-editor JSR + ,draw-window JSR2 + ,draw-editor JSR2 @no-ctrl-down @no-ctrl - ,no-click ~dev/mouse.state #00 EQU JMP? POP2 + ,no-click ~dev/mouse.state #00 EQU JMP2? POP2 ( load ) ~editor.addr ~dev/mouse.y ~editor.y1 SUB2 #0008 DIV2 ADD2 LDR ( mask ) #01 #07 ~dev/mouse.x ~editor.x1 SUB2 #0008 DIV2 SWP POP SUB ROL XOR ( save ) ~editor.addr ~dev/mouse.y ~editor.y1 SUB2 #0008 DIV2 ADD2 STR - ,draw-window JSR - ,draw-editor JSR + ,draw-window JSR2 + ,draw-editor JSR2 @no-click - ,draw-cursor JSR + ,draw-cursor JSR2 BRK @draw-window - ( desktop ) #0000 #0000 ~dev/screen.width ~dev/screen.height #03 ~editor.addr ,tile-rect JSR - ( outline ) ~window.x1 #0001 SUB2 ~window.y1 #0001 SUB2 ~window.x2 ~window.y2 #01 ,line-rect JSR - ( background ) ~window.x1 ~window.y1 ~window.x2 ~window.y2 #02 ,fill-rect JSR - ( label ) ~window.x1 ~window.y1 #04 ,window_name ,draw-label-left JSR + ( desktop ) #0000 #0000 ~dev/screen.width ~dev/screen.height #03 ~editor.addr ,tile-rect JSR2 + ( outline ) ~window.x1 #0001 SUB2 ~window.y1 #0001 SUB2 ~window.x2 ~window.y2 #01 ,line-rect JSR2 + ( background ) ~window.x1 ~window.y1 ~window.x2 ~window.y2 #02 ,fill-rect JSR2 + ( label ) ~window.x1 ~window.y1 #04 ,window_name ,draw-label-left JSR2 RTS @@ -99,10 +99,10 @@ RTS ( draw ) #08 =dev/sprite.color ( incr ) ~dev/sprite.x #0008 ADD2 =dev/sprite.x ( incr ) ~pixel.x #01 ADD =pixel.x - ,redraw-hor ~dev/sprite.x ~editor.x1 #0040 ADD2 LTH2 JMP? POP2 + ,redraw-hor ~dev/sprite.x ~editor.x1 #0040 ADD2 LTH2 JMP2? POP2 ( incr ) ~dev/sprite.y #0008 ADD2 =dev/sprite.y ( incr ) ~pixel.y #01 ADD =pixel.y - ,redraw-ver ~dev/sprite.y ~editor.y1 #0040 ADD2 LTH2 JMP? POP2 + ,redraw-ver ~dev/sprite.y ~editor.y1 #0040 ADD2 LTH2 JMP2? POP2 ~editor.addr =dev/sprite.addr ~window.y1 =dev/sprite.y @@ -110,14 +110,14 @@ RTS ( draw ) #01 =dev/sprite.color ( TODO: Make a loop.. ) - ~window.x1 #0058 ADD2 ~window.y1 #0010 ADD2 #08 ~editor.addr ,draw-byte JSR - ~window.x1 #0058 ADD2 ~window.y1 #0018 ADD2 #08 ~editor.addr #0001 ADD2 ,draw-byte JSR - ~window.x1 #0058 ADD2 ~window.y1 #0020 ADD2 #08 ~editor.addr #0002 ADD2 ,draw-byte JSR - ~window.x1 #0058 ADD2 ~window.y1 #0028 ADD2 #08 ~editor.addr #0003 ADD2 ,draw-byte JSR - ~window.x1 #0058 ADD2 ~window.y1 #0030 ADD2 #08 ~editor.addr #0004 ADD2 ,draw-byte JSR - ~window.x1 #0058 ADD2 ~window.y1 #0038 ADD2 #08 ~editor.addr #0005 ADD2 ,draw-byte JSR - ~window.x1 #0058 ADD2 ~window.y1 #0040 ADD2 #08 ~editor.addr #0006 ADD2 ,draw-byte JSR - ~window.x1 #0058 ADD2 ~window.y1 #0048 ADD2 #08 ~editor.addr #0007 ADD2 ,draw-byte JSR + ~window.x1 #0058 ADD2 ~window.y1 #0010 ADD2 #08 ~editor.addr ,draw-byte JSR2 + ~window.x1 #0058 ADD2 ~window.y1 #0018 ADD2 #08 ~editor.addr #0001 ADD2 ,draw-byte JSR2 + ~window.x1 #0058 ADD2 ~window.y1 #0020 ADD2 #08 ~editor.addr #0002 ADD2 ,draw-byte JSR2 + ~window.x1 #0058 ADD2 ~window.y1 #0028 ADD2 #08 ~editor.addr #0003 ADD2 ,draw-byte JSR2 + ~window.x1 #0058 ADD2 ~window.y1 #0030 ADD2 #08 ~editor.addr #0004 ADD2 ,draw-byte JSR2 + ~window.x1 #0058 ADD2 ~window.y1 #0038 ADD2 #08 ~editor.addr #0005 ADD2 ,draw-byte JSR2 + ~window.x1 #0058 ADD2 ~window.y1 #0040 ADD2 #08 ~editor.addr #0006 ADD2 ,draw-byte JSR2 + ~window.x1 #0058 ADD2 ~window.y1 #0048 ADD2 #08 ~editor.addr #0007 ADD2 ,draw-byte JSR2 RTS @@ -129,7 +129,7 @@ RTS ( draw ) DUP2 LDR #00 SWP #0008 MUL2 ,font ADD2 =dev/sprite.addr ~label.color =dev/sprite.color ( incr ) #0001 ADD2 ( incr ) ~dev/sprite.x #0008 ADD2 =dev/sprite.x - DUP2 #0001 ADD2 LDR #00 NEQ ,draw-label-left-loop ROT JMP? POP2 + DUP2 #0001 ADD2 LDR #00 NEQ ,draw-label-left-loop ROT JMP2? POP2 POP2 RTS @@ -151,9 +151,9 @@ RTS @fill-rect-hor ( draw ) ~color =dev/screen.color ( incr ) ~dev/screen.x #0001 ADD2 =dev/screen.x - ,fill-rect-hor ~dev/screen.x ~rect.x2 LTH2 JMP? POP2 + ,fill-rect-hor ~dev/screen.x ~rect.x2 LTH2 JMP2? POP2 ( incr ) ~dev/screen.y #0001 ADD2 =dev/screen.y - ,fill-rect-ver ~dev/screen.y ~rect.y2 LTH2 JMP? POP2 + ,fill-rect-ver ~dev/screen.y ~rect.y2 LTH2 JMP2? POP2 RTS @@ -164,13 +164,13 @@ RTS ( incr ) ~dev/screen.x #0001 ADD2 =dev/screen.x ( draw ) ~rect.y1 =dev/screen.y ~color =dev/screen.color ( draw ) ~rect.y2 =dev/screen.y ~color =dev/screen.color - ,line-rect-hor ~dev/screen.x ~rect.x2 LTH2 JMP? POP2 + ,line-rect-hor ~dev/screen.x ~rect.x2 LTH2 JMP2? POP2 ~rect.y1 =dev/screen.y @line-rect-ver ( draw ) ~rect.x1 =dev/screen.x ~color =dev/screen.color ( draw ) ~rect.x2 =dev/screen.x ~color =dev/screen.color ( incr ) ~dev/screen.y #0001 ADD2 =dev/screen.y - ,line-rect-ver ~dev/screen.y ~rect.y2 #0001 ADD2 LTH2 JMP? POP2 + ,line-rect-ver ~dev/screen.y ~rect.y2 #0001 ADD2 LTH2 JMP2? POP2 RTS @@ -183,9 +183,9 @@ RTS @tile-rect-hor ( draw ) ~color =dev/sprite.color ( incr ) ~dev/sprite.x #0008 ADD2 =dev/sprite.x - ,tile-rect-hor ~dev/sprite.x ~rect.x2 LTH2 JMP? POP2 + ,tile-rect-hor ~dev/sprite.x ~rect.x2 LTH2 JMP2? POP2 ( incr ) ~dev/sprite.y #0008 ADD2 =dev/sprite.y - ,tile-rect-ver ~dev/sprite.y ~rect.y2 LTH2 JMP? POP2 + ,tile-rect-ver ~dev/sprite.y ~rect.y2 LTH2 JMP2? POP2 RTS @@ -197,10 +197,10 @@ RTS #0000 EQU2 RTS? ( Return if unchanged ) ( clear last cursor ) - #10 ,clear_icn ~mouse.x ~mouse.y ,draw-sprite JSR + #10 ,clear_icn ~mouse.x ~mouse.y ,draw-sprite JSR2 ( record mouse positions ) ~dev/mouse.x =mouse.x ~dev/mouse.y =mouse.y - #13 ,cursor_icn ~mouse.x ~mouse.y ,draw-sprite JSR + #13 ,cursor_icn ~mouse.x ~mouse.y ,draw-sprite JSR2 RTS diff --git a/projects/software/left.usm b/projects/software/left.usm @@ -2,17 +2,16 @@ app/left : text editor TODO - - Follow cursor when moving out of the screen + - Copy/Cut/Paste - Save/Load - - Real scrolling distance - Double-click select word - Right-click find next instance of selection - - Copy/Cut/Paste - - x scroll - - Don't scroll past oef - - Don't draw past eof - Draw tab characters - - Blink cursor + - Scrollbar + - Don't scroll past oef + - Hor scroll + - Follow cursor when moving out of the screen + - Real scrolling distance ) &Console { pad 8 stdio 1 } @@ -43,13 +42,13 @@ |0100 @RESET ( load file ) - ,filepath ,load-file JSR + ,filepath ,load-file JSR2 ( place textarea ) #0018 =textarea.x1 ~dev/screen.height #0008 SUB2 =textarea.y2 - ,select JSR - ,redraw JSR + ,select JSR2 + ,redraw JSR2 BRK @@ -57,63 +56,63 @@ BRK ( ctrl ) - ,ctrl-end ~dev/ctrl #00 EQU ~lock #00 NEQ #0000 NEQ2 JMP? POP2 + ,ctrl-end ~dev/ctrl #00 EQU ~lock #00 NEQ #0000 NEQ2 JMP2? POP2 ( lock ) #04 =lock - ,no-ctrl-up ~dev/ctrl #10 NEQ JMP? POP2 - ( clamp ) ,no-ctrl-up ~position.y #0000 EQU2 JMP? POP2 - ,find-lineoffset JSR =position.x + ,no-ctrl-up ~dev/ctrl #10 NEQ JMP2? POP2 + ( clamp ) ,no-ctrl-up ~position.y #0000 EQU2 JMP2? POP2 + ,find-lineoffset JSR2 =position.x ~position.y #0001 SUB2 =position.y - ,find-selection JSR DUP2 =selection.from #0001 ADD2 =selection.to - ,clamp-selection JSR ,redraw JSR ,ctrl-end JMP + ,find-selection JSR2 DUP2 =selection.from #0001 ADD2 =selection.to + ,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 @no-ctrl-up - ,no-ctrl-down ~dev/ctrl #20 NEQ JMP? POP2 - ,find-lineoffset JSR =position.x ~position.y #0001 ADD2 =position.y - ,find-selection JSR DUP2 =selection.from #0001 ADD2 =selection.to - ,clamp-selection JSR ,redraw JSR ,ctrl-end JMP + ,no-ctrl-down ~dev/ctrl #20 NEQ JMP2? POP2 + ,find-lineoffset JSR2 =position.x ~position.y #0001 ADD2 =position.y + ,find-selection JSR2 DUP2 =selection.from #0001 ADD2 =selection.to + ,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 @no-ctrl-down - ,no-ctrl-left ~dev/ctrl #40 NEQ JMP? POP2 - ( clamp ) ,no-ctrl-left ~selection.from ,document.body EQU2 JMP? POP2 + ,no-ctrl-left ~dev/ctrl #40 NEQ JMP2? POP2 + ( clamp ) ,no-ctrl-left ~selection.from ,document.body EQU2 JMP2? POP2 ~selection.from #0001 SUB2 DUP2 =selection.from #0001 ADD2 =selection.to - ,clamp-selection JSR ,redraw JSR ,ctrl-end JMP + ,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 @no-ctrl-left - ,no-ctrl-right ~dev/ctrl #80 NEQ JMP? POP2 + ,no-ctrl-right ~dev/ctrl #80 NEQ JMP2? POP2 ~selection.from #0001 ADD2 DUP2 =selection.from #0001 ADD2 =selection.to - ,clamp-selection JSR ,redraw JSR ,ctrl-end JMP + ,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 @no-ctrl-right ( alt ) - ,no-alt ~dev/ctrl #0f AND #02 NEQ JMP? POP2 - ,no-aup ~dev/ctrl #04 ROR #01 NEQ JMP? POP2 - ,find-wordstart JSR =selection.to - ,clamp-selection JSR ,redraw JSR ,ctrl-end JMP + ,no-alt ~dev/ctrl #0f AND #02 NEQ JMP2? POP2 + ,no-aup ~dev/ctrl #04 ROR #01 NEQ JMP2? POP2 + ,find-wordstart JSR2 =selection.to + ,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 @no-aup - ,no-adown ~dev/ctrl #04 ROR #02 NEQ JMP? POP2 - ,find-wordend JSR =selection.to - ,clamp-selection JSR ,redraw JSR ,ctrl-end JMP + ,no-adown ~dev/ctrl #04 ROR #02 NEQ JMP2? POP2 + ,find-wordend JSR2 =selection.to + ,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 @no-adown - ,no-aleft ~dev/ctrl #04 ROR #04 NEQ JMP? POP2 + ,no-aleft ~dev/ctrl #04 ROR #04 NEQ JMP2? POP2 ~selection.to #0001 SUB2 =selection.to - ,clamp-selection JSR ,redraw JSR ,ctrl-end JMP + ,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 @no-aleft - ,no-aright ~dev/ctrl #04 ROR #08 NEQ JMP? POP2 + ,no-aright ~dev/ctrl #04 ROR #08 NEQ JMP2? POP2 ~selection.to #0001 ADD2 =selection.to - ,clamp-selection JSR ,redraw JSR ,ctrl-end JMP + ,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 @no-aright @no-alt ( ctrl ) - ,no-ctrl ~dev/ctrl #0f AND #01 NEQ JMP? POP2 - ,no-cup ~dev/ctrl #04 ROR #01 NEQ JMP? POP2 + ,no-ctrl ~dev/ctrl #0f AND #01 NEQ JMP2? POP2 + ,no-cup ~dev/ctrl #04 ROR #01 NEQ JMP2? POP2 ~scroll.y #0004 SUB2 =scroll.y - ,redraw JSR ,ctrl-end JMP + ,redraw JSR2 ,ctrl-end JMP2 @no-cup - ,no-cdown ~dev/ctrl #04 ROR #02 NEQ JMP? POP2 + ,no-cdown ~dev/ctrl #04 ROR #02 NEQ JMP2? POP2 ~scroll.y #0004 ADD2 =scroll.y - ,redraw JSR ,ctrl-end JMP + ,redraw JSR2 ,ctrl-end JMP2 @no-cdown - ,no-cleft ~dev/ctrl #04 ROR #04 NEQ JMP? POP2 - ,goto-linestart JSR ,redraw JSR ,ctrl-end JMP + ,no-cleft ~dev/ctrl #04 ROR #04 NEQ JMP2? POP2 + ,goto-linestart JSR2 ,redraw JSR2 ,ctrl-end JMP2 @no-cleft - ,no-cright ~dev/ctrl #04 ROR #08 NEQ JMP? POP2 - ,goto-lineend JSR ,redraw JSR ,ctrl-end JMP + ,no-cright ~dev/ctrl #04 ROR #08 NEQ JMP2? POP2 + ,goto-lineend JSR2 ,redraw JSR2 ,ctrl-end JMP2 @no-cright @no-ctrl @@ -121,68 +120,68 @@ BRK ( keys ) - ,keys-end ~dev/key #00 EQU JMP? POP2 + ,keys-end ~dev/key #00 EQU JMP2? POP2 - ,no-backspace ~dev/key #08 NEQ JMP? POP2 + ,no-backspace ~dev/key #08 NEQ JMP2? POP2 ( erase ) - ~selection.to ~selection.from SUB2 ,shift-left JSR + ~selection.to ~selection.from SUB2 ,shift-left JSR2 ~selection.from #0001 SUB2 =selection.from ~selection.from #0001 ADD2 =selection.to ( release ) #00 =dev/key - ,redraw JSR - ,keys-end JMP + ,redraw JSR2 + ,keys-end JMP2 @no-backspace ( insert ) - ~selection.to ~selection.from SUB2 ,shift-right JSR + ~selection.to ~selection.from SUB2 ,shift-right JSR2 ~dev/key ~selection.from STR ~selection.from #0001 ADD2 =selection.from ~selection.from #0001 ADD2 =selection.to ( release ) #00 =dev/key - ,redraw JSR + ,redraw JSR2 @keys-end ( mouse ) - ,touch-end ~dev/mouse.state #00 EQU JMP? POP2 + ,touch-end ~dev/mouse.state #00 EQU JMP2? POP2 - ,touch-linebar ~dev/mouse.x #0010 LTH2 JMP? POP2 - ,touch-body ~dev/mouse.x ~dev/screen.width #0008 SUB2 LTH2 JMP? POP2 - ,touch-scrollbar JMP + ,touch-linebar ~dev/mouse.x #0010 LTH2 JMP2? POP2 + ,touch-body ~dev/mouse.x ~dev/screen.width #0008 SUB2 LTH2 JMP2? POP2 + ,touch-scrollbar JMP2 @touch-end ~dev/mouse.state =touch.state - ( unlock ) ,skip-unlock ~lock #00 EQU JMP? POP2 ~lock #01 SUB =lock @skip-unlock + ( unlock ) ,skip-unlock ~lock #00 EQU JMP2? POP2 ~lock #01 SUB =lock @skip-unlock - ,draw-cursor JSR + ,draw-cursor JSR2 BRK @touch-scrollbar - ,no-click-scroll-up ~dev/mouse.y #0008 GTH2 JMP? POP2 + ,no-click-scroll-up ~dev/mouse.y #0008 GTH2 JMP2? POP2 ( decr ) ~scroll.y #00 ~scroll.y #0000 NEQ2 SUB2 =scroll.y - ,redraw JSR ,touch-end JMP + ,redraw JSR2 ,touch-end JMP2 @no-click-scroll-up - ,no-click-scroll-down ~dev/mouse.y ~dev/screen.height #0008 SUB2 LTH2 JMP? POP2 + ,no-click-scroll-down ~dev/mouse.y ~dev/screen.height #0008 SUB2 LTH2 JMP2? POP2 ( incr ) ~scroll.y #0001 ADD2 =scroll.y - ,redraw JSR ,touch-end JMP + ,redraw JSR2 ,touch-end JMP2 @no-click-scroll-down ~dev/mouse.y #0008 SUB2 =scroll.y - ,redraw JSR - ,touch-end JMP + ,redraw JSR2 + ,touch-end JMP2 RTS @touch-linebar ~dev/mouse.y #0008 DIV2 ~scroll.y ADD2 =position.y #0000 =position.x - ,find-selection JSR DUP2 =selection.from #0001 ADD2 =selection.to - ,redraw JSR - ,touch-end JMP + ,find-selection JSR2 DUP2 =selection.from #0001 ADD2 =selection.to + ,redraw JSR2 + ,touch-end JMP2 RTS @@ -191,18 +190,18 @@ RTS ~dev/mouse.y #0008 DIV2 ~scroll.y ADD2 =position.y ~dev/mouse.x ~textarea.x1 SUB2 #0007 ADD2 #0007 DIV2 =position.x - ,touch-when ~dev/mouse.state ~touch.state NEQ ~dev/ctrl #0f AND #02 NEQ #0101 EQU2 JMP? POP2 + ,touch-when ~dev/mouse.state ~touch.state NEQ ~dev/ctrl #0f AND #02 NEQ #0101 EQU2 JMP2? POP2 ( on drag ) - ,find-selection JSR #0001 ADD2 =selection.to - ,clamp-selection JSR - ,redraw JSR - ,touch-end JMP + ,find-selection JSR2 #0001 ADD2 =selection.to + ,clamp-selection JSR2 + ,redraw JSR2 + ,touch-end JMP2 @touch-when ( on click ) - ,find-selection JSR DUP2 =selection.from #0001 ADD2 =selection.to - ,redraw JSR - ,touch-end JMP + ,find-selection JSR2 DUP2 =selection.from #0001 ADD2 =selection.to + ,redraw JSR2 + ,touch-end JMP2 RTS @@ -214,7 +213,7 @@ RTS ,document.body =document.eof @load-file-loop ( incr ) ~document.eof #0001 ADD2 =document.eof - ,load-file-loop ~document.eof LDR #00 NEQ JMP? POP2 + ,load-file-loop ~document.eof LDR #00 NEQ JMP2? POP2 RTS @@ -225,7 +224,7 @@ RTS @shift-left-loop ( move ) ~j ~i ADD2 LDR ~j STR ( incr ) ~j #0001 ADD2 =j - ,shift-left-loop ~j ~document.eof LTH2 JMP? POP2 + ,shift-left-loop ~j ~document.eof LTH2 JMP2? POP2 ~document.eof ~i SUB2 =document.eof RTS @@ -237,7 +236,7 @@ RTS @shift-right-loop ( move ) ~j ~i SUB2 LDR ~j STR ( decr ) ~j #0001 SUB2 =j - ,shift-right-loop ~j ~selection.from GTH2 JMP? POP2 + ,shift-right-loop ~j ~selection.from GTH2 JMP2? POP2 ~document.eof ~i ADD2 =document.eof RTS @@ -255,7 +254,7 @@ RTS ~selection.from #0001 SUB2 LDR #0a EQU RTS? ~selection.from #0001 SUB2 LDR #0d EQU RTS? ( decr ) ~selection.from DUP2 =selection.to #0001 SUB2 =selection.from - ,goto-linestart-loop ~selection.from LDR #00 NEQ JMP? POP2 + ,goto-linestart-loop ~selection.from LDR #00 NEQ JMP2? POP2 ( clamp at document body ) ~selection.from ,document.body GTH2 RTS? ,document.body DUP2 =selection.from #0001 ADD2 =selection.to @@ -268,7 +267,7 @@ RTS ~selection.from LDR #0a EQU RTS? ~selection.from LDR #0d EQU RTS? ( incr ) ~selection.from #0001 ADD2 DUP2 #0001 ADD2 =selection.to =selection.from - ,goto-lineend-loop ~selection.from LDR #00 NEQ JMP? POP2 + ,goto-lineend-loop ~selection.from LDR #00 NEQ JMP2? POP2 ( clamp at document body ) ~selection.from ,document.eof LTH2 RTS? ,document.eof #0001 SUB2 DUP2 =selection.from #0001 ADD2 =selection.to @@ -280,10 +279,10 @@ RTS ~selection.to =j @find-wordstart-loop ( decr ) ~j #0001 SUB2 =j - ,find-wordstart-end ~j LDR #20 EQU JMP? POP2 - ,find-wordstart-end ~j LDR #0a EQU JMP? POP2 - ,find-wordstart-end ~j LDR #0d EQU JMP? POP2 - ,find-wordstart-loop ~j ,document.body GTH2 JMP? POP2 + ,find-wordstart-end ~j LDR #20 EQU JMP2? POP2 + ,find-wordstart-end ~j LDR #0a EQU JMP2? POP2 + ,find-wordstart-end ~j LDR #0d EQU JMP2? POP2 + ,find-wordstart-loop ~j ,document.body GTH2 JMP2? POP2 @find-wordstart-end ( return ) ~j #0001 SUB2 @@ -294,10 +293,10 @@ RTS ~selection.to =j @find-wordend-loop ( incr ) ~j #0001 ADD2 =j - ,find-wordend-end ~j LDR #20 EQU JMP? POP2 - ,find-wordend-end ~j LDR #0a EQU JMP? POP2 - ,find-wordend-end ~j LDR #0d EQU JMP? POP2 - ,find-wordend-loop ~j ,document.body GTH2 JMP? POP2 + ,find-wordend-end ~j LDR #20 EQU JMP2? POP2 + ,find-wordend-end ~j LDR #0a EQU JMP2? POP2 + ,find-wordend-end ~j LDR #0d EQU JMP2? POP2 + ,find-wordend-loop ~j ,document.body GTH2 JMP2? POP2 @find-wordend-end ( return ) ~j #0001 ADD2 @@ -308,9 +307,9 @@ RTS #0000 =j @find-lineoffset-loop ( incr ) ~j #0001 ADD2 =j - ,find-lineoffset-end ~selection.from ~j SUB2 LDR #0a EQU JMP? POP2 - ,find-lineoffset-end ~selection.from ~j SUB2 LDR #0d EQU JMP? POP2 - ,find-lineoffset-loop ~selection.from ~j SUB2 ,document.body GTH2 JMP? POP2 + ,find-lineoffset-end ~selection.from ~j SUB2 LDR #0a EQU JMP2? POP2 + ,find-lineoffset-end ~selection.from ~j SUB2 LDR #0d EQU JMP2? POP2 + ,find-lineoffset-loop ~selection.from ~j SUB2 ,document.body GTH2 JMP2? POP2 @find-lineoffset-end ( return ) ~j @@ -320,12 +319,12 @@ RTS ,document.body =j #0000 =pt.y @find-line-loop - ,find-line-end ~pt.y ~position.y #0001 SUB2 GTH2 JMP? POP2 - ,find-line-no-space ~j LDR #0a NEQ ~j LDR #0d NEQ #0101 EQU2 JMP? POP2 + ,find-line-end ~pt.y ~position.y #0001 SUB2 GTH2 JMP2? POP2 + ,find-line-no-space ~j LDR #0a NEQ ~j LDR #0d NEQ #0101 EQU2 JMP2? POP2 ( incr ) ~pt.y #0001 ADD2 =pt.y @find-line-no-space ( incr ) ~j #0001 ADD2 =j - ,find-line-loop ~j LDR #00 NEQ JMP? POP2 + ,find-line-loop ~j LDR #00 NEQ JMP2? POP2 @find-line-end ( return ) ~j @@ -333,15 +332,15 @@ RTS @find-selection ( position -> addr ) - ,find-line JSR ( find line ) + ,find-line JSR2 ( find line ) #0000 =pt.x @find-selection-loop - ,find-selection-end ~j ~pt.x ADD2 LDR #0a EQU JMP? POP2 - ,find-selection-end ~j ~pt.x ADD2 LDR #0d EQU JMP? POP2 + ,find-selection-end ~j ~pt.x ADD2 LDR #0a EQU JMP2? POP2 + ,find-selection-end ~j ~pt.x ADD2 LDR #0d EQU JMP2? POP2 ( incr ) ~pt.x #0001 ADD2 =pt.x - ,find-selection-loop ~pt.x ~position.x #0001 SUB2 LTH2 JMP? POP2 + ,find-selection-loop ~pt.x ~position.x #0001 SUB2 LTH2 JMP2? POP2 @find-selection-end ( return ) ~pt.x ADD2 @@ -353,19 +352,19 @@ RTS @select-loop - ,no-space ~selection.from LDR #0a NEQ ~selection.from LDR #0d NEQ #0101 EQU2 JMP? POP2 + ,no-space ~selection.from LDR #0a NEQ ~selection.from LDR #0d NEQ #0101 EQU2 JMP2? POP2 ( incr ) ~pt.y #0001 ADD2 =pt.y #0000 =pt.x @no-space - ,no-reached ~pt.y ~position.y #0001 SUB2 GTH2 ~pt.x ~position.x #0001 SUB2 GTH2 #0101 NEQ2 JMP? POP2 + ,no-reached ~pt.y ~position.y #0001 SUB2 GTH2 ~pt.x ~position.x #0001 SUB2 GTH2 #0101 NEQ2 JMP2? POP2 ~selection.from #0001 ADD2 =selection.to RTS @no-reached ( incr ) ~pt.x #0001 ADD2 =pt.x ( incr ) ~selection.from #0001 ADD2 =selection.from - ,select-loop ~selection.from LDR #00 NEQ JMP? POP2 + ,select-loop ~selection.from LDR #00 NEQ JMP2? POP2 RTS @@ -373,10 +372,10 @@ RTS @redraw - ,draw-lines JSR - ,draw-textarea JSR - ,draw-scrollbar JSR - ,draw-titlebar JSR + ,draw-lines JSR2 + ,draw-textarea JSR2 + ,draw-scrollbar JSR2 + ,draw-titlebar JSR2 ( save/load icons ) @@ -406,7 +405,7 @@ RTS ( draw ) #02 ~addr ~position.y EQU2 #06 MUL ADD =dev/sprite.color ( incr ) ~j #0001 ADD2 =j ( incr ) ~dev/sprite.y #0008 ADD2 =dev/sprite.y - ,draw-lines-loop ~j ~dev/screen.height #0008 SUB2 #0008 DIV2 NEQ2 JMP? POP2 + ,draw-lines-loop ~j ~dev/screen.height #0008 SUB2 #0008 DIV2 NEQ2 JMP2? POP2 RTS @@ -459,12 +458,12 @@ RTS ( scroll to position ) #0000 =j ( j is linebreaks ) @find-scroll-offset - ,find-scroll-offset-end ~scroll.y ~j EQU2 JMP? POP2 - ,no-break ~textarea.addr LDR #0a NEQ ~textarea.addr LDR #0d NEQ #0101 EQU2 JMP? POP2 + ,find-scroll-offset-end ~scroll.y ~j EQU2 JMP2? POP2 + ,no-break ~textarea.addr LDR #0a NEQ ~textarea.addr LDR #0d NEQ #0101 EQU2 JMP2? POP2 ( incr ) ~j #0001 ADD2 =j @no-break ( incr ) ~textarea.addr #0001 ADD2 =textarea.addr - ,find-scroll-offset ~textarea.addr LDR #00 NEQ JMP? POP2 + ,find-scroll-offset ~textarea.addr LDR #00 NEQ JMP2? POP2 @find-scroll-offset-end ~textarea.addr #0000 ADD2 =textarea.addr @@ -475,7 +474,7 @@ RTS @draw-textarea-loop - ,draw-textarea-end ~dev/sprite.y ~dev/screen.height #0010 SUB2 GTH2 JMP? POP2 + ,draw-textarea-end ~dev/sprite.y ~dev/screen.height #0010 SUB2 GTH2 JMP2? POP2 ( get character ) ,font #00 ~j LDR #20 SUB #0008 MUL2 ADD2 =dev/sprite.addr @@ -485,7 +484,7 @@ RTS ~j ~selection.to LTH2 #0101 EQU2 #05 MUL ADD =dev/sprite.color - ,no-linebreak ~j LDR #0a NEQ ~j LDR #0d NEQ #0101 EQU2 JMP? POP2 + ,no-linebreak ~j LDR #0a NEQ ~j LDR #0d NEQ #0101 EQU2 JMP2? POP2 ( draw linebreak ) ,linebreak_icn =dev/sprite.addr ( draw ) #03 @@ -497,7 +496,7 @@ RTS ( incr ) ~dev/sprite.x #0008 ADD2 =dev/sprite.x ,font =dev/sprite.addr #01 =dev/sprite.color - ,fill-clear ~dev/sprite.x ~dev/screen.width #0008 SUB2 LTH2 JMP? POP2 + ,fill-clear ~dev/sprite.x ~dev/screen.width #0008 SUB2 LTH2 JMP2? POP2 #0010 =dev/sprite.x ( incr ) ~dev/sprite.y #0008 ADD2 =dev/sprite.y @no-linebreak @@ -505,7 +504,7 @@ RTS ( incr ) ~j #0001 ADD2 =j ( incr ) ~dev/sprite.x #0007 ADD2 =dev/sprite.x - ,draw-textarea-loop ~j LDR #00 NEQ JMP? POP2 + ,draw-textarea-loop ~j LDR #00 NEQ JMP2? POP2 @draw-textarea-end @@ -520,7 +519,7 @@ RTS @draw-scrollbar-loop ( draw ) #08 =dev/sprite.color ( incr ) ~dev/sprite.y #0008 ADD2 =dev/sprite.y - ,draw-scrollbar-loop ~dev/sprite.y ~dev/screen.height LTH2 JMP? POP2 + ,draw-scrollbar-loop ~dev/sprite.y ~dev/screen.height LTH2 JMP2? POP2 #0000 =dev/sprite.y ,arrowup_icn =dev/sprite.addr @@ -547,11 +546,11 @@ RTS ( draw ) DUP2 LDR #00 SWP #20 SUB #0008 MUL2 ,font ADD2 =dev/sprite.addr ~label.color =dev/sprite.color ( incr ) #0001 ADD2 ( incr ) ~dev/sprite.x #0008 ADD2 =dev/sprite.x - DUP2 LDR #00 NEQ ,draw-titlebar-loop ROT JMP? POP2 + DUP2 LDR #00 NEQ ,draw-titlebar-loop ROT JMP2? POP2 POP2 ( selection ) - ~selection.from ,document.body SUB2 ,draw-short JSR + ~selection.from ,document.body SUB2 ,draw-short JSR2 RTS diff --git a/projects/software/nasu.usm b/projects/software/nasu.usm @@ -40,7 +40,7 @@ ~dev/screen.height #0002 DIV2 #003f SUB2 =tileview.y ,bank1 #0448 ADD2 =tileview.addr - ,redraw JSR + ,redraw JSR2 BRK @@ -48,62 +48,62 @@ BRK ( keyboard controls ) - ,no-key ~dev/key #00 EQU JMP? POP2 + ,no-key ~dev/key #00 EQU JMP2? POP2 - ,no-key ~dev/key #31 LTH JMP? POP2 - ,no-key ~dev/key #33 GTH JMP? POP2 + ,no-key ~dev/key #31 LTH JMP2? POP2 + ,no-key ~dev/key #33 GTH JMP2? POP2 ( select ) ~dev/key #31 SUB =bankview.mode ( release ) #00 =dev/key - ,redraw JSR + ,redraw JSR2 @no-key - ,no-ctrl ~dev/ctrl.buttons #00 EQU JMP? POP2 + ,no-ctrl ~dev/ctrl.buttons #00 EQU JMP2? POP2 - ,no-ctrl-up ~dev/ctrl.buttons #10 EQU JMP? POP2 + ,no-ctrl-up ~dev/ctrl.buttons #10 EQU JMP2? POP2 ~tileview.addr #0080 ADD2 =tileview.addr @no-ctrl-up - ,no-ctrl-down ~dev/ctrl.buttons #20 EQU JMP? POP2 + ,no-ctrl-down ~dev/ctrl.buttons #20 EQU JMP2? POP2 ~tileview.addr #0080 SUB2 =tileview.addr @no-ctrl-down - ,no-ctrl-left ~dev/ctrl.buttons #40 EQU JMP? POP2 + ,no-ctrl-left ~dev/ctrl.buttons #40 EQU JMP2? POP2 ~tileview.addr #0008 ADD2 =tileview.addr @no-ctrl-left - ,no-ctrl-right ~dev/ctrl.buttons #80 EQU JMP? POP2 + ,no-ctrl-right ~dev/ctrl.buttons #80 EQU JMP2? POP2 ~tileview.addr #0008 SUB2 =tileview.addr @no-ctrl-right ~tileview.addr #0800 DIV2 #0800 MUL2 =bankview.addr - ,redraw JSR + ,redraw JSR2 @no-ctrl ( mouse controls ) - ,click-end ~dev/mouse.state #00 EQU JMP? POP2 + ,click-end ~dev/mouse.state #00 EQU JMP2? POP2 ( toolbar ) - ,no-toolbar-click ~dev/mouse.y ~bankview.y #0010 SUB2 SUB2 #0008 DIV2 #0000 NEQ2 JMP? POP2 + ,no-toolbar-click ~dev/mouse.y ~bankview.y #0010 SUB2 SUB2 #0008 DIV2 #0000 NEQ2 JMP2? POP2 ( brush ) - ,no-brush-click ~dev/mouse.x ~bankview.x SUB2 #0008 DIV2 #000d LTH2 JMP? POP2 - ,no-brush-click ~dev/mouse.x ~bankview.x SUB2 #0008 DIV2 #000f GTH2 JMP? POP2 + ,no-brush-click ~dev/mouse.x ~bankview.x SUB2 #0008 DIV2 #000d LTH2 JMP2? POP2 + ,no-brush-click ~dev/mouse.x ~bankview.x SUB2 #0008 DIV2 #000f GTH2 JMP2? POP2 ( select ) ~mouse.x ~bankview.x SUB2 #0008 DIV2 #000d SUB2 SWP POP =bankview.mode ( release ) #00 =dev/mouse.state - ,redraw JSR ,click-end JMP + ,redraw JSR2 ,click-end JMP2 @no-brush-click - ,no-load-click ~dev/mouse.x ~tileview.x SUB2 #0008 DIV2 #000e NEQU2 JMP? POP2 + ,no-load-click ~dev/mouse.x ~tileview.x SUB2 #0008 DIV2 #000e NEQU2 JMP2? POP2 ( load ) ,filename =dev/file.name #0800 =dev/file.length ~bankview.addr =dev/file.load ( release ) #00 =dev/mouse.state - ,redraw JSR ,click-end JMP + ,redraw JSR2 ,click-end JMP2 @no-load-click - ,no-save-click ~dev/mouse.x ~tileview.x SUB2 #0008 DIV2 #000f NEQU2 JMP? POP2 + ,no-save-click ~dev/mouse.x ~tileview.x SUB2 #0008 DIV2 #000f NEQU2 JMP2? POP2 ( save ) ,filename =dev/file.name #0800 =dev/file.length ~bankview.addr =dev/file.save ( release ) #00 =dev/mouse.state - ,redraw JSR ,click-end JMP + ,redraw JSR2 ,click-end JMP2 @no-save-click @no-toolbar-click @@ -112,9 +112,9 @@ BRK ~dev/mouse.x ~bankview.x GTH2 ~dev/mouse.x ~bankview.x #0080 ADD2 LTH2 #0101 EQU2 ~dev/mouse.y ~bankview.y GTH2 ~dev/mouse.y ~bankview.y #0080 ADD2 LTH2 #0101 EQU2 - #0101 NEQ2 ,no-bank-click ROT JMP? POP2 + #0101 NEQ2 ,no-bank-click ROT JMP2? POP2 - ,not-copy-mode ~bankview.mode #01 NEQ JMP? POP2 + ,not-copy-mode ~bankview.mode #01 NEQ JMP2? POP2 #00 =i @copy-loop ( load ) ~tileview.addr ~i ADD LDR @@ -123,11 +123,11 @@ BRK ~dev/mouse.y ~bankview.y SUB2 #0008 DIV2 #0008 MUL2 #0010 MUL2 ADD2 ~bankview.addr ADD2 #00 ~i ADD2 STR ( incr ) ~i #01 ADD =i - ,copy-loop ~i #08 LTH JMP? POP2 - ,redraw JSR ,click-end JMP + ,copy-loop ~i #08 LTH JMP2? POP2 + ,redraw JSR2 ,click-end JMP2 @not-copy-mode - ,not-erase-mode ~bankview.mode #02 NEQ JMP? POP2 + ,not-erase-mode ~bankview.mode #02 NEQ JMP2? POP2 #00 =i @erase-loop #00 @@ -136,14 +136,14 @@ BRK ~dev/mouse.y ~bankview.y SUB2 #0008 DIV2 #0008 MUL2 #0010 MUL2 ADD2 ~bankview.addr ADD2 #00 ~i ADD2 STR ( incr ) ~i #01 ADD =i - ,erase-loop ~i #08 LTH JMP? POP2 - ,redraw JSR ,click-end JMP + ,erase-loop ~i #08 LTH JMP2? POP2 + ,redraw JSR2 ,click-end JMP2 @not-erase-mode ~dev/mouse.x ~bankview.x SUB2 #0008 DIV2 #0008 MUL2 ~dev/mouse.y ~bankview.y SUB2 #0008 DIV2 #0008 MUL2 #0010 MUL2 ADD2 ~bankview.addr ADD2 =tileview.addr - ,redraw JSR ,click-end JMP + ,redraw JSR2 ,click-end JMP2 @no-bank-click @@ -151,7 +151,7 @@ BRK ~dev/mouse.x ~tileview.x GTH2 ~dev/mouse.x ~tileview.x #0080 ADD2 LTH2 #0101 EQU2 ~dev/mouse.y ~tileview.y GTH2 ~dev/mouse.y ~tileview.y #0080 ADD2 LTH2 #0101 EQU2 - #0101 NEQ2 ,no-tile-click ROT JMP? POP2 + #0101 NEQ2 ,no-tile-click ROT JMP2? POP2 ~dev/mouse.x ~tileview.x SUB2 #0008 DIV2 #0008 MUL2 #0040 DIV2 ~dev/mouse.y ~tileview.y SUB2 #0008 DIV2 #0008 MUL2 #0040 DIV2 #0002 MUL2 ADD2 @@ -159,43 +159,43 @@ BRK ~tileview.addr ADD2 =addr ( addr offset ) ~dev/mouse.x ~tileview.x SUB2 ~dev/mouse.x ~tileview.x SUB2 #0040 DIV2 #0040 MUL2 SUB2 =pos.x ~dev/mouse.y ~tileview.y SUB2 ~dev/mouse.y ~tileview.y SUB2 #0040 DIV2 #0040 MUL2 SUB2 =pos.y - ,no-fill-mode ~bankview.mode #01 NEQ JMP? POP2 + ,no-fill-mode ~bankview.mode #01 NEQ JMP2? POP2 ( fill row ) #ff ~addr ~pos.y #0008 DIV2 ADD2 STR - ,redraw JSR ,click-end JMP + ,redraw JSR2 ,click-end JMP2 @no-fill-mode - ,no-erase-mode ~bankview.mode #02 NEQ JMP? POP2 + ,no-erase-mode ~bankview.mode #02 NEQ JMP2? POP2 ( erase row ) #00 ~addr ~pos.y #0008 DIV2 ADD2 STR - ,redraw JSR ,click-end JMP + ,redraw JSR2 ,click-end JMP2 @no-erase-mode ( load ) ~addr ~pos.y #0008 DIV2 ADD2 LDR ( mask ) #01 #07 ~pos.x #0008 DIV2 SWP POP SUB ROL XOR ( save ) ~addr ~pos.y #0008 DIV2 ADD2 STR - ,redraw JSR ,click-end JMP + ,redraw JSR2 ,click-end JMP2 @no-tile-click ( operations ) - ,no-operations ~dev/mouse.y ~tileview.y SUB2 #0008 DIV2 #000c NEQ2 JMP? POP2 + ,no-operations ~dev/mouse.y ~tileview.y SUB2 #0008 DIV2 #000c NEQ2 JMP2? POP2 - ,no-move-up ~dev/mouse.x ~tileview.x SUB2 #0008 DIV2 #0011 NEQ2 JMP? POP2 - ,op_shiftup JSR + ,no-move-up ~dev/mouse.x ~tileview.x SUB2 #0008 DIV2 #0011 NEQ2 JMP2? POP2 + ,op_shiftup JSR2 ( release ) #00 =dev/mouse.state - ,redraw JSR ,click-end JMP + ,redraw JSR2 ,click-end JMP2 @no-move-up - ,no-move-down ~dev/mouse.x ~tileview.x SUB2 #0008 DIV2 #0012 NEQ2 JMP? POP2 - ,op_shiftdown JSR + ,no-move-down ~dev/mouse.x ~tileview.x SUB2 #0008 DIV2 #0012 NEQ2 JMP2? POP2 + ,op_shiftdown JSR2 ( release ) #00 =dev/mouse.state - ,redraw JSR ,click-end JMP + ,redraw JSR2 ,click-end JMP2 @no-move-down @no-operations @click-end - ,draw-cursor JSR + ,draw-cursor JSR2 BRK @@ -229,20 +229,20 @@ RTS @redraw - ,draw-bankview JSR - ,draw-tileview JSR + ,draw-bankview JSR2 + ,draw-tileview JSR2 RTS @draw-bankview - ~bankview.x #0002 SUB2 ~bankview.y #0002 SUB2 ~bankview.x #0081 ADD2 ~bankview.y #0081 ADD2 #03 ,line-rect JSR + ~bankview.x #0002 SUB2 ~bankview.y #0002 SUB2 ~bankview.x #0081 ADD2 ~bankview.y #0081 ADD2 #03 ,line-rect JSR2 ( position ) ~bankview.x =dev/sprite.x ~bankview.y #0010 SUB2 =dev/sprite.y - ~bankview.addr ,draw-short JSR + ~bankview.addr ,draw-short JSR2 ( toolbar ) @@ -279,7 +279,7 @@ RTS ( draw ) #02 =dev/sprite.color ~dev/sprite.addr #0008 ADD2 =dev/sprite.addr ( incr ) ~i #01 ADD =i - ,draw-bankview-guides ~i #10 LTH JMP? POP2 + ,draw-bankview-guides ~i #10 LTH JMP2? POP2 ( body ) @@ -290,23 +290,23 @@ RTS ~bankview.x =dev/sprite.x @draw-bankview-tiles-hor ( draw ) #01 =dev/sprite.color - ,no-highlight ~dev/sprite.addr ~tileview.addr LTH2 JMP? POP2 - ,no-highlight ~dev/sprite.addr ~tileview.addr #0018 ADD2 GTH2 JMP? POP2 + ,no-highlight ~dev/sprite.addr ~tileview.addr LTH2 JMP2? POP2 + ,no-highlight ~dev/sprite.addr ~tileview.addr #0018 ADD2 GTH2 JMP2? POP2 ( draw ) #0c =dev/sprite.color @no-highlight ( incr ) ~dev/sprite.x #0008 ADD2 =dev/sprite.x ( incr ) ~dev/sprite.addr #0008 ADD2 =dev/sprite.addr ( incr ) ~pt.x #01 ADD =pt.x - ,draw-bankview-tiles-hor ~pt.x #10 LTH JMP? POP2 + ,draw-bankview-tiles-hor ~pt.x #10 LTH JMP2? POP2 ( incr ) ~pt.y #01 ADD =pt.y ( incr ) ~dev/sprite.y #0008 ADD2 =dev/sprite.y - ,draw-bankview-tiles-ver ~pt.y #10 LTH JMP? POP2 + ,draw-bankview-tiles-ver ~pt.y #10 LTH JMP2? POP2 RTS @draw-tileview - ~tileview.x #0002 SUB2 ~tileview.y #0002 SUB2 ~tileview.x #0080 ADD2 ~tileview.y #0081 ADD2 #03 ,line-rect JSR + ~tileview.x #0002 SUB2 ~tileview.y #0002 SUB2 ~tileview.x #0080 ADD2 ~tileview.y #0081 ADD2 #03 ,line-rect JSR2 ~tileview.x #0028 ADD2 =dev/sprite.x ~tileview.y #0010 SUB2 =dev/sprite.y @@ -317,29 +317,29 @@ RTS ~tileview.x =dev/sprite.x ~tileview.y #0010 SUB2 =dev/sprite.y - ~tileview.addr ,draw-short JSR + ~tileview.addr ,draw-short JSR2 ( body ) ~tileview.x =dev/sprite.x ~tileview.y =dev/sprite.y ~tileview.addr =tileview.addr - ,draw-tileview-icn JSR + ,draw-tileview-icn JSR2 ~tileview.x #0040 ADD2 =dev/sprite.x ~tileview.y =dev/sprite.y ~tileview.addr #0008 ADD2 =tileview.addr - ,draw-tileview-icn JSR + ,draw-tileview-icn JSR2 ~tileview.x =dev/sprite.x ~tileview.y #0040 ADD2 =dev/sprite.y ~tileview.addr #0008 ADD2 =tileview.addr - ,draw-tileview-icn JSR + ,draw-tileview-icn JSR2 ~tileview.x #0040 ADD2 =dev/sprite.x ~tileview.y #0040 ADD2 =dev/sprite.y ~tileview.addr #0008 ADD2 =tileview.addr - ,draw-tileview-icn JSR + ,draw-tileview-icn JSR2 ( line hor ) ~tileview.y #003f ADD2 =dev/screen.y @@ -347,7 +347,7 @@ RTS @draw-hor ( draw ) #03 =dev/screen.color ( incr ) ~dev/screen.x #0002 ADD2 =dev/screen.x - ~dev/screen.x ~tileview.x #0082 ADD2 LTH2 ,draw-hor ROT JMP? POP2 + ~dev/screen.x ~tileview.x #0082 ADD2 LTH2 ,draw-hor ROT JMP2? POP2 ( line ver ) ~tileview.y =dev/screen.y @@ -355,7 +355,7 @@ RTS @draw-ver ( draw ) #03 =dev/screen.color ( incr ) ~dev/screen.y #0002 ADD2 =dev/screen.y - ~dev/screen.y ~tileview.y #0081 ADD2 LTH2 ,draw-ver ROT JMP? POP2 + ~dev/screen.y ~tileview.y #0081 ADD2 LTH2 ,draw-ver ROT JMP2? POP2 ( rewind ) ~tileview.addr #0018 SUB2 =tileview.addr @@ -372,7 +372,7 @@ RTS ( draw ) #02 =dev/sprite.color ( incr ) ~i #01 ADD =i ( incr ) ~dev/sprite.y #0008 ADD2 =dev/sprite.y - ,draw-tileview-bytes ~i #08 LTH JMP? POP2 + ,draw-tileview-bytes ~i #08 LTH JMP2? POP2 ( operations ) @@ -395,10 +395,10 @@ RTS ( incr ) ~dev/sprite.x #0008 ADD2 =dev/sprite.x ( incr ) ~dev/sprite.addr #0008 ADD2 =dev/sprite.addr ( incr ) ~pt.x #01 ADD =pt.x - ,draw-tileview-tiles-hor ~pt.x #02 LTH JMP? POP2 + ,draw-tileview-tiles-hor ~pt.x #02 LTH JMP2? POP2 ( incr ) ~pt.y #01 ADD =pt.y ( incr ) ~dev/sprite.y #0008 ADD2 =dev/sprite.y - ,draw-tileview-tiles-ver ~pt.y #02 LTH JMP? POP2 + ,draw-tileview-tiles-ver ~pt.y #02 LTH JMP2? POP2 RTS @@ -415,11 +415,11 @@ RTS ( draw ) #01 =dev/sprite.color ( incr ) ~dev/sprite.x #0008 ADD2 =dev/sprite.x ( incr ) ~pt.x #01 ADD =pt.x - ,redraw-hor ~pt.x #08 LTH JMP? POP2 + ,redraw-hor ~pt.x #08 LTH JMP2? POP2 ( incr ) ~dev/sprite.y #0008 ADD2 =dev/sprite.y ( incr ) ~pt.y #01 ADD =pt.y ~dev/sprite.x #0040 SUB2 =dev/sprite.x - ,redraw-ver ~pt.y #08 LTH JMP? POP2 + ,redraw-ver ~pt.y #08 LTH JMP2? POP2 RTS @@ -474,13 +474,13 @@ RTS ( incr ) ~dev/screen.x #0001 ADD2 =dev/screen.x ( draw ) ~rect.y1 =dev/screen.y ~color =dev/screen.color ( draw ) ~rect.y2 =dev/screen.y ~color =dev/screen.color - ,line-rect-hor ~dev/screen.x ~rect.x2 LTH2 JMP? POP2 + ,line-rect-hor ~dev/screen.x ~rect.x2 LTH2 JMP2? POP2 ~rect.y1 =dev/screen.y @line-rect-ver ( draw ) ~rect.x1 =dev/screen.x ~color =dev/screen.color ( draw ) ~rect.x2 =dev/screen.x ~color =dev/screen.color ( incr ) ~dev/screen.y #0001 ADD2 =dev/screen.y - ,line-rect-ver ~dev/screen.y ~rect.y2 #0001 ADD2 LTH2 JMP? POP2 + ,line-rect-ver ~dev/screen.y ~rect.y2 #0001 ADD2 LTH2 JMP2? POP2 RTS diff --git a/uxn.c b/uxn.c @@ -33,8 +33,8 @@ Uint16 peek16(Stack *s, Uint8 a) { return peek8(s, a * 2) + (peek8(s, a * 2 + 1) void op_brk(Uxn *u) { setflag(&u->status, FLAG_HALT, 1); } void op_lit(Uxn *u) { u->literal += 1; } void op_nop(Uxn *u) { printf("0x%02x \n", pop8(&u->wst)); fflush(stdout); } -void op_jmp(Uxn *u) { u->ram.ptr = pop16(&u->wst); } -void op_jsr(Uxn *u) { push16(&u->rst, u->ram.ptr); u->ram.ptr = pop16(&u->wst); } +void op_jmp(Uxn *u) { Uint8 a = pop8(&u->wst); u->ram.ptr += getflag(&u->status, FLAG_SIGN) ? (Sint8)a : a; } +void op_jsr(Uxn *u) { Uint8 a = pop8(&u->wst); push16(&u->rst, u->ram.ptr); u->ram.ptr += getflag(&u->status, FLAG_SIGN) ? (Sint8)a : a; } void op_rts(Uxn *u) { u->ram.ptr = pop16(&u->rst); } void op_ldr(Uxn *u) { Uint16 a = pop16(&u->wst); push8(&u->wst, mempeek8(u, a)); } void op_str(Uxn *u) { Uint16 a = pop16(&u->wst); Uint8 b = pop8(&u->wst); mempoke8(u, a, b); } @@ -63,6 +63,8 @@ void op_lth(Uxn *u) { Uint8 a = pop8(&u->wst), b = pop8(&u->wst); push8(&u->wst, /* --- */ void op_lit16(Uxn *u) { u->literal += 2; } void op_nop16(Uxn *u) { printf("%04x\n", pop16(&u->wst)); } +void op_jmp16(Uxn *u) { u->ram.ptr = pop16(&u->wst); } +void op_jsr16(Uxn *u) { push16(&u->rst, u->ram.ptr); u->ram.ptr = pop16(&u->wst); } void op_ldr16(Uxn *u) { Uint16 a = pop16(&u->wst); push16(&u->wst, mempeek16(u, a)); } void op_str16(Uxn *u) { Uint16 a = pop16(&u->wst); Uint16 b = pop16(&u->wst); mempoke16(u, a, b); } void op_and16(Uxn *u) { Uint16 a = pop16(&u->wst), b = pop16(&u->wst); push16(&u->wst, b & a); } @@ -93,7 +95,7 @@ void (*ops[])(Uxn *u) = { op_pop, op_dup, op_swp, op_ovr, op_rot, op_nop, op_wsr, op_rsw, op_add, op_sub, op_mul, op_div, op_equ, op_neq, op_gth, op_lth, /* 16-bit */ - op_brk, op_nop16, op_lit16, op_jmp, op_jsr, op_rts, op_ldr16, op_str16, + op_brk, op_nop16, op_lit16, op_jmp16, op_jsr16, op_rts, op_ldr16, op_str16, op_nop, op_nop, op_nop, op_nop, op_and16, op_xor16, op_rol16, op_ror16, op_pop16, op_dup16, op_swp16, op_ovr16, op_rot16, op_wsr16, op_rsw16, op_nop, op_add16, op_sub16, op_mul16, op_div16, op_equ16, op_neq16, op_gth16, op_lth16