commit d9aa276b133d7979a2bfaf8cdd38080d58eacc0a
parent 0c18938e9f11761e25a829c1a60cdbba676316b1
Author: neauoire <aliceffekt@gmail.com>
Date: Fri, 19 Mar 2021 21:22:51 -0700
Better op order for SFT
Diffstat:
3 files changed, 4 insertions(+), 4 deletions(-)
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/noodle.usm bin/boot.rom
+./bin/assembler projects/software/nasu.usm bin/boot.rom
./bin/emulator bin/boot.rom
diff --git a/projects/software/nasu.usm b/projects/software/nasu.usm
@@ -8,7 +8,7 @@
%RTN { JMP2r }
%RTN? { JMP2r? }
-%STEP8 { #0003 SFT2 #0030 SFT2 }
+%STEP8 { #0033 SFT2 }
%++ { #0001 ADD2 }
%2/ { #0001 SFT2 } %2* { #0010 SFT2 }
diff --git a/uxn.c b/uxn.c
@@ -41,7 +41,7 @@ void op_str(Uxn *u) { Uint16 a = pop16(u->src); Uint8 b = pop8(u->src); mempoke8
void op_and(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); push8(u->src, b & a); }
void op_ora(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); push8(u->src, b | a); }
void op_eor(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); push8(u->src, b ^ a); }
-void op_sft(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); Uint8 left = (a & 0xf0) >> 4; Uint8 right = (a & 0x0f); push8(u->src, b << (left % 8) >> (right % 8)); }
+void op_sft(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); Uint8 left = (a & 0xf0) >> 4; Uint8 right = (a & 0x0f); push8(u->src, b >> (right % 8) << (left % 8)); }
/* Stack */
void op_pop(Uxn *u) { pop8(u->src); }
void op_dup(Uxn *u) { push8(u->src, peek8(u->src, 0)); }
@@ -70,7 +70,7 @@ void op_str16(Uxn *u) { Uint16 a = pop16(u->src); Uint16 b = pop16(u->src); memp
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); Uint8 left = (a & 0x00f0) >> 4; Uint8 right = (a & 0x000f); push16(u->src, b << (left % 8) >> (right % 8)); }
+void op_sft16(Uxn *u) { Uint16 a = pop16(u->src), b = pop16(u->src); Uint8 left = (a & 0x00f0) >> 4; Uint8 right = (a & 0x000f); push16(u->src, b >> (right % 16) << (left % 16)); }
/* Stack(16-bits) */
void op_pop16(Uxn *u) { pop16(u->src); }
void op_dup16(Uxn *u) { push16(u->src, peek16(u->src, 0)); }