summaryrefslogtreecommitdiff
path: root/debug.c
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2015-07-26 13:25:31 -0700
committerMichael Pavone <pavone@retrodev.com>2015-07-26 13:25:31 -0700
commit3372e57c62e3ff5f93c5541ef5b969229d132463 (patch)
treedf1a91e13ebef01d2ad636bd940c7e514a6919ff /debug.c
parent4755aa94deb0a8fb90bf74033d370e9370d69ca2 (diff)
parentbee8b42029900ca034675c54d98813a61ca4407a (diff)
Merge
Diffstat (limited to 'debug.c')
-rw-r--r--debug.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/debug.c b/debug.c
index 74e076b..5fedb73 100644
--- a/debug.c
+++ b/debug.c
@@ -7,6 +7,8 @@
#include <sys/select.h>
#endif
#include "render.h"
+#include "util.h"
+#include "terminal.h"
static bp_def * breakpoints = NULL;
static bp_def * zbreakpoints = NULL;
@@ -286,6 +288,7 @@ z80_context * zdebugger(z80_context * context, uint16_t address)
static uint16_t branch_t;
static uint16_t branch_f;
z80inst inst;
+ init_terminal();
//Check if this is a user set breakpoint, or just a temporary one
bp_def ** this_bp = find_breakpoint(&zbreakpoints, address);
if (*this_bp) {
@@ -298,15 +301,12 @@ z80_context * zdebugger(z80_context * context, uint16_t address)
pc = z80_ram + (address & 0x1FFF);
} else if (address >= 0x8000) {
if (context->bank_reg < (0x400000 >> 15)) {
- fprintf(stderr, "Entered Z80 debugger in banked memory address %X, which is not yet supported\n", address);
- exit(1);
+ fatal_error("Entered Z80 debugger in banked memory address %X, which is not yet supported\n", address);
} else {
- fprintf(stderr, "Entered Z80 debugger in banked memory address %X, but the bank is not pointed to a cartridge address\n", address);
- exit(1);
+ fatal_error("Entered Z80 debugger in banked memory address %X, but the bank is not pointed to a cartridge address\n", address);
}
} else {
- fprintf(stderr, "Entered Z80 debugger at address %X\n", address);
- exit(1);
+ fatal_error("Entered Z80 debugger at address %X\n", address);
}
for (disp_def * cur = zdisplays; cur; cur = cur->next) {
zdebugger_print(context, cur->format_char, cur->param);
@@ -475,6 +475,9 @@ m68k_context * debugger(m68k_context * context, uint32_t address)
static uint32_t branch_t;
static uint32_t branch_f;
m68kinst inst;
+
+ init_terminal();
+
sync_components(context, 0);
//probably not necessary, but let's play it safe
address &= 0xFFFFFF;
@@ -504,8 +507,7 @@ m68k_context * debugger(m68k_context * context, uint32_t address)
} else if(address > 0xE00000) {
pc = ram + (address & 0xFFFF)/2;
} else {
- fprintf(stderr, "Entered 68K debugger at address %X\n", address);
- exit(1);
+ fatal_error("Entered 68K debugger at address %X\n", address);
}
uint16_t * after_pc = m68k_decode(pc, &inst, address);
m68k_disasm(&inst, input_buf);