diff --git a/include/vm_debug.h b/include/vm_debug.h index 7ad1a42..485e081 100644 --- a/include/vm_debug.h +++ b/include/vm_debug.h @@ -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); diff --git a/src/vm_debug.c b/src/vm_debug.c index 238e3ee..a5368b4 100644 --- a/src/vm_debug.c +++ b/src/vm_debug.c @@ -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, "", + "Jump to for next execution", }, { "printaddr", "pa", vm_debug_cmd_printaddr, 1, "", "Print the value at memory address ", }, { "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; +} diff --git a/tests/vm_debug.c b/tests/vm_debug.c index d8cfb11..3628816 100644 --- a/tests/vm_debug.c +++ b/tests/vm_debug.c @@ -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); +}