summaryrefslogtreecommitdiff
path: root/sux.h
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2020-05-18 13:14:08 -0400
committermrb0nk500 <b0nk@b0nk.xyz>2020-05-18 13:14:08 -0400
commit5dd788d5a1acc7f23835882420d50e9f020728ac (patch)
tree2b9226863fc44e5bce88eb85be1f0ee97ede1922 /sux.h
parent545bb8591e8003912b6c6b494acefd74e6b3abfd (diff)
Did alot of stuff while I was up at the family trailer.
- Moved the large enums, and large tables into separate header files. - Added enums for implementing the base extension - Fixed a bug in the assembler. - Worked more on SuBAsm.
Diffstat (limited to 'sux.h')
-rw-r--r--sux.h24
1 files changed, 14 insertions, 10 deletions
diff --git a/sux.h b/sux.h
index b36c4b1..3554011 100644
--- a/sux.h
+++ b/sux.h
@@ -14,13 +14,14 @@
#define STEP_ADDR 0xC010
#define CURSES_BACKSPACE 0x7F
-uint8_t kbd_rdy;
+extern uint8_t kbd_rdy;
+
+extern WINDOW *scr;
#if debug
-uint8_t subdbg;
+extern uint8_t subdbg;
#endif
-WINDOW *scr;
#define setflag(flag, bit) ((flag)) ? (cpu->ps.u8[thread] |= bit) : (cpu->ps.u8[thread] &= ~bit)
#define getflag(bit) (cpu->ps.u8[thread] & bit)
@@ -171,6 +172,9 @@ static inline uint64_t get_addr(struct sux *cpu, uint64_t *tmpaddr, uint8_t opco
address.u8[1] = addr[cpu->pc[thread]+1];++tmp;
}
cpu->pc[thread]+=tmp;
+ #if getclk
+ iclk++;
+ #endif
break;
}
@@ -224,7 +228,7 @@ inline void push(struct sux *cpu, uint64_t value, uint8_t opcode, uint8_t thread
uint8_t byte[8];
} r;
r.reg = 0;
- uint8_t size = ((int8_t)value >= 0) ? value-1 : 0;
+ uint8_t size = (value > 0) ? value-1 : 0;
uint8_t tmp = (size <= 7) ? size : 7;
switch (opcode) {
case PHA: r.reg = cpu->a[thread]; break;
@@ -252,7 +256,7 @@ inline void pull(struct sux *cpu, uint64_t value, uint8_t opcode, uint8_t thread
uint8_t byte[8];
} r;
r.reg = 0;
- uint8_t size = ((int8_t)value >= 0) ? value-1 : 0;
+ uint8_t size = (value > 0) ? value-1 : 0;
uint8_t tmp = (size <= 7) ? size : 7;
uint8_t tmp2 = 0;
/* Unroll Loop by implementing Duff's Device. */
@@ -267,11 +271,11 @@ inline void pull(struct sux *cpu, uint64_t value, uint8_t opcode, uint8_t thread
case 1: cpu->sp[thread]++;tmp2++;r.byte[tmp2] |= addr[(cpu->stk_st[thread] << 16)+cpu->sp[thread]];
}
switch (opcode) {
- case PLA: cpu->a[thread] = r.reg; break;
- 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.u64 = r.reg; break;
+ case PLA: cpu->a[thread] = r.reg; break;
+ 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.u64 = r.reg; break;
}
}