From 5f54f6151467120fb88fd991768e72ad04c9ebe3 Mon Sep 17 00:00:00 2001 From: Adrian Conlon Date: Mon, 1 Jan 2018 12:55:47 +0000 Subject: [PATCH] Undocumented variant of SBC added. Signed-off-by: Adrian Conlon --- M6502/src/Disassembly.cpp | 3 +++ M6502/src/mos6502.cpp | 9 ++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/M6502/src/Disassembly.cpp b/M6502/src/Disassembly.cpp index cce03a5..032b6d0 100644 --- a/M6502/src/Disassembly.cpp +++ b/M6502/src/Disassembly.cpp @@ -395,6 +395,9 @@ std::string EightBit::Disassembly::disassemble(uint16_t current) const { case 0b101: output << disassemble_AM_11(bbb, "*LAX"); break; + case 0b111: + output << disassemble_AM_11(bbb, "*SBC"); + break; default: throw std::domain_error("Illegal instruction group"); } diff --git a/M6502/src/mos6502.cpp b/M6502/src/mos6502.cpp index 893cac2..e2a20b5 100644 --- a/M6502/src/mos6502.cpp +++ b/M6502/src/mos6502.cpp @@ -19,7 +19,7 @@ EightBit::MOS6502::MOS6502(Bus& bus) /* B */ 2, 5, 0, 5, 4, 4, 4, 4, 2, 4, 2, 0, 4, 4, 4, 4, /* C */ 2, 6, 0, 0, 3, 3, 5, 0, 2, 2, 2, 0, 4, 4, 6, 0, /* D */ 2, 5, 0, 0, 4, 4, 6, 0, 2, 4, 2, 0, 4, 4, 7, 0, - /* E */ 2, 6, 0, 0, 3, 3, 5, 0, 2, 2, 2, 0, 4, 4, 6, 0, + /* E */ 2, 6, 0, 0, 3, 3, 5, 0, 2, 2, 2, 2, 4, 4, 6, 0, /* F */ 2, 5, 0, 0, 4, 4, 6, 0, 2, 4, 2, 0, 4, 4, 7, 0, }; @@ -411,12 +411,15 @@ int EightBit::MOS6502::execute(uint8_t cell) { break; case 0b11: switch (decoded.aaa) { - case 0b100: // SAX + case 0b100: // *SAX AM_11(decoded.bbb, A() & X()); break; - case 0b101: // LAX + case 0b101: // *LAX adjustNZ(X() = A() = AM_11(decoded.bbb)); break; + case 0b111: // *SBC + SBC(AM_11(decoded.bbb)); + break; default: throw std::domain_error("Illegal instruction group"); }