1
0
mirror of https://github.com/pevans/erc-c.git synced 2024-06-11 05:29:33 +00:00

Make idx, idy clearer

I'm still not confident this is how it _should_ work, but I have found
conflicting accounts online for the behavior of these two modes. The
current code is what allows the Apple II to bootstrap as it should.
This commit is contained in:
Peter Evans 2018-01-27 13:04:19 -06:00
parent 38d80078d9
commit 4165c1cefc

View File

@ -168,12 +168,14 @@ DEFINE_ADDR(ind)
*/
DEFINE_ADDR(idx)
{
ADDR_LO(cpu);
EFF_ADDR(addr + cpu->X);
vm_8bit addr;
return mos6502_get(
cpu,
mos6502_get(cpu, eff_addr));
addr = mos6502_get(cpu, cpu->PC + 1);
addr = mos6502_get(cpu, addr + cpu->X);
EFF_ADDR(addr);
return mos6502_get(cpu, eff_addr);
}
/*
@ -184,8 +186,12 @@ DEFINE_ADDR(idx)
*/
DEFINE_ADDR(idy)
{
ADDR_LO(cpu);
EFF_ADDR(mos6502_get(cpu, addr) + cpu->Y);
vm_8bit addr;
addr = mos6502_get(cpu, cpu->PC + 1);
addr = mos6502_get(cpu, addr);
EFF_ADDR(addr + cpu->Y);
return mos6502_get(cpu, eff_addr);
}