summaryrefslogtreecommitdiff
path: root/sux.c
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2020-12-08 10:42:10 -0500
committermrb0nk500 <b0nk@b0nk.xyz>2020-12-08 11:16:13 -0500
commit673efacc37efa90e61eba224efadbb4be863c77b (patch)
tree9b22d4c8b12a5d5b07329df121a13116cb98c4a1 /sux.c
parent96393257a43ac52f2b911594d106741245dec5f0 (diff)
- Implemented support for the Orthogonal extension into
both the assembler, and the emulator. I finally figured out how I could get support for the Ortho extension implemented into the old assembler. The only reason for doing this, is to buy me some while I start work on the new assembler, and to help me get an idea for how to do the same in the new assembler.
Diffstat (limited to 'sux.c')
-rw-r--r--sux.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/sux.c b/sux.c
index ac1f6e2..25bd8c5 100644
--- a/sux.c
+++ b/sux.c
@@ -111,6 +111,7 @@ void *run(void *args) {
uint8_t prefix = 0;
uint8_t ext_prefix = 0;
uint8_t prefix2 = 0;
+ uint8_t op_id = 0;
uint8_t opcode = 0;
union reg address;
union reg value;
@@ -177,17 +178,23 @@ void *run(void *args) {
pthread_mutex_unlock(&mutex);
#endif
#endif
- uint32_t instr = read_value(cpu, 0, cpu->pc, 3, 1, 0);
+ uint32_t instr = read_value(cpu, 0, cpu->pc, 4, 1, 0);
uint8_t *tmp_inst = (uint8_t *)&instr;
- prefix = ((instr & 3) == 3) ? *tmp_inst++ : 0;
- ext_prefix = ((*tmp_inst & 0xF) == 0xD) ? *tmp_inst++ : 0;
- opcode = *tmp_inst;
- cpu->pc += ((instr & 3) == 3)+((ext_prefix & 0xF) == 0xD)+1;
+ uint8_t inst_len = 0;
+ prefix = ((instr & 3) == 3) ? tmp_inst[inst_len++] : 0;
+ ext_prefix = ((tmp_inst[inst_len] & 0xF) == 0xD) ? tmp_inst[inst_len++] : 0;
+ opcode = tmp_inst[inst_len++];
+ op_id = (ext_prefix == 0x1D) ? tmp_inst[inst_len++] : 0;
+
+ cpu->pc += inst_len;
address.u64 = cpu->pc;
+ uint8_t operand_type[2];
uint8_t am;
+ uint8_t ortho_id[2];
uint8_t ext_id = 0;
uint8_t tmp_opcode = opcode;
uint8_t tmp_ext_prefix = ext_prefix;
+ int is_ortho = 0;
if (ext_prefix) {
ext_id = (ext_prefix >> 4);
switch (ext_id) {
@@ -227,6 +234,14 @@ void *run(void *args) {
}
}
break;
+ case 0x1:
+ operand_type[0] = ((opcode & 0x10) >> 4);
+ operand_type[1] = ((opcode & 0x08) >> 3);
+ ortho_id[0] = op_id >> 4;
+ ortho_id[1] = op_id & 0x0F;
+ am = IMPL;
+ is_ortho = 1;
+ break;
}
} else {
am = optype[opcode];
@@ -238,7 +253,7 @@ void *run(void *args) {
#if keypoll
pthread_mutex_lock(&mutex);
#endif
- disasm(cpu, lines, opcode, prefix, ext_prefix, prefix2, thread);
+ disasm(cpu, lines, opcode, prefix, ext_prefix, prefix2, operand_type, ortho_id, thread);
lines+=1;
#if keypoll
pthread_mutex_unlock(&mutex);
@@ -261,6 +276,7 @@ void *run(void *args) {
uint8_t tmp = 0;
switch (ext_id) {
case 0x0: exec_ext_inst(cpu, opcode, prefix, value.u64, address.u64, size, thread); break;
+ case 0x1: exec_ortho_inst(cpu, opcode, prefix, size, operand_type, ortho_id, thread); break;
}
} else {
exec_base_inst(cpu, opcode, prefix, value.u64, address.u64, size, thread);