From 11c8d71babb0210d070dd6ab12a255a5fa3159a5 Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Wed, 6 May 2020 14:10:46 -0400 Subject: Removed some duplicate code in the assembler, and made the processor status register, a union now. --- sux.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'sux.c') diff --git a/sux.c b/sux.c index 1299432..3c84425 100644 --- a/sux.c +++ b/sux.c @@ -102,10 +102,10 @@ void *run(void *args) { , cpu->y[thread]); wprintw(scr, ", sp: $%04X" - ", ps: $%02"PRIX64 + ", ps: $%02X" ", inst: " , cpu->sp[thread] - , cpu->ps); + , cpu->ps.u8[thread]); #if keypoll pthread_mutex_unlock(&mutex); #endif @@ -148,7 +148,7 @@ void *run(void *args) { #endif switch(opcode) { case CPS: /* Clear Processor Status. */ - cpu->ps = 0; + cpu->ps.u64 = 0; break; case AAB: /* Add Accumulator with carry by B register. */ value.u64 = cpu->b[thread]; /* Falls Through. */ @@ -461,8 +461,8 @@ void *run(void *args) { case NOP: /* No OPeration. */ break; case RTI: /* ReTurn from Interrupt routine. */ - cpu->sp[thread] +=1; - cpu->ps = addr[(cpu->stk_st[thread] << 16)+(cpu->sp[thread])] << (thread << 3); /* Falls through. */ + cpu->sp[thread] += 1; + cpu->ps.u8[thread] = addr[(cpu->stk_st[thread] << 16)+(cpu->sp[thread])]; /* Falls through. */ case RTS: /* ReTurn from Subroutine. */ case RTL: /* ReTurn from subroutine Long. */ cpu->sp[thread] += 8; @@ -500,7 +500,7 @@ void *run(void *args) { addr[(cpu->stk_st[thread] << 16)+cpu->sp[thread]-5] = value.u8[2]; addr[(cpu->stk_st[thread] << 16)+cpu->sp[thread]-6] = value.u8[1]; addr[(cpu->stk_st[thread] << 16)+cpu->sp[thread]-7] = value.u8[0]; - addr[(cpu->stk_st[thread] << 16)+(cpu->sp[thread]-8)] = (uint64_t)cpu->ps >> (thread << 3); + addr[(cpu->stk_st[thread] << 16)+cpu->sp[thread]-8] = cpu->ps.u8[thread]; cpu->sp[thread] -= 9; setflag(1, I); if (opcode == BRK) { -- cgit v1.2.3-13-gbd6f