mirror of
https://github.com/pevans/erc-c.git
synced 2024-11-27 20:51:17 +00:00
Add disasm command (toggle disassembly)
This commit is contained in:
parent
4558e62adc
commit
edd175c1f9
@ -78,6 +78,7 @@ extern void vm_debug_unbreak(int);
|
|||||||
extern void vm_debug_unbreak_all();
|
extern void vm_debug_unbreak_all();
|
||||||
|
|
||||||
extern DEBUG_CMD(break);
|
extern DEBUG_CMD(break);
|
||||||
|
extern DEBUG_CMD(disasm);
|
||||||
extern DEBUG_CMD(help);
|
extern DEBUG_CMD(help);
|
||||||
extern DEBUG_CMD(jump);
|
extern DEBUG_CMD(jump);
|
||||||
extern DEBUG_CMD(printaddr);
|
extern DEBUG_CMD(printaddr);
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
|
|
||||||
|
#include "apple2.h"
|
||||||
#include "mos6502.h"
|
#include "mos6502.h"
|
||||||
#include "vm_debug.h"
|
#include "vm_debug.h"
|
||||||
#include "vm_di.h"
|
#include "vm_di.h"
|
||||||
@ -33,6 +34,8 @@ static bool breakpoints[BREAKPOINTS_MAX];
|
|||||||
vm_debug_cmd cmdtable[] = {
|
vm_debug_cmd cmdtable[] = {
|
||||||
{ "break", "b", vm_debug_cmd_break, 1, "<addr>",
|
{ "break", "b", vm_debug_cmd_break, 1, "<addr>",
|
||||||
"Add breakpoint at <addr>", },
|
"Add breakpoint at <addr>", },
|
||||||
|
{ "disasm", "d", vm_debug_cmd_disasm, 0, "",
|
||||||
|
"Toggle disassembly", },
|
||||||
{ "help", "h", vm_debug_cmd_help, 0, "",
|
{ "help", "h", vm_debug_cmd_help, 0, "",
|
||||||
"Print out this list of commands", },
|
"Print out this list of commands", },
|
||||||
{ "jump", "j", vm_debug_cmd_jump, 1, "<addr>",
|
{ "jump", "j", vm_debug_cmd_jump, 1, "<addr>",
|
||||||
@ -415,3 +418,13 @@ DEBUG_CMD(step)
|
|||||||
mos6502_execute(cpu);
|
mos6502_execute(cpu);
|
||||||
vm_debug_break(cpu->PC);
|
vm_debug_break(cpu->PC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEBUG_CMD(disasm)
|
||||||
|
{
|
||||||
|
apple2 *mach = (apple2 *)vm_di_get(VM_MACHINE);
|
||||||
|
FILE *stream = (FILE *)vm_di_get(VM_OUTPUT);
|
||||||
|
|
||||||
|
vm_reflect_disasm(NULL);
|
||||||
|
|
||||||
|
fprintf(stream, "disassembly %s\n", mach->disasm ? "ON" : "OFF");
|
||||||
|
}
|
||||||
|
@ -268,3 +268,13 @@ Test(vm_debug, cmd_step)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Test(vm_debug, cmd_quit) */
|
/* Test(vm_debug, cmd_quit) */
|
||||||
|
|
||||||
|
Test(vm_debug, cmd_disassemble)
|
||||||
|
{
|
||||||
|
cr_assert_eq(mach->disasm, false);
|
||||||
|
vm_debug_cmd_disasm(&args);
|
||||||
|
cr_assert_neq(strlen(buf), 0);
|
||||||
|
cr_assert_eq(mach->disasm, true);
|
||||||
|
vm_debug_cmd_disasm(&args);
|
||||||
|
cr_assert_eq(mach->disasm, false);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user