summaryrefslogtreecommitdiff
path: root/sux.c
diff options
context:
space:
mode:
Diffstat (limited to 'sux.c')
-rw-r--r--sux.c30
1 files changed, 12 insertions, 18 deletions
diff --git a/sux.c b/sux.c
index f1b07df..daabdc2 100644
--- a/sux.c
+++ b/sux.c
@@ -218,17 +218,12 @@ void *run(void *args) {
pthread_mutex_unlock(&mutex);
#endif
#endif
- prefix = addr[cpu->pc];
- if ((prefix & 0x03) != 0x03) {
- prefix = 0;
- }
- cpu->pc += ((prefix & 0x03) == 0x03);
- opcode = addr[cpu->pc];
- ++cpu->pc;
+ uint16_t instr = read_value(cpu, 0, cpu->pc, 1, 1, 0);
+ uint8_t *tmp_inst = (uint8_t *)&instr;
+ prefix = ((instr & 3) == 3) ? *tmp_inst++ : 0;
+ opcode = *tmp_inst;
+ cpu->pc += ((instr & 3) == 3)+1;
address.u64 = cpu->pc;
- #if getclk
- ++cpu->clk;
- #endif
uint8_t am = optype[opcode];
uint8_t rs = (prefix >> 4) & 3;
uint8_t size = (/***/1 << rs) - 1;
@@ -246,15 +241,15 @@ void *run(void *args) {
#endif
if (am != IMPL && am != BREG) {
address.u64 = get_addr(cpu, opcode, prefix, 1, 1, thread);
- if (address.u64 > mem_size-1) {
+ /*if (address.u64 > mem_size-1) {
addr[STEP_ADDR] = 1;
step = 1;
- }
+ }*/
if (isrw(opcode) && am != REL && isread(opcode)) {
value.u64 = read_value(cpu, 0, address.u64, size, 1, check_io);
}
}
- switch(opcode) {
+ switch (opcode) {
case CPS_IMP: /* Clear Processor Status. */
cpu->ps.u64 = 0;
break;
@@ -563,16 +558,15 @@ void *run(void *args) {
default:
break;
}
- /*if (cpu->pc <= 0xFF) {
- step = 1;
- wrefresh(scr);
- }*/
#if !IO
ins++;
#endif
#if !bench
if (step) {
- int c = 0;;
+ int c = 0;
+ #if debug
+ wrefresh(scr);
+ #endif
for (; step && c != 19 && !end; c = get_key(scr));
#if debug
wrefresh(scr);