diff --git a/M6502/inc/mos6502.h b/M6502/inc/mos6502.h index c924c9f..5b487ea 100644 --- a/M6502/inc/mos6502.h +++ b/M6502/inc/mos6502.h @@ -75,6 +75,7 @@ namespace EightBit { adjustNegative(datum); } + void getWord(uint8_t page, uint8_t offset, register16_t& output); void getWord(uint8_t offset, register16_t& output); void getWord(register16_t& output); @@ -104,7 +105,7 @@ namespace EightBit { void Address_Indirect() { Address_Absolute(); - getWord(MEMPTR(), MEMPTR()); + getWord(MEMPTR().high, MEMPTR().low, MEMPTR()); } void Address_ZeroPageX() { diff --git a/M6502/src/mos6502.cpp b/M6502/src/mos6502.cpp index 462fec3..46b4406 100644 --- a/M6502/src/mos6502.cpp +++ b/M6502/src/mos6502.cpp @@ -63,14 +63,18 @@ void EightBit::MOS6502::reset() { getWord(RSTvector, PC()); } -void EightBit::MOS6502::getWord(uint8_t offset, register16_t& output) { +void EightBit::MOS6502::getWord(uint8_t page, uint8_t offset, register16_t& output) { BUS().ADDRESS().low = offset; - BUS().ADDRESS().high = 0; + BUS().ADDRESS().high = page; output.low = getByte(); BUS().ADDRESS().low++; output.high = getByte(); } +void EightBit::MOS6502::getWord(uint8_t offset, register16_t& output) { + getWord(0, offset, output); +} + void EightBit::MOS6502::getWord(register16_t& output) { output.low = getByte(); BUS().ADDRESS().word++;