mirror of
https://github.com/pevans/erc-c.git
synced 2024-12-21 08:30:55 +00:00
Add ability to debug separate from pausing
Also, pausing just pauses now; no debugger prompt is shown. ALT+P toggles pausing, so just hit it again to unpause. Also, when things are paused, you can perform other keyboard events (like quitting).
This commit is contained in:
parent
ec719da2c5
commit
6e77e99813
@ -339,6 +339,13 @@ struct apple2 {
|
||||
*/
|
||||
bool paused;
|
||||
|
||||
/*
|
||||
* When this and the paused fields are true, then we will print a
|
||||
* debug prompt and allow the user to work with the machine through
|
||||
* that.
|
||||
*/
|
||||
bool debug;
|
||||
|
||||
/*
|
||||
* If this is true, then we will disassemble opcodes as we execute.
|
||||
*/
|
||||
|
@ -3,7 +3,8 @@
|
||||
|
||||
#include "vm_event.h"
|
||||
|
||||
extern void apple2_event_init();
|
||||
extern EVENT_DO(apple2_event_debug);
|
||||
extern EVENT_DO(apple2_event_pause);
|
||||
extern void apple2_event_init();
|
||||
|
||||
#endif
|
||||
|
@ -48,14 +48,9 @@ apple2_create(int width, int height)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// By default, we have no strobe set; it should only be set when a
|
||||
// key is pressed
|
||||
mach->strobe = false;
|
||||
|
||||
// Yes, please do execute opcodes to begin with
|
||||
mach->paused = false;
|
||||
|
||||
// Don't print opcodes by default
|
||||
mach->debug = false;
|
||||
mach->disasm = false;
|
||||
|
||||
// Forward set these to NULL in case we fail to build the machine
|
||||
@ -357,8 +352,7 @@ apple2_run_loop(apple2 *mach)
|
||||
mach->paused = true;
|
||||
}
|
||||
|
||||
// If we're paused, then just re-loop until we're not
|
||||
if (mach->paused) {
|
||||
if (mach->debug) {
|
||||
if (mach->selected_drive) {
|
||||
mach->selected_drive->locked = true;
|
||||
}
|
||||
@ -376,6 +370,10 @@ apple2_run_loop(apple2 *mach)
|
||||
}
|
||||
|
||||
free(input);
|
||||
}
|
||||
|
||||
if (mach->paused) {
|
||||
vm_event_poll(mach->screen);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -328,6 +328,7 @@ DEBUG_CMD(resume)
|
||||
apple2_debug_unbreak(mach->cpu->PC);
|
||||
|
||||
mach->paused = false;
|
||||
mach->debug = false;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -17,16 +17,18 @@ void
|
||||
apple2_event_init()
|
||||
{
|
||||
vm_di_set(VM_PAUSE_FUNC, apple2_event_pause);
|
||||
vm_di_set(VM_DEBUG_FUNC, apple2_event_debug);
|
||||
}
|
||||
|
||||
EVENT_DO(apple2_event_pause)
|
||||
{
|
||||
apple2 *mach = (apple2 *)_mach;
|
||||
mach->paused = true;
|
||||
mach->paused = !mach->paused;
|
||||
}
|
||||
|
||||
EVENT_DO(apple2_event_debug)
|
||||
{
|
||||
apple2 *mach = (apple2 *)_mach;
|
||||
mach->debug = true;
|
||||
mach->paused = true;
|
||||
}
|
||||
|
@ -108,6 +108,10 @@ vm_event_keyboard_special(vm_event *ev, char ch)
|
||||
ev->screen->should_exit = true;
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
vm_event_do(VM_DEBUG_FUNC);
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
vm_event_do(VM_PAUSE_FUNC);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user