Correct a 6502 bug in absolute indirect addressing mode (unchanging page on address resolution).

Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
Adrian Conlon 2017-12-28 16:15:22 +00:00
parent 1946b7ef39
commit 7432e602f8
2 changed files with 8 additions and 3 deletions

View File

@ -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() {

View File

@ -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++;