summaryrefslogtreecommitdiff
path: root/sux.h
diff options
context:
space:
mode:
Diffstat (limited to 'sux.h')
-rw-r--r--sux.h21
1 files changed, 5 insertions, 16 deletions
diff --git a/sux.h b/sux.h
index 744a2cc..5bfdb44 100644
--- a/sux.h
+++ b/sux.h
@@ -141,8 +141,8 @@ static inline void write_value(struct sux *cpu, uint64_t value, uint64_t address
static inline uint64_t offset_addr(struct sux *cpu, uint64_t offset, uint8_t size, uint8_t inc_clk, uint8_t prefix) {
uint64_t of;
switch (prefix >> 6) {
- case 1: of = ((cpu->stk_st << 16) | cpu->sp); break;
- case 2: of = cpu->pc ; break;
+ case 1: of = cpu->sp; break;
+ case 2: of = cpu->pc; break;
}
#if getclk
cpu->clk += inc_clk;
@@ -278,30 +278,19 @@ static inline uint64_t adc(struct sux *cpu, uint64_t reg, uint64_t value, uint8_
return sum;
}
-static inline uint64_t transfer(struct sux *cpu, uint64_t src, uint64_t value, uint8_t opcode, uint8_t prefix, uint8_t thread) {
- switch (opcode) {
- case TXS_IMM:
- if (prefix == 0x13 && (value == thread+1 || value > 8)) {
- cpu->stk_st = value & 0xFF;
- cpu->stk_st += value << 16;
- cpu->pc+=2;
- }
- default: break;
- }
+static inline uint64_t transfer(struct sux *cpu, uint64_t src, uint64_t value, uint8_t thread) {
setflag(src == 0, Z);
setflag(src >> 63, N);
return src;
}
static inline void push(struct sux *cpu, uint64_t value, uint8_t size, uint8_t thread) {
- uint64_t sbr = (cpu->stk_st << 16);
- write_value(cpu, value, (sbr+cpu->sp)-size, size, 1, 0);
+ write_value(cpu, value, cpu->sp-size, size, 1, 0);
cpu->sp -= size+1;
}
static inline uint64_t pull(struct sux *cpu, uint8_t size, uint8_t thread) {
- uint64_t sbr = (cpu->stk_st << 16);
- uint64_t value = read_value(cpu, 0, sbr+cpu->sp+1, size, 1, 0);
+ uint64_t value = read_value(cpu, 0, cpu->sp+1, size, 1, 0);
cpu->sp += size+1;
return value;
}