summaryrefslogtreecommitdiff
path: root/disasm.c
diff options
context:
space:
mode:
Diffstat (limited to 'disasm.c')
-rw-r--r--disasm.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/disasm.c b/disasm.c
index 3645ec3..707e237 100644
--- a/disasm.c
+++ b/disasm.c
@@ -3,7 +3,7 @@
#include <string.h>
void disasm(struct sux *cpu, uint8_t lines, uint8_t opcode, uint8_t prefix, uint8_t thread) {
- union reg value;
+ uint64_t value;
uint64_t address = get_addr(cpu, opcode, prefix, 0, 0, thread);
uint8_t rs = (prefix >> 4) & 3;
char *postfix;
@@ -58,29 +58,29 @@ void disasm(struct sux *cpu, uint8_t lines, uint8_t opcode, uint8_t prefix, uint
value = read_value(cpu, cpu->pc, addrsize, 0, 0);
if ((prefix >> 6) == 1 || (prefix >> 6) == 2 || optype[opcode] == REL) {
switch (addrsize) {
- case 0 : sign = ((int8_t )value.u8 [0] < 0) ? "-" : "+"; break;
- case 1 : sign = ((int16_t)value.u16[0] < 0) ? "-" : "+"; break;
+ case 0 : sign = ((int8_t )value < 0) ? "-" : "+"; break;
+ case 1 : sign = ((int16_t)value < 0) ? "-" : "+"; break;
case 2 :
- case 3 : sign = ((int32_t)value.u32[0] < 0) ? "-" : "+"; break;
+ case 3 : sign = ((int32_t)value < 0) ? "-" : "+"; break;
case 4 :
case 5 :
case 6 :
- case 7 : sign = ((int64_t)value.u64 < 0) ? "-" : "+"; break;
+ case 7 : sign = ((int64_t)value < 0) ? "-" : "+"; break;
}
- value.u64 &= mask.u64;
+ value &= mask.u64;
}
switch (optype[opcode]) {
case BREG:
case IMPL: wprintw(scr, "%s%s" , opname[opcode], postfix); break;
- case IMM : wprintw(scr, "%s%s #$%0*"PRIX64 , op, postfix, (addrsize+1) << 1, value.u64); break;
+ case IMM : wprintw(scr, "%s%s #$%0*"PRIX64 , op, postfix, (addrsize+1) << 1, value); break;
case IND :
case INDX:
case INDY: ind = "("; /* Falls through. */
case ZMX :
case ZMY :
case ZM :
- case ABS : wprintw(scr, "%s%s %s%s%s$%0*" PRIX64"%s" , op, postfix, ind, of, sign, (addrsize+1) << 1, value.u64, idx); break;
- case REL : wprintw(scr, "%s%s %s$%0*"PRIX64 , op, postfix, sign, (addrsize+1) << 1, value.u64); break;
+ case ABS : wprintw(scr, "%s%s %s%s%s$%0*" PRIX64"%s" , op, postfix, ind, of, sign, (addrsize+1) << 1, value, idx); break;
+ case REL : wprintw(scr, "%s%s %s$%0*"PRIX64 , op, postfix, sign, (addrsize+1) << 1, value); break;
}
if (address == TX_ADDR || address == RX_ADDR) {
@@ -100,18 +100,18 @@ void disasm(struct sux *cpu, uint8_t lines, uint8_t opcode, uint8_t prefix, uint
uint32_t adr;
if (address == CTRL_ADDR || addr[STEP_ADDR]) {
adr = 0x30000;
- wprintw(scr, ", scr_row: %02u, scr_col: %02u, scr_str: %02u, scr_end: %02u", addr[0], addr[1], addr[0x22], addr[0x23]);
+ wprintw(scr, ", scr_row: %02u, scr_col: %02u, scr_str: %02u, scr_end: %02u", addr[0], addr[1], addr[2], addr[3]);
wmove(scr, 32, 0);
wprintw(scr, "bitabl: ");
for (uint8_t i = 0; i < 16; i++) {
- wprintw(scr, "%02X", addr[adr+i]);
+ wprintw(scr, "%s", showbits(addr[adr+i], 7, 0));
}
mvwprintw(scr, ln++, 0, "buffer: ");
wmove(scr, ln++, 0);
uint8_t maxrow = 10;
int line_offset = (addr[0]-(maxrow-1) >= 0) ? addr[0]-(maxrow-1) : 0;
for (uint8_t i = 0; i < maxrow; i++) {
- line_idx = (i+addr[0x22]+line_offset << 6) + (i+addr[0x22]+line_offset << 4);
+ line_idx = (i+addr[2]+line_offset << 6) + (i+addr[2]+line_offset << 4);
for (uint8_t j = 0; j < 0x50; j++) {
wprintw(scr, "%02X", addr[tmpad+j+line_idx]);
if ((addr[0] == i+line_offset) && addr[1] == j) {