uxn

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

commit 997675e03137290b7d37b9e30a5150f12aee90df
parent a24e23154c67549a0cb05e161ad0f3dc050a2cf2
Author: neauoire <aliceffekt@gmail.com>
Date:   Tue,  2 Mar 2021 21:35:48 -0800

Fixed issue with shift left

Diffstat:
Mexamples/app.pattern.usm | 44+++++++++++++++++++-------------------------
Muxn.c | 4++--
2 files changed, 21 insertions(+), 27 deletions(-)

diff --git a/examples/app.pattern.usm b/examples/app.pattern.usm @@ -23,14 +23,18 @@ |0100 @RESET - ,pattern =editor.addr - #0030 =window.x1 #0030 =window.y1 #00b0 =window.x2 #0090 =window.y2 + #0030 =window.x1 #0030 =window.y1 #00a8 =window.x2 #0090 =window.y2 - #0040 =editor.x1 #0040 =editor.y + #0040 =editor.y ( TODO: Remove ) - ,draw-window JSR + ~window.x1 #0010 ADD2 =editor.x1 + ~window.y1 #0010 ADD2 =editor.y1 + + ( starting addr ) + ,pattern =editor.addr - #0040 #0040 #01 ,draw-editor JSR + ,draw-window JSR + ,draw-editor JSR BRK @@ -41,13 +45,13 @@ BRK ,no-ctrl-up ~dev/ctrl.buttons #10 EQU JMP? POP2 ~editor.addr #0001 ADD2 =editor.addr ,draw-window JSR - ,redraw JSR + ,draw-editor JSR @no-ctrl-up ,no-ctrl-down ~dev/ctrl.buttons #20 EQU JMP? POP2 ~editor.addr #0001 SUB2 =editor.addr ,draw-window JSR - ,redraw JSR + ,draw-editor JSR @no-ctrl-down @no-ctrl @@ -60,7 +64,7 @@ BRK ( save ) ~editor.addr ~dev/mouse.y ~editor.y1 SUB2 #0008 DIV2 ADD2 STR ,draw-window JSR - ,redraw JSR + ,draw-editor JSR @no-click @@ -70,30 +74,19 @@ BRK @draw-window - #0000 #0000 ~dev/screen.width ~dev/screen.height #03 ~editor.addr ,tile-rect JSR - - ~window.x1 #0001 SUB2 ~window.y1 #0001 SUB2 ~window.x2 ~window.y2 #01 ,line-rect JSR - ~window.x1 ~window.y1 ~window.x2 ~window.y2 #02 ,fill-rect JSR - ~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 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 RTS @draw-editor - =color DUP2 =dev/sprite.y =editor.y1 DUP2 =dev/sprite.x =editor.x1 - - ,redraw JSR - -RTS - -@redraw - ~editor.x1 =dev/sprite.x ~editor.y1 =dev/sprite.y ~editor.addr =dev/sprite.addr - #02 =color - #00 =pixel.y @redraw-ver #00 =pixel.x @@ -118,6 +111,7 @@ RTS ~window.x2 #0008 SUB2 =dev/sprite.x ( 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 @@ -285,4 +279,4 @@ RTS |FF50 ;dev/mouse Mouse |FFF0 .RESET .FRAME .ERROR ( vectors ) -|FFF8 [ 0ff4 0f04 0ff4 ] ( palette ) -\ No newline at end of file +|FFF8 [ 0fcf 0fc4 0fc4 ] ( palette ) +\ No newline at end of file diff --git a/uxn.c b/uxn.c @@ -42,7 +42,7 @@ void op_str(Uxn *u) { Uint16 a = pop16(&u->wst); Uint8 b = pop8(&u->wst); mempok /* Logic */ void op_and(Uxn *u) { Uint8 a = pop8(&u->wst), b = pop8(&u->wst); push8(&u->wst, b & a); } void op_xor(Uxn *u) { Uint8 a = pop8(&u->wst), b = pop8(&u->wst); push8(&u->wst, b | a); } -void op_rol(Uxn *u) { Uint8 a = pop8(&u->wst), b = pop8(&u->wst); push8(&u->wst, b << a); } +void op_rol(Uxn *u) { Uint8 a = pop8(&u->wst), b = pop8(&u->wst); push8(&u->wst, b << (a % 8)); } void op_ror(Uxn *u) { Uint8 a = pop8(&u->wst), b = pop8(&u->wst); push8(&u->wst, b >> a); } /* Stack */ void op_pop(Uxn *u) { pop8(&u->wst); } @@ -68,7 +68,7 @@ void op_ldr16(Uxn *u) { Uint16 a = pop16(&u->wst); push16(&u->wst, mempeek16(u, 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); } void op_xor16(Uxn *u) { Uint16 a = pop16(&u->wst), b = pop16(&u->wst); push16(&u->wst, b ^ a); } -void op_rol16(Uxn *u) { Uint16 a = pop16(&u->wst), b = pop16(&u->wst); push16(&u->wst, b << a); } +void op_rol16(Uxn *u) { Uint16 a = pop16(&u->wst), b = pop16(&u->wst); push16(&u->wst, b << (a % 16)); } void op_ror16(Uxn *u) { Uint16 a = pop16(&u->wst), b = pop16(&u->wst); push16(&u->wst, b >> a); } /* Stack(16-bits) */ void op_pop16(Uxn *u) { pop16(&u->wst); }