Reorganizing operators, again

This commit is contained in:
neauoire 2021-03-21 10:24:44 -07:00
parent ac76a7ca8b
commit c9a64edf7b
3 changed files with 13 additions and 13 deletions

View File

@ -46,9 +46,9 @@ Program p;
char ops[][4] = {
"BRK", "NOP", "LIT", "LDR", "STR", "---", "JMP", "JSR",
"EQU", "NEQ", "GTH", "LTH", "AND", "ORA", "EOR", "SFT",
"EQU", "NEQ", "GTH", "LTH", "GTS", "LTS", "---", "---",
"POP", "DUP", "SWP", "OVR", "ROT", "---", "CLN", "STH",
"ADD", "SUB", "MUL", "DIV", "---", "---", "GTS", "LTS"
"ADD", "SUB", "MUL", "DIV", "AND", "ORA", "EOR", "SFT"
};
int scin(char *s, char c) { int i = 0; while(s[i]) if(s[i++] == c) return i - 1; return -1; } /* string char index */

View File

@ -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/left.usm bin/boot.rom
./bin/emulator bin/boot.rom

20
uxn.c
View File

@ -95,26 +95,26 @@ void op_lts16(Uxn *u) { Uint16 a = pop16(u->src), b = pop16(u->src); push8(u->sr
void (*ops[])(Uxn *u) = {
op_brk, op_nop, op_lit, op_ldr, op_str, op_nop, op_jmp, op_jsr,
op_equ, op_neq, op_gth, op_lth, op_and, op_ora, op_eor, op_sft,
op_equ, op_neq, op_gth, op_lth, op_gts, op_lts, op_nop, op_nop,
op_pop, op_dup, op_swp, op_ovr, op_rot, op_nop, op_cln, op_sth,
op_add, op_sub, op_mul, op_div, op_nop, op_nop, op_gts, op_lts,
op_add, op_sub, op_mul, op_div, op_and, op_ora, op_eor, op_sft,
/* 16-bit */
op_brk, op_nop16, op_lit16, op_ldr16, op_str16, op_nop, op_jmp16, op_jsr16,
op_equ16, op_neq16, op_gth16, op_lth16, op_and16, op_ora16, op_eor16, op_sft16,
op_equ16, op_neq16, op_gth16, op_lth16, op_gts16, op_lts16, op_nop, op_nop,
op_pop16, op_dup16, op_swp16, op_ovr16, op_rot16, op_nop, op_cln16, op_sth16,
op_add16, op_sub16, op_mul16, op_div16, op_nop, op_nop, op_gts16, op_lts16
op_add16, op_sub16, op_mul16, op_div16, op_and16, op_ora16, op_eor16, op_sft16
};
Uint8 opr[][4] = { /* wstack-/+ rstack-/+ */
{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},
{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},
{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},
{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},
{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},
{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},
/* 16-bit */
{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 */
{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 */
{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 */
{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}
{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},
{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},
{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},
{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},
};
/* clang-format on */