Browse code

Better op order for SFT

neauoire authored on 20/03/2021 04:22:51
Showing 3 changed files
... ...
@@ -20,5 +20,5 @@ cc -std=c89 -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wextra -Werr
20 20
 # cc uxn.c emulator.c -std=c89 -Os -DNDEBUG -g0 -s -Wall -Wno-unknown-pragmas -L/usr/local/lib -lSDL2 -o bin/emulator
21 21
 
22 22
 # run
23
-./bin/assembler projects/software/noodle.usm bin/boot.rom
23
+./bin/assembler projects/software/nasu.usm bin/boot.rom
24 24
 ./bin/emulator bin/boot.rom
... ...
@@ -8,7 +8,7 @@
8 8
 
9 9
 %RTN   { JMP2r }
10 10
 %RTN?  { JMP2r? }
11
-%STEP8 { #0003 SFT2 #0030 SFT2 }
11
+%STEP8 { #0033 SFT2 }
12 12
 
13 13
 %++ { #0001 ADD2 }
14 14
 %2/ { #0001 SFT2 } %2* { #0010 SFT2 }
... ...
@@ -41,7 +41,7 @@ void op_str(Uxn *u) { Uint16 a = pop16(u->src); Uint8 b = pop8(u->src); mempoke8
41 41
 void op_and(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); push8(u->src, b & a); }
42 42
 void op_ora(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); push8(u->src, b | a); }
43 43
 void op_eor(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); push8(u->src, b ^ a); }
44
-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)); }
44
+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)); }
45 45
 /* Stack */
46 46
 void op_pop(Uxn *u) { pop8(u->src); }
47 47
 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
70 70
 void op_and16(Uxn *u) { Uint16 a = pop16(u->src), b = pop16(u->src); push16(u->src, b & a); }
71 71
 void op_ora16(Uxn *u) { Uint16 a = pop16(u->src), b = pop16(u->src); push16(u->src, b | a); }
72 72
 void op_eor16(Uxn *u) { Uint16 a = pop16(u->src), b = pop16(u->src); push16(u->src, b ^ a); }
73
-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)); }
73
+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)); }
74 74
 /* Stack(16-bits) */
75 75
 void op_pop16(Uxn *u) { pop16(u->src); }
76 76
 void op_dup16(Uxn *u) { push16(u->src, peek16(u->src, 0)); }