Browse code

Reorganizing operators, again

neauoire authored on 21/03/2021 17:24:44
Showing 3 changed files
... ...
@@ -46,9 +46,9 @@ Program p;
46 46
 
47 47
 char ops[][4] = {
48 48
 	"BRK", "NOP", "LIT", "LDR", "STR", "---", "JMP", "JSR", 
49
-	"EQU", "NEQ", "GTH", "LTH", "AND", "ORA", "EOR", "SFT",
49
+	"EQU", "NEQ", "GTH", "LTH", "GTS", "LTS", "---", "---",
50 50
 	"POP", "DUP", "SWP", "OVR", "ROT", "---", "CLN", "STH",
51
-	"ADD", "SUB", "MUL", "DIV", "---", "---", "GTS", "LTS"
51
+	"ADD", "SUB", "MUL", "DIV", "AND", "ORA", "EOR", "SFT"
52 52
 };
53 53
 
54 54
 int   scin(char *s, char c) { int i = 0; while(s[i]) if(s[i++] == c) return i - 1; return -1; } /* string char index */
... ...
@@ -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/left.usm bin/boot.rom
24 24
 ./bin/emulator bin/boot.rom
... ...
@@ -95,26 +95,26 @@ void op_lts16(Uxn *u) { Uint16 a = pop16(u->src), b = pop16(u->src); push8(u->sr
95 95
 
96 96
 void (*ops[])(Uxn *u) = {
97 97
 	op_brk, op_nop, op_lit, op_ldr, op_str, op_nop, op_jmp, op_jsr, 
98
-	op_equ, op_neq, op_gth, op_lth, op_and, op_ora, op_eor, op_sft, 
98
+	op_equ, op_neq, op_gth, op_lth, op_gts, op_lts, op_nop, op_nop, 
99 99
 	op_pop, op_dup, op_swp, op_ovr, op_rot, op_nop, op_cln, op_sth, 
100
-	op_add, op_sub, op_mul, op_div, op_nop, op_nop, op_gts, op_lts,
100
+	op_add, op_sub, op_mul, op_div, op_and, op_ora, op_eor, op_sft,
101 101
 	/* 16-bit */
102 102
 	op_brk,   op_nop16, op_lit16, op_ldr16, op_str16, op_nop,   op_jmp16, op_jsr16, 
103
-	op_equ16, op_neq16, op_gth16, op_lth16, op_and16, op_ora16, op_eor16, op_sft16, 
103
+	op_equ16, op_neq16, op_gth16, op_lth16, op_gts16, op_lts16, op_nop,   op_nop, 
104 104
 	op_pop16, op_dup16, op_swp16, op_ovr16, op_rot16, op_nop,   op_cln16, op_sth16, 
105
-	op_add16, op_sub16, op_mul16, op_div16, op_nop,   op_nop,   op_gts16,   op_lts16
105
+	op_add16, op_sub16, op_mul16, op_div16, op_and16, op_ora16, op_eor16, op_sft16
106 106
 };
107 107
 
108 108
 Uint8 opr[][4] = { /* wstack-/+ rstack-/+ */
109 109
 	{0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {2,1,0,0}, {3,0,0,0}, {1,0,0,0}, {1,0,0,0}, {1,0,0,2}, 
110
-	{2,1,0,0}, {2,1,0,0}, {2,1,0,0}, {2,1,0,0}, {2,1,0,0}, {2,1,0,0}, {2,1,0,0}, {2,1,0,0},
110
+	{2,1,0,0}, {2,1,0,0}, {2,1,0,0}, {2,1,0,0}, {2,1,0,0}, {2,1,0,0}, {0,0,0,0}, {0,0,0,0},
111 111
 	{1,0,0,0}, {0,2,0,0}, {2,2,0,0}, {2,3,0,0}, {3,3,0,0}, {0,0,0,0}, {0,0,0,1}, {0,1,1,0},
112
-	{2,1,0,0}, {2,1,0,0}, {2,1,0,0}, {2,1,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,2,0,0},
112
+	{2,1,0,0}, {2,1,0,0}, {2,1,0,0}, {2,1,0,0}, {2,1,0,0}, {2,1,0,0}, {2,1,0,0}, {2,1,0,0},
113 113
 	/* 16-bit */
114
-	{0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {2,2,0,0}, {4,0,0,0}, {2,0,0,0}, {2,0,0,0}, {2,0,0,2}, /* TODO */
115
-	{4,2,0,0}, {4,2,0,0}, {4,2,0,0}, {4,2,0,0}, {4,2,0,0}, {4,2,0,0}, {4,2,0,0}, {4,2,0,0}, /* TODO */
116
-	{0,2,0,0}, {0,2,0,0}, {1,1,0,0}, {4,6,0,0}, {6,6,0,0}, {0,0,0,0}, {0,0,0,2}, {0,2,2,0}, /* TODO */
117
-	{4,2,0,0}, {4,2,0,0}, {4,2,0,0}, {4,2,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,2,0,0}
114
+	{0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {2,2,0,0}, {4,0,0,0}, {2,0,0,0}, {2,0,0,0}, {2,0,0,2},
115
+	{4,2,0,0}, {4,2,0,0}, {4,2,0,0}, {4,2,0,0}, {4,1,0,0}, {4,1,0,0}, {0,0,0,0}, {0,0,0,0},
116
+	{0,2,0,0}, {0,2,0,0}, {1,1,0,0}, {4,6,0,0}, {6,6,0,0}, {0,0,0,0}, {0,0,0,2}, {0,2,2,0},
117
+	{4,2,0,0}, {4,2,0,0}, {4,2,0,0}, {4,2,0,0}, {4,2,0,0}, {4,2,0,0}, {4,2,0,0}, {4,2,0,0},
118 118
 };
119 119
 
120 120
 /* clang-format on */