summaryrefslogtreecommitdiff
path: root/sux.c
diff options
context:
space:
mode:
Diffstat (limited to 'sux.c')
-rw-r--r--sux.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/sux.c b/sux.c
index 4ccd2d5..ac1f6e2 100644
--- a/sux.c
+++ b/sux.c
@@ -97,7 +97,9 @@ uint8_t is_extop(uint8_t opcode, uint8_t dbg) {
case STY_E:
case STA_E:
case STB_E:
- case STX_E: return 0;
+ case STX_E:
+ case JMP_E:
+ case JSR_E: return 0;
}
return 1;
}
@@ -178,16 +180,16 @@ void *run(void *args) {
uint32_t instr = read_value(cpu, 0, cpu->pc, 3, 1, 0);
uint8_t *tmp_inst = (uint8_t *)&instr;
prefix = ((instr & 3) == 3) ? *tmp_inst++ : 0;
- ext_prefix = ((*tmp_inst & 0xD) == 0xD) ? *tmp_inst++ : 0;
+ ext_prefix = ((*tmp_inst & 0xF) == 0xD) ? *tmp_inst++ : 0;
opcode = *tmp_inst;
- cpu->pc += ((instr & 3) == 3)+((ext_prefix & 0xD) == 0xD)+1;
+ cpu->pc += ((instr & 3) == 3)+((ext_prefix & 0xF) == 0xD)+1;
address.u64 = cpu->pc;
uint8_t am;
uint8_t ext_id = 0;
uint8_t tmp_opcode = opcode;
uint8_t tmp_ext_prefix = ext_prefix;
if (ext_prefix) {
- ext_id = ((ext_prefix >> 4) & 0xF);
+ ext_id = (ext_prefix >> 4);
switch (ext_id) {
case 0x0:
am = ext_optype[opcode];
@@ -220,6 +222,8 @@ void *run(void *args) {
case STA_E: tmp_opcode = STA_Z; break;
case STB_E: tmp_opcode = STB_Z; break;
case STX_E: tmp_opcode = STX_Z; break;
+ case JMP_E: tmp_opcode = JMP_Z; break;
+ case JSR_E: tmp_opcode = JSR_Z; break;
}
}
break;
@@ -246,7 +250,7 @@ void *run(void *args) {
addr[STEP_ADDR] = 1;
step = 1;
}*/
- if (isrw(opcode) && am != REL && isread(opcode)) {
+ if (isrw(opcode, ext_prefix) && am != REL && isread(opcode, ext_prefix)) {
value.u64 = read_value(cpu, 0, address.u64, size, 1, check_io);
}
}
@@ -254,12 +258,14 @@ void *run(void *args) {
ext_prefix = tmp_ext_prefix;
opcode = tmp_opcode;
if (ext_prefix) {
+ uint8_t tmp = 0;
switch (ext_id) {
- case 0x0: exec_ext_inst(cpu, opcode, prefix, value, address, size, thread); break;
+ case 0x0: exec_ext_inst(cpu, opcode, prefix, value.u64, address.u64, size, thread); break;
}
} else {
- exec_base_inst(cpu, opcode, prefix, value, address, size, thread);
+ exec_base_inst(cpu, opcode, prefix, value.u64, address.u64, size, thread);
}
+ //usleep(1);
#if !IO
ins++;
#endif