mirror of
https://github.com/pevans/erc-c.git
synced 2025-02-21 04:29:10 +00:00
Show correct PC counter in scan
This commit is contained in:
parent
b239cac239
commit
c5d1542937
@ -343,7 +343,13 @@ mos6502_dis_opcode(mos6502 *cpu, FILE *stream, int address)
|
|||||||
void
|
void
|
||||||
mos6502_dis_scan(mos6502 *cpu, FILE *stream, int pos, int end)
|
mos6502_dis_scan(mos6502 *cpu, FILE *stream, int pos, int end)
|
||||||
{
|
{
|
||||||
|
vm_16bit pc;
|
||||||
|
|
||||||
|
pc = cpu->PC;
|
||||||
while (pos < end) {
|
while (pos < end) {
|
||||||
|
cpu->PC = pos;
|
||||||
pos += mos6502_dis_opcode(cpu, stream, pos);
|
pos += mos6502_dis_opcode(cpu, stream, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cpu->PC = pc;
|
||||||
}
|
}
|
||||||
|
@ -439,7 +439,7 @@ DEBUG_CMD(dblock)
|
|||||||
}
|
}
|
||||||
|
|
||||||
mos6502 *cpu = (mos6502 *)vm_di_get(VM_CPU);
|
mos6502 *cpu = (mos6502 *)vm_di_get(VM_CPU);
|
||||||
FILE *stream = (FILE *)vm_di_get(VM_OUTPUT);
|
FILE *stream = log_stream();
|
||||||
|
|
||||||
mos6502_dis_scan(cpu, stream, args->addr1, args->addr2);
|
mos6502_dis_scan(cpu, stream, args->addr1, args->addr2);
|
||||||
}
|
}
|
||||||
|
@ -231,6 +231,6 @@ Test(mos6502_dis, scan)
|
|||||||
// runtime operation) when you don't want it to, but as a standalone
|
// runtime operation) when you don't want it to, but as a standalone
|
||||||
// disassembler, it feels less useful when PC isn't emulated.
|
// disassembler, it feels less useful when PC isn't emulated.
|
||||||
assert_buf("0000:29 38 AND #$38\n"
|
assert_buf("0000:29 38 AND #$38\n"
|
||||||
"0000:88 DEY \n"
|
"0002:88 DEY \n"
|
||||||
"0000:6C 34 12 JMP ($1234)\n");
|
"0003:6C 34 12 JMP ($1234)\n");
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ setup()
|
|||||||
}
|
}
|
||||||
|
|
||||||
vm_di_set(VM_OUTPUT, stream);
|
vm_di_set(VM_OUTPUT, stream);
|
||||||
|
log_open(stream);
|
||||||
|
|
||||||
// Writing to stream will now write to buf
|
// Writing to stream will now write to buf
|
||||||
setvbuf(stream, buf, _IOFBF, BUFSIZ);
|
setvbuf(stream, buf, _IOFBF, BUFSIZ);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user