From ac95670cfcbb4f708f19668cce648617c1a8a06b Mon Sep 17 00:00:00 2001 From: Adrian Conlon Date: Fri, 12 Jan 2018 20:13:35 +0000 Subject: [PATCH] Add support for 6502 pin 38 (SO: set overflow) Signed-off-by: Adrian Conlon --- M6502/inc/mos6502.h | 4 ++++ M6502/src/mos6502.cpp | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/M6502/inc/mos6502.h b/M6502/inc/mos6502.h index ffc959d..8ac47a6 100644 --- a/M6502/inc/mos6502.h +++ b/M6502/inc/mos6502.h @@ -53,6 +53,8 @@ namespace EightBit { uint8_t& S() { return s; } uint8_t& P() { return p; } + PinLevel& SO() { return m_soLine; } // In + protected: virtual void reset() final; @@ -664,5 +666,7 @@ namespace EightBit { std::array m_timings; std::array m_decodedOpcodes; + + PinLevel m_soLine = Low; }; } \ No newline at end of file diff --git a/M6502/src/mos6502.cpp b/M6502/src/mos6502.cpp index 4406e93..3a9b923 100644 --- a/M6502/src/mos6502.cpp +++ b/M6502/src/mos6502.cpp @@ -32,6 +32,8 @@ EightBit::MOS6502::MOS6502(Bus& bus) A() = 0; P() = RF; S() = Mask8; + + raise(SO()); } int EightBit::MOS6502::step() { @@ -39,6 +41,10 @@ int EightBit::MOS6502::step() { auto returned = 0; if (LIKELY(powered())) { ExecutingInstruction.fire(*this); + if (UNLIKELY(lowered(SO()))) { + P() |= VF; + raise(SO()); + } if (UNLIKELY(lowered(NMI()))) { raise(NMI()); interrupt(NMIvector);