From ea69dff8a8f0b5eac6480fe9707be29654ec813c Mon Sep 17 00:00:00 2001 From: Andrew Alderwick Date: Sun, 23 May 2021 16:27:15 +0100 Subject: [PATCH] Updated SFT2 to take byte for shift amount --- projects/demos/bifurcan.usm | 2 +- projects/demos/theme.usm | 4 ++-- projects/examples/devices/console.lib.usm | 8 ++++---- projects/examples/devices/controller.keys.usm | 2 +- projects/examples/devices/datetime.usm | 2 +- projects/examples/devices/file.load.usm | 2 +- projects/examples/devices/mouse.usm | 2 +- projects/examples/gui/proportional-font.usm | 2 +- projects/examples/gui/shapes.usm | 2 +- projects/examples/gui/wallpaper.usm | 2 +- projects/software/asma.usm | 2 +- projects/software/left.usm | 2 +- src/uxn.c | 2 +- 13 files changed, 17 insertions(+), 17 deletions(-) diff --git a/projects/demos/bifurcan.usm b/projects/demos/bifurcan.usm index 540b7e8..13aab08 100644 --- a/projects/demos/bifurcan.usm +++ b/projects/demos/bifurcan.usm @@ -107,7 +107,7 @@ RTN ( save-x ) OVR #03 MOD TOS #0008 MUL2 .anchor/x LDZ2 ADD2 .Screen/x DEO2 ( save-y ) OVR #03 DIV TOS #0008 MUL2 .anchor/y LDZ2 ADD2 .Screen/y DEO2 ( get digit* ) OVR STHkr #02 MUL TOS ;digits ADD2 LDA2 - ( get bit ) ROT #0e SWP SUB TOS SFT2 #0001 AND2 + ( get bit ) ROT #0e SWP SUB SFT2 #0001 AND2 ( set tile ) #0008 MUL2 ;tiles ADD2 ( set style ) .style LDZ #10 MUL TOS ADD2 .Screen/addr DEO2 diff --git a/projects/demos/theme.usm b/projects/demos/theme.usm index c1058ff..0b2ca60 100644 --- a/projects/demos/theme.usm +++ b/projects/demos/theme.usm @@ -2,9 +2,9 @@ %RTN { JMP2r } %++ { #0001 ADD2 } -%2/ { #0001 SFT2 } +%2/ { #01 SFT2 } %8+ { #0008 ADD2 } -%STEP8 { #0033 SFT2 } +%STEP8 { #33 SFT2 } ( devices ) diff --git a/projects/examples/devices/console.lib.usm b/projects/examples/devices/console.lib.usm index 119f069..2762fe7 100644 --- a/projects/examples/devices/console.lib.usm +++ b/projects/examples/devices/console.lib.usm @@ -43,10 +43,10 @@ RTN @print-hexadecimal ( short -- ) LIT '0 .Console/char DEO LIT 'x .Console/char DEO - DUP2 #000c SFT2 ,&digit JSR - DUP2 #0008 SFT2 ,&digit JSR - DUP2 #0004 SFT2 ,&digit JSR - ,&digit JSR + DUP2 #0c SFT2 ,&digit JSR + DUP2 #08 SFT2 ,&digit JSR + DUP2 #04 SFT2 ,&digit JSR + ,&digit JSR RTN &digit diff --git a/projects/examples/devices/controller.keys.usm b/projects/examples/devices/controller.keys.usm index 80fde98..62147ca 100644 --- a/projects/examples/devices/controller.keys.usm +++ b/projects/examples/devices/controller.keys.usm @@ -2,7 +2,7 @@ %RTN { JMP2r } %8+ { #0008 ADD2 } -%8* { #0030 SFT2 } +%8* { #30 SFT2 } ( devices ) diff --git a/projects/examples/devices/datetime.usm b/projects/examples/devices/datetime.usm index c62991b..30dad14 100644 --- a/projects/examples/devices/datetime.usm +++ b/projects/examples/devices/datetime.usm @@ -2,7 +2,7 @@ %RTN { JMP2r } %MOD { DUP2 DIV MUL SUB } -%ABS2 { DUP2 #000f SFT2 EQU #04 JCN #ffff MUL2 } +%ABS2 { DUP2 #0f SFT2 EQU #04 JCN #ffff MUL2 } %SCALEX { #0002 DIV2 .Screen/width DEI2 #0002 DIV2 ADD2 #0040 SUB2 } %SCALEY { #0002 DIV2 .Screen/height DEI2 #0002 DIV2 ADD2 #0040 SUB2 } %12HOURS { DUP #0c GTH #0c MUL SUB } diff --git a/projects/examples/devices/file.load.usm b/projects/examples/devices/file.load.usm index 5d30de7..1c257c4 100644 --- a/projects/examples/devices/file.load.usm +++ b/projects/examples/devices/file.load.usm @@ -41,7 +41,7 @@ EQU2k ,&end JCN LDAk DUP #0a EQU ,&linefeed JCN - #00 #0005 SFT2 ;font ADD2 + #0005 SFT2 ;font ADD2 .Screen/addr DEO2 #29 .Screen/color DEO .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2 diff --git a/projects/examples/devices/mouse.usm b/projects/examples/devices/mouse.usm index f114c22..0766132 100644 --- a/projects/examples/devices/mouse.usm +++ b/projects/examples/devices/mouse.usm @@ -1,7 +1,7 @@ ( dev/mouse ) %RTN { JMP2r } -%ABS2 { DUP2 #000f SFT2 EQU #04 JCN #ffff MUL2 } +%ABS2 { DUP2 #0f SFT2 EQU #04 JCN #ffff MUL2 } %LTS2 { #8000 ADD2 SWP2 #8000 ADD2 GTH2 } %GTS2 { #8000 ADD2 SWP2 #8000 ADD2 LTH2 } diff --git a/projects/examples/gui/proportional-font.usm b/projects/examples/gui/proportional-font.usm index 41d18e8..2cdbcd2 100644 --- a/projects/examples/gui/proportional-font.usm +++ b/projects/examples/gui/proportional-font.usm @@ -28,7 +28,7 @@ BRK LDAk DUP #00 EQU ,&end JCN DUP #0a EQU ,&linefeed JCN - #00 #0005 SFT2 ;font ADD2 + #0005 SFT2 ;font ADD2 DUP2 .Screen/addr DEO2 #29 .Screen/color DEO ,get-x-advance JSR .Screen/x DEI2 ADD2 STH2kr ADD2 .Screen/x DEO2 diff --git a/projects/examples/gui/shapes.usm b/projects/examples/gui/shapes.usm index 31b5ec6..24a4058 100644 --- a/projects/examples/gui/shapes.usm +++ b/projects/examples/gui/shapes.usm @@ -4,7 +4,7 @@ %++ { #0001 ADD2 } %-- { #0001 SUB2 } %8+ { #0008 ADD2 } -%ABS2 { DUP2 #000f SFT2 EQU #04 JCN #ffff MUL2 } +%ABS2 { DUP2 #0f SFT2 EQU #04 JCN #ffff MUL2 } %LTS2 { #8000 ADD2 SWP2 #8000 ADD2 GTH2 } %GTS2 { #8000 ADD2 SWP2 #8000 ADD2 LTH2 } diff --git a/projects/examples/gui/wallpaper.usm b/projects/examples/gui/wallpaper.usm index 9dfe6c7..01a869c 100644 --- a/projects/examples/gui/wallpaper.usm +++ b/projects/examples/gui/wallpaper.usm @@ -11,7 +11,7 @@ |0100 ( -> ) #90ff .System/r DEO2 #9000 .System/g DEO2 #900f .System/b DEO2 - #08e0 .Screen/width DEI2 #0001 SFT2 SUB2 .scroll/x STZ2 + #08e0 .Screen/width DEI2 #01 SFT2 SUB2 .scroll/x STZ2 #09b0 .scroll/y STZ2 ;frame .Screen/vector DEO2 #30 .scroll/wait STZ diff --git a/projects/software/asma.usm b/projects/software/asma.usm index 60eedfb..720a595 100644 --- a/projects/software/asma.usm +++ b/projects/software/asma.usm @@ -432,7 +432,7 @@ STAr ,¬-found JCN - ;asma-opcodes/_disasm SUB2 #0003 SFT2 ( 00 byte / end* ) + ;asma-opcodes/_disasm SUB2 #03 SFT2 ( 00 byte / end* ) &loop LDAkr STHr LIT2r 0001 ADD2r ( 00 byte char / end* ) DUP ,¬-end JCN diff --git a/projects/software/left.usm b/projects/software/left.usm index 2ce7904..fa16856 100644 --- a/projects/software/left.usm +++ b/projects/software/left.usm @@ -23,7 +23,7 @@ %RTN? { #00 EQU #02 JCN STH2r JMP2 } %++ { #0001 ADD2 } %-- { #0001 SUB2 } -%8/ { #0003 SFT2 } %8* { #0030 SFT2 } +%8/ { #03 SFT2 } %8* { #30 SFT2 } %8- { #0008 SUB2 } %8+ { #0008 ADD2 } ( devices ) diff --git a/src/uxn.c b/src/uxn.c index 4ec05d6..8603d0f 100644 --- a/src/uxn.c +++ b/src/uxn.c @@ -98,7 +98,7 @@ void op_div16(Uxn *u) { Uint16 a = pop16(u->src), b = pop16(u->src); push16(u->s void op_and16(Uxn *u) { Uint16 a = pop16(u->src), b = pop16(u->src); push16(u->src, b & a); } void op_ora16(Uxn *u) { Uint16 a = pop16(u->src), b = pop16(u->src); push16(u->src, b | a); } void op_eor16(Uxn *u) { Uint16 a = pop16(u->src), b = pop16(u->src); push16(u->src, b ^ a); } -void op_sft16(Uxn *u) { Uint16 a = pop16(u->src), b = pop16(u->src); push16(u->src, b >> (a & 0x000f) << ((a & 0x00f0) >> 4)); } +void op_sft16(Uxn *u) { Uint8 a = pop8(u->src); Uint16 b = pop16(u->src); push16(u->src, b >> (a & 0x0f) << ((a & 0xf0) >> 4)); } void (*ops[])(Uxn *u) = { op_brk, op_lit, op_nop, op_pop, op_dup, op_swp, op_ovr, op_rot,