mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2025-04-05 05:38:50 +00:00
More address simplifications
This commit is contained in:
parent
ff01ed5f6f
commit
5cf821acb6
@ -183,9 +183,10 @@ namespace EightBit {
|
||||
void maybe_fixup(register16_t address, uint8_t unfixed_page, bool always_fixup = false) noexcept {
|
||||
BUS().ADDRESS() = { address.low, unfixed_page };
|
||||
const auto fixing = unfixed_page != address.high;
|
||||
if (always_fixup || fixing)
|
||||
if (always_fixup || fixing) {
|
||||
memoryRead();
|
||||
BUS().ADDRESS() = address;
|
||||
BUS().ADDRESS().high = address.high;
|
||||
}
|
||||
}
|
||||
|
||||
void maybe_fixup(std::pair<register16_t, uint8_t> fixing, bool always_fixup = false) noexcept {
|
||||
|
@ -102,8 +102,7 @@ void EightBit::MOS6502::interrupt() noexcept {
|
||||
}
|
||||
set_flag(IF); // Disable IRQ
|
||||
const uint8_t vector = reset ? RSTvector : (nmi ? NMIvector : IRQvector);
|
||||
BUS().ADDRESS() = { vector, 0xff };
|
||||
jump(getWordPaged());
|
||||
jump(Processor::getWordPaged(0xff, vector));
|
||||
m_handlingRESET = m_handlingNMI = m_handlingINT = false;
|
||||
}
|
||||
|
||||
@ -425,24 +424,20 @@ void EightBit::MOS6502::dummyPush(const uint8_t value) noexcept {
|
||||
////
|
||||
|
||||
EightBit::register16_t EightBit::MOS6502::Address_ZeroPageIndirect() noexcept {
|
||||
BUS().ADDRESS() = Address_ZeroPage();
|
||||
return getWordPaged();
|
||||
return Processor::getWordPaged(Address_ZeroPage());
|
||||
}
|
||||
|
||||
EightBit::register16_t EightBit::MOS6502::Address_Indirect() noexcept {
|
||||
BUS().ADDRESS() = Address_Absolute();
|
||||
return getWordPaged();
|
||||
return Processor::getWordPaged(Address_Absolute());
|
||||
}
|
||||
|
||||
EightBit::register16_t EightBit::MOS6502::Address_ZeroPageX() noexcept {
|
||||
BUS().ADDRESS() = Address_ZeroPage();
|
||||
memoryRead();
|
||||
memoryRead(Address_ZeroPage());
|
||||
return register16_t(BUS().ADDRESS().low + X(), 0);
|
||||
}
|
||||
|
||||
EightBit::register16_t EightBit::MOS6502::Address_ZeroPageY() noexcept {
|
||||
BUS().ADDRESS() = Address_ZeroPage();
|
||||
memoryRead();
|
||||
memoryRead(Address_ZeroPage());
|
||||
return register16_t(BUS().ADDRESS().low + Y(), 0);
|
||||
}
|
||||
|
||||
@ -457,8 +452,7 @@ std::pair<EightBit::register16_t, uint8_t> EightBit::MOS6502::Address_AbsoluteY(
|
||||
}
|
||||
|
||||
EightBit::register16_t EightBit::MOS6502::Address_IndexedIndirectX() noexcept {
|
||||
BUS().ADDRESS() = Address_ZeroPageX();
|
||||
return getWordPaged();
|
||||
return Processor::getWordPaged(Address_ZeroPageX());
|
||||
}
|
||||
|
||||
std::pair<EightBit::register16_t, uint8_t> EightBit::MOS6502::Address_IndirectIndexedY() noexcept {
|
||||
|
@ -67,8 +67,10 @@ namespace EightBit {
|
||||
[[nodiscard]] virtual register16_t getWord() = 0;
|
||||
virtual void setWord(register16_t value) = 0;
|
||||
|
||||
[[nodiscard]] register16_t getWordPaged(register16_t address);
|
||||
[[nodiscard]] register16_t getWordPaged(uint8_t page, uint8_t offset);
|
||||
[[nodiscard]] virtual register16_t getWordPaged() = 0;
|
||||
void setWordPaged(register16_t address, register16_t value);
|
||||
void setWordPaged(uint8_t page, uint8_t offset, register16_t value);
|
||||
virtual void setWordPaged(register16_t value) = 0;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user