diff options
author | mrb0nk500 <b0nk@b0nk.xyz> | 2020-10-04 18:22:00 -0400 |
---|---|---|
committer | mrb0nk500 <b0nk@b0nk.xyz> | 2020-10-04 18:22:00 -0400 |
commit | ca8e2f93acc794b00464c5513956bd84de258913 (patch) | |
tree | 83153822fdea777bd11a8254c0e4bd87fe1d8350 /disasm.c | |
parent | 784ff59108b887e246b0f33ff696dfd981659ab2 (diff) |
- Added support for reading, and writing outside the
emulator's memory.
All reads outside of the emulator's memory give back
$/0xFF bytes, while all writes outside of the
emulator's memory are ignored.
- Implemented malloc(), and free() in the SuB Suite.
In order to do this, I had to add support for a heap,
which I did by reserving the first 3 banks of the
address space (the first 192K), and by adding a
routine that finds the end of the RAM.
In this case, I set the starting address for the
routine at bank 3 (bank 4 with one indexing), but,
the routine's starting address isn't hardcoded, and
thus, any starting address can be passed as an
argument.
The routine uses the fact that we can now read/write
outside the emulator's memory, and also uses the
fact that writing outside the emulator's memory will
be ignored, and that reading outside the emulator's
memory will always read $/0xFF bytes, and uses that
to signal that it's reached the end of the RAM.
- Added a test program for getting the size of RAM
starting at address $/0x20000.
Diffstat (limited to 'disasm.c')
-rw-r--r-- | disasm.c | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -107,14 +107,15 @@ void disasm(struct sux *cpu, uint8_t lines, uint8_t opcode, uint8_t prefix, uint if (subdbg) { uint8_t ln = 33; uint16_t line_idx = 0; - uint32_t tmpad = 0x31000; + uint32_t tmpad = 0x20237; int row, col; uint8_t iscursor = 0; union reg ptr; ptr.u64 = 0; uint32_t adr; if (address == CTRL_ADDR || addr[STEP_ADDR]) { - adr = 0x30000; + adr = read_value(cpu, 0, tmpad, 7, 0, 0); + tmpad += 8; 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: "); @@ -125,10 +126,11 @@ void disasm(struct sux *cpu, uint8_t lines, uint8_t opcode, uint8_t prefix, uint wmove(scr, ln++, 0); uint8_t maxrow = 10; int line_offset = (addr[0]-(maxrow-1) >= 0) ? addr[0]-(maxrow-1) : 0; + adr = read_value(cpu, 0, tmpad, 7, 0, 0); for (uint8_t i = 0; i < maxrow; i++) { 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]); + wprintw(scr, "%02X", addr[adr+j+line_idx]); if ((addr[0] == i+line_offset) && addr[1] == j) { iscursor=1; getyx(scr,row, col); @@ -183,7 +185,7 @@ void disasm(struct sux *cpu, uint8_t lines, uint8_t opcode, uint8_t prefix, uint wmove(scr, 31, 0); wclrtoeol(scr); - adr = 0x204CA; + adr = 0x200CA; ptr.u64 = read_value(cpu, 0, adr, 3, 0, 0); wprintw(scr, "t_id: $%02X", ptr.u8[0]); wprintw(scr, ", t_type: $%02X", ptr.u8[1]); @@ -209,7 +211,8 @@ void disasm(struct sux *cpu, uint8_t lines, uint8_t opcode, uint8_t prefix, uint wprintw(scr, " d: $%02X,", addr[0x0D]); wprintw(scr, " e: $%02X,", addr[0x0E]); wprintw(scr, " f: $%02X", addr[0x0F]); - tmpad = 0x33000; + tmpad += 8; + adr = read_value(cpu, 0, tmpad, 7, 0, 0); line_idx = 0; wprintw(scr, "cmd_buf:"); for (uint8_t i = 0; i < 1; i++) { @@ -217,7 +220,7 @@ void disasm(struct sux *cpu, uint8_t lines, uint8_t opcode, uint8_t prefix, uint wclrtoeol(scr); line_idx = (i << 4)+(i << 6); for (uint8_t j = 0; j < 0x50; j++) { - wprintw(scr, "%02X", addr[tmpad+j+line_idx]); + wprintw(scr, "%02X", addr[adr+j+line_idx]); } wprintw(scr, ", i: %02X", i); }*/ |