mirror of
https://github.com/pevans/erc-c.git
synced 2024-09-29 11:55:01 +00:00
Add dblock command to disassemble blocks of code
This commit is contained in:
parent
0315eb33bf
commit
b239cac239
@ -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(dblock);
|
||||||
extern DEBUG_CMD(disasm);
|
extern DEBUG_CMD(disasm);
|
||||||
extern DEBUG_CMD(help);
|
extern DEBUG_CMD(help);
|
||||||
extern DEBUG_CMD(jump);
|
extern DEBUG_CMD(jump);
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
#include "apple2.h"
|
#include "apple2.h"
|
||||||
#include "mos6502.h"
|
#include "mos6502.h"
|
||||||
|
#include "mos6502.dis.h"
|
||||||
#include "vm_debug.h"
|
#include "vm_debug.h"
|
||||||
#include "vm_di.h"
|
#include "vm_di.h"
|
||||||
#include "vm_reflect.h"
|
#include "vm_reflect.h"
|
||||||
@ -34,6 +35,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>", },
|
||||||
|
{ "dblock", "db", vm_debug_cmd_dblock, 2, "<from> <to>",
|
||||||
|
"Disassemble a block of code", },
|
||||||
{ "disasm", "d", vm_debug_cmd_disasm, 0, "",
|
{ "disasm", "d", vm_debug_cmd_disasm, 0, "",
|
||||||
"Toggle disassembly", },
|
"Toggle disassembly", },
|
||||||
{ "help", "h", vm_debug_cmd_help, 0, "",
|
{ "help", "h", vm_debug_cmd_help, 0, "",
|
||||||
@ -428,3 +431,15 @@ DEBUG_CMD(disasm)
|
|||||||
|
|
||||||
fprintf(stream, "disassembly %s\n", mach->disasm ? "ON" : "OFF");
|
fprintf(stream, "disassembly %s\n", mach->disasm ? "ON" : "OFF");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEBUG_CMD(dblock)
|
||||||
|
{
|
||||||
|
if (args->addr1 > args->addr2) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mos6502 *cpu = (mos6502 *)vm_di_get(VM_CPU);
|
||||||
|
FILE *stream = (FILE *)vm_di_get(VM_OUTPUT);
|
||||||
|
|
||||||
|
mos6502_dis_scan(cpu, stream, args->addr1, args->addr2);
|
||||||
|
}
|
||||||
|
@ -278,3 +278,12 @@ Test(vm_debug, cmd_disassemble)
|
|||||||
vm_debug_cmd_disasm(&args);
|
vm_debug_cmd_disasm(&args);
|
||||||
cr_assert_eq(mach->disasm, false);
|
cr_assert_eq(mach->disasm, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Test(vm_debug, cmd_dblock)
|
||||||
|
{
|
||||||
|
mos6502_set(mach->cpu, 0, 0xEA);
|
||||||
|
args.addr1 = 0;
|
||||||
|
args.addr2 = 1;
|
||||||
|
vm_debug_cmd_dblock(&args);
|
||||||
|
cr_assert_neq(strlen(buf), 0);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user