mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2024-06-13 23:29:32 +00:00
Compare commits
3 Commits
42afeb342f
...
93088b355c
Author | SHA1 | Date | |
---|---|---|---|
|
93088b355c | ||
|
e4fbeebfa7 | ||
|
84a2d0f952 |
|
@ -159,6 +159,8 @@ bool checker_t::checkState(test_t test) {
|
|||
const auto& actual_action = std::get<2>(actual);
|
||||
check("Cycle action", expected_action, std::string_view(actual_action));
|
||||
}
|
||||
if (!m_messages.empty())
|
||||
return false;
|
||||
|
||||
const auto final = test.final();
|
||||
const auto pc_good = check("PC", final.pc(), cpu.PC().word);
|
||||
|
|
|
@ -188,6 +188,12 @@ namespace EightBit {
|
|||
|
||||
void sta_AbsoluteX() noexcept;
|
||||
void sta_AbsoluteY() noexcept;
|
||||
void sta_IndirectIndexedY() noexcept;
|
||||
|
||||
void write_A_with_fixup(const register16_t& address, uint8_t unfixed_page) noexcept {
|
||||
getBytePaged(unfixed_page, address.low); // Possible fixup for page boundary crossing
|
||||
memoryWrite(address, A());
|
||||
}
|
||||
|
||||
uint8_t x = 0; // index register X
|
||||
uint8_t y = 0; // index register Y
|
||||
|
|
|
@ -73,14 +73,14 @@ void EightBit::MOS6502::handleINT() noexcept {
|
|||
void EightBit::MOS6502::interrupt() noexcept {
|
||||
const bool reset = m_handlingRESET;
|
||||
const bool nmi = m_handlingNMI;
|
||||
const bool irq = m_handlingINT;
|
||||
const bool hardware = nmi || irq || reset;
|
||||
const bool software = !hardware;
|
||||
if (reset) {
|
||||
dummyPush(PC().high);
|
||||
dummyPush(PC().low);
|
||||
dummyPush(P());
|
||||
} else {
|
||||
const bool irq = m_handlingINT;
|
||||
const bool hardware = nmi || irq || reset;
|
||||
const bool software = !hardware;
|
||||
pushWord(PC());
|
||||
push(P() | (software ? BF : 0));
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -748,12 +748,15 @@ void EightBit::MOS6502::sre(const uint8_t value) noexcept {
|
|||
|
||||
void EightBit::MOS6502::sta_AbsoluteX() noexcept {
|
||||
const auto [address, page] = Address_AbsoluteX();
|
||||
getBytePaged(page, address.low);
|
||||
memoryWrite(address, A());
|
||||
write_A_with_fixup(address, page);
|
||||
}
|
||||
|
||||
void EightBit::MOS6502::sta_AbsoluteY() noexcept {
|
||||
const auto [address, page] = Address_AbsoluteY();
|
||||
getBytePaged(page, address.low);
|
||||
memoryWrite(address, A());
|
||||
write_A_with_fixup(address, page);
|
||||
}
|
||||
|
||||
void EightBit::MOS6502::sta_IndirectIndexedY() noexcept {
|
||||
const auto [address, page] = Address_IndirectIndexedY();
|
||||
write_A_with_fixup(address, page);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user