diff --git a/M6502/inc/mos6502.h b/M6502/inc/mos6502.h index 970e01e..cec6105 100644 --- a/M6502/inc/mos6502.h +++ b/M6502/inc/mos6502.h @@ -188,6 +188,7 @@ namespace EightBit { void sta_AbsoluteX() noexcept; void sta_AbsoluteY() noexcept; + void sta_IndirectIndexedY() noexcept; uint8_t x = 0; // index register X uint8_t y = 0; // index register Y diff --git a/M6502/src/mos6502.cpp b/M6502/src/mos6502.cpp index dfb9c24..b520650 100644 --- a/M6502/src/mos6502.cpp +++ b/M6502/src/mos6502.cpp @@ -266,7 +266,7 @@ int EightBit::MOS6502::execute() noexcept { case 0x8f: memoryWrite(Address_Absolute(), A() & X()); break; // *SAX (absolute) case 0x90: branch(!carry()); break; // BCC (relative) - case 0x91: memoryRead(Address_IndirectIndexedY().first); memoryWrite(A()); break; // STA (indirect indexed Y) + case 0x91: sta_IndirectIndexedY(); break; // STA (indirect indexed Y) case 0x92: break; case 0x93: break; case 0x94: memoryWrite(Address_ZeroPageX(), Y()); break; // STY (zero page, X) @@ -757,3 +757,9 @@ void EightBit::MOS6502::sta_AbsoluteY() noexcept { getBytePaged(page, address.low); memoryWrite(address, A()); } + +void EightBit::MOS6502::sta_IndirectIndexedY() noexcept { + const auto [address, page] = Address_IndirectIndexedY(); + getBytePaged(page, address.low); // Possible fixup for page boundary crossing + memoryWrite(address, A()); +}