mirror of
https://github.com/pevans/erc-c.git
synced 2025-01-13 23:30:49 +00:00
Add hexdump command
This commit is contained in:
parent
267171ea4a
commit
1ff5d17f19
@ -80,6 +80,7 @@ extern void vm_debug_unbreak_all();
|
|||||||
extern DEBUG_CMD(break);
|
extern DEBUG_CMD(break);
|
||||||
extern DEBUG_CMD(dblock);
|
extern DEBUG_CMD(dblock);
|
||||||
extern DEBUG_CMD(disasm);
|
extern DEBUG_CMD(disasm);
|
||||||
|
extern DEBUG_CMD(hdump);
|
||||||
extern DEBUG_CMD(help);
|
extern DEBUG_CMD(help);
|
||||||
extern DEBUG_CMD(jump);
|
extern DEBUG_CMD(jump);
|
||||||
extern DEBUG_CMD(printaddr);
|
extern DEBUG_CMD(printaddr);
|
||||||
|
@ -39,6 +39,8 @@ vm_debug_cmd cmdtable[] = {
|
|||||||
"Disassemble a block of code", },
|
"Disassemble a block of code", },
|
||||||
{ "disasm", "d", vm_debug_cmd_disasm, 0, "",
|
{ "disasm", "d", vm_debug_cmd_disasm, 0, "",
|
||||||
"Toggle disassembly", },
|
"Toggle disassembly", },
|
||||||
|
{ "hdump", "hd", vm_debug_cmd_hdump, 2, "<from> <to>",
|
||||||
|
"Hex dump memory in a given region", },
|
||||||
{ "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>",
|
||||||
@ -454,3 +456,18 @@ DEBUG_CMD(dblock)
|
|||||||
|
|
||||||
mos6502_dis_scan(cpu, stream, args->addr1, args->addr2);
|
mos6502_dis_scan(cpu, stream, args->addr1, args->addr2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Print a hex dump of a region of memory
|
||||||
|
*/
|
||||||
|
DEBUG_CMD(hdump)
|
||||||
|
{
|
||||||
|
if (args->addr1 > args->addr2) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mos6502 *cpu = (mos6502 *)vm_di_get(VM_CPU);
|
||||||
|
FILE *stream = log_stream();
|
||||||
|
|
||||||
|
vm_segment_hexdump(cpu->rmem, stream, args->addr1, args->addr2);
|
||||||
|
}
|
||||||
|
@ -288,3 +288,17 @@ Test(vm_debug, cmd_dblock)
|
|||||||
vm_debug_cmd_dblock(&args);
|
vm_debug_cmd_dblock(&args);
|
||||||
cr_assert_neq(strlen(buf), 0);
|
cr_assert_neq(strlen(buf), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Test(vm_debug, cmd_hdump)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 16; i++) {
|
||||||
|
mos6502_set(mach->cpu, i, i + 0x30);
|
||||||
|
}
|
||||||
|
|
||||||
|
args.addr1 = 0;
|
||||||
|
args.addr2 = 32;
|
||||||
|
|
||||||
|
vm_debug_cmd_hdump(&args);
|
||||||
|
|
||||||
|
cr_assert_neq(strlen(buf), 0);
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user