1
0
mirror of https://github.com/pevans/erc-c.git synced 2024-11-27 20:51:17 +00:00

Add writeaddr command

This commit is contained in:
Peter Evans 2018-02-24 19:38:04 -06:00
parent 06bf63ecb2
commit 09f7152e07
3 changed files with 17 additions and 1 deletions

View File

@ -72,5 +72,6 @@ extern DEBUG_CMD(jump);
extern DEBUG_CMD(printaddr); extern DEBUG_CMD(printaddr);
extern DEBUG_CMD(printstate); extern DEBUG_CMD(printstate);
extern DEBUG_CMD(resume); extern DEBUG_CMD(resume);
extern DEBUG_CMD(writeaddr);
#endif #endif

View File

@ -192,3 +192,9 @@ DEBUG_CMD(jump)
mos6502 *cpu = (mos6502 *)vm_di_get(VM_CPU); mos6502 *cpu = (mos6502 *)vm_di_get(VM_CPU);
cpu->PC = args->addr1; cpu->PC = args->addr1;
} }
DEBUG_CMD(writeaddr)
{
mos6502 *cpu = (mos6502 *)vm_di_get(VM_CPU);
mos6502_set(cpu, args->addr1, args->addr2);
}

View File

@ -109,9 +109,18 @@ Test(vm_debug, cmd_printaddr)
cr_assert_str_eq(buf, "$7F\n"); cr_assert_str_eq(buf, "$7F\n");
} }
Test(vm_debug, jump) Test(vm_debug, cmd_jump)
{ {
args.addr1 = 123; args.addr1 = 123;
vm_debug_cmd_jump(&args); vm_debug_cmd_jump(&args);
cr_assert_eq(mach->cpu->PC, 123); cr_assert_eq(mach->cpu->PC, 123);
} }
Test(vm_debug, cmd_writeaddr)
{
args.addr1 = 123;
args.addr2 = 0xf5;
vm_debug_cmd_writeaddr(&args);
cr_assert_eq(mos6502_get(mach->cpu, args.addr1), args.addr2);
}