1
0
mirror of https://github.com/pevans/erc-c.git synced 2025-01-03 00:29:38 +00:00

Add jump debug command

This commit is contained in:
Peter Evans 2018-02-24 19:36:02 -06:00
parent 1be1abc0af
commit 06bf63ecb2
3 changed files with 19 additions and 0 deletions

View File

@ -68,6 +68,7 @@ extern vm_debug_cmd *vm_debug_find_cmd(const char *);
extern void vm_debug_execute(const char *);
extern DEBUG_CMD(help);
extern DEBUG_CMD(jump);
extern DEBUG_CMD(printaddr);
extern DEBUG_CMD(printstate);
extern DEBUG_CMD(resume);

View File

@ -15,6 +15,8 @@
vm_debug_cmd cmdtable[] = {
{ "help", "h", vm_debug_cmd_help, 0, "",
"Print out this list of commands", },
{ "jump", "j", vm_debug_cmd_jump, 1, "<addr>",
"Jump to <addr> for next execution", },
{ "printaddr", "pa", vm_debug_cmd_printaddr, 1, "<addr>",
"Print the value at memory address <addr>", },
{ "printstate", "ps", vm_debug_cmd_printstate, 0, "",
@ -181,3 +183,12 @@ DEBUG_CMD(printaddr)
fprintf(stream, "$%02X\n", mos6502_get(cpu, args->addr1));
}
DEBUG_CMD(jump)
{
// FIXME: same issue as for printaddr -- overall we need to refactor
// vm_reflect quite a bit
mos6502 *cpu = (mos6502 *)vm_di_get(VM_CPU);
cpu->PC = args->addr1;
}

View File

@ -108,3 +108,10 @@ Test(vm_debug, cmd_printaddr)
vm_debug_cmd_printaddr(&args);
cr_assert_str_eq(buf, "$7F\n");
}
Test(vm_debug, jump)
{
args.addr1 = 123;
vm_debug_cmd_jump(&args);
cr_assert_eq(mach->cpu->PC, 123);
}