1
0
mirror of https://github.com/pevans/erc-c.git synced 2024-12-21 23:29:16 +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) DEFINE_ADDR(idx)
{ {
ADDR_LO(cpu); vm_8bit addr;
EFF_ADDR(addr + cpu->X);
return mos6502_get( addr = mos6502_get(cpu, cpu->PC + 1);
cpu, addr = mos6502_get(cpu, addr + cpu->X);
mos6502_get(cpu, eff_addr));
EFF_ADDR(addr);
return mos6502_get(cpu, eff_addr);
} }
/* /*
@ -184,8 +186,12 @@ DEFINE_ADDR(idx)
*/ */
DEFINE_ADDR(idy) DEFINE_ADDR(idy)
{ {
ADDR_LO(cpu); vm_8bit addr;
EFF_ADDR(mos6502_get(cpu, addr) + cpu->Y);
addr = mos6502_get(cpu, cpu->PC + 1);
addr = mos6502_get(cpu, addr);
EFF_ADDR(addr + cpu->Y);
return mos6502_get(cpu, eff_addr); return mos6502_get(cpu, eff_addr);
} }