summaryrefslogtreecommitdiff
path: root/sux.h
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2020-05-06 14:10:46 -0400
committermrb0nk500 <b0nk@b0nk.xyz>2020-05-06 14:10:46 -0400
commit11c8d71babb0210d070dd6ab12a255a5fa3159a5 (patch)
treebdd895bb0f6a148445178f46cd67274ca570ca10 /sux.h
parent9ccba5e624319becd9a85822e60b15b6355f19cd (diff)
Removed some duplicate code in the assembler, and made
the processor status register, a union now.
Diffstat (limited to 'sux.h')
-rw-r--r--sux.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/sux.h b/sux.h
index aa0355e..b36c4b1 100644
--- a/sux.h
+++ b/sux.h
@@ -22,8 +22,8 @@ uint8_t subdbg;
WINDOW *scr;
-#define setflag(flag, bit) ((flag)) ? (cpu->ps |= (bit << (thread << 3))) : (cpu->ps &= ~(bit << (thread << 3)))
-#define getflag(bit) (cpu->ps & (bit << (thread << 3)))
+#define setflag(flag, bit) ((flag)) ? (cpu->ps.u8[thread] |= bit) : (cpu->ps.u8[thread] &= ~bit)
+#define getflag(bit) (cpu->ps.u8[thread] & bit)
extern pthread_mutex_t mutex;
extern pthread_mutex_t main_mutex;
@@ -231,7 +231,7 @@ inline void push(struct sux *cpu, uint64_t value, uint8_t opcode, uint8_t thread
case PHB: r.reg = cpu->b[thread]; break;
case PHX: r.reg = cpu->x[thread]; break;
case PHY: r.reg = cpu->y[thread]; break;
- case PHP: r.reg = cpu->ps; break;
+ case PHP: r.reg = cpu->ps.u64; break;
}
/* Unroll Loop by implementing Duff's Device. */
switch (tmp) {
@@ -271,7 +271,7 @@ inline void pull(struct sux *cpu, uint64_t value, uint8_t opcode, uint8_t thread
case PLB: cpu->b[thread] = r.reg; break;
case PLX: cpu->x[thread] = r.reg; break;
case PLY: cpu->y[thread] = r.reg; break;
- case PLP: cpu->ps = r.reg; break;
+ case PLP: cpu->ps.u64 = r.reg; break;
}
}