diff options
author | mrb0nk500 <b0nk@b0nk.xyz> | 2020-07-08 09:23:09 -0400 |
---|---|---|
committer | mrb0nk500 <b0nk@b0nk.xyz> | 2020-07-08 09:23:09 -0400 |
commit | 39081609ec4f1f5d96e15e346eecd09ca2cc9f41 (patch) | |
tree | 02773a838a9d30cf7af441d262f1876c21eaa366 /sux.h | |
parent | 756c606af68be8ccca7aced3b9c3d56fb2d5087f (diff) |
- Simplified some parts of the codebase.
- Fixed some bugs with the push, and pull functions
- Fixed a bug in the assembler.
Diffstat (limited to 'sux.h')
-rw-r--r-- | sux.h | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -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; } |