summaryrefslogtreecommitdiff
path: root/sux.h
diff options
context:
space:
mode:
Diffstat (limited to 'sux.h')
-rw-r--r--sux.h16
1 files changed, 9 insertions, 7 deletions
diff --git a/sux.h b/sux.h
index 77736c4..9ac0ffc 100644
--- a/sux.h
+++ b/sux.h
@@ -95,7 +95,7 @@ static inline uint64_t get_addr(struct sux *cpu, uint64_t *tmpaddr, uint8_t opco
case 1:
case 3: saveaddr.u64 = tmp2 + (int32_t)address.u32[0]; break;
}
- (optype[opcode] != INDY) ? (address.u64 = saveaddr.u64) : (reg = saveaddr.u64);
+ address.u64 = saveaddr.u64;
}
switch (optype[opcode]) {
case ZMX:
@@ -206,18 +206,20 @@ static inline void transfer(struct sux *cpu, uint64_t value, uint8_t opcode, uin
setflag(reg >> 63, N);
}
-static inline void push(struct sux *cpu, uint64_t value, uint8_t prefix, uint8_t thread) {
+static inline void push(struct sux *cpu, uint64_t value, uint8_t size, uint8_t thread) {
union reg reg;
reg.u64 = value;
- setreg(addr, -, (cpu->stk_st << 16)+cpu->sp, reg.u8, +, 0, (1 << ((prefix >> 4) & 3))-1);
- cpu->sp -= (1 << ((prefix >> 4) & 3));
+ uint64_t sbr = (cpu->stk_st << 16);
+ setreg(addr, -, (sbr+cpu->sp), reg.u8, -, size, size);
+ cpu->sp -= size+1;
}
-static inline uint64_t pull(struct sux *cpu, uint8_t prefix, uint8_t thread) {
+static inline uint64_t pull(struct sux *cpu, uint8_t size, uint8_t thread) {
union reg reg;
reg.u64 = 0;
- cpu->sp += (1 << ((prefix >> 4) & 3));
- setreg(reg.u8, +, 0, addr, -, (cpu->stk_st << 16)+cpu->sp, (1 << ((prefix >> 4) & 3))-1);
+ uint64_t sbr = (cpu->stk_st << 16);
+ cpu->sp += size+1;
+ setreg(reg.u8, -, size, addr, -, (sbr+cpu->sp), size);
return reg.u64;
}