From 5c3568aebde188bdd484ffc2359551a9f7e92980 Mon Sep 17 00:00:00 2001 From: Adrian Conlon Date: Thu, 4 Jan 2018 22:46:44 +0000 Subject: [PATCH] Undocumented instruction: SLO added Signed-off-by: Adrian Conlon --- M6502/inc/mos6502.h | 11 +++++++++++ M6502/src/Disassembly.cpp | 3 +++ M6502/src/mos6502.cpp | 9 ++++++--- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/M6502/inc/mos6502.h b/M6502/inc/mos6502.h index 4370132..216ee9e 100644 --- a/M6502/inc/mos6502.h +++ b/M6502/inc/mos6502.h @@ -583,6 +583,17 @@ namespace EightBit { A() = SBC(A(), operand); } + void ORA(uint8_t value) { + adjustNZ(A() |= value); + } + + void SLO(int bbb) { + auto operand = AM_01(bbb); + ASL(operand); + setByte(operand); + ORA(operand); + } + void ROR(uint8_t& output); void LSR(uint8_t& output); diff --git a/M6502/src/Disassembly.cpp b/M6502/src/Disassembly.cpp index eaa9f7a..ae2ef77 100644 --- a/M6502/src/Disassembly.cpp +++ b/M6502/src/Disassembly.cpp @@ -389,6 +389,9 @@ std::string EightBit::Disassembly::disassemble(uint16_t current) const { break; case 0b11: switch (aaa) { + case 0b000: + output << disassemble_AM_01(bbb, "*SLO"); + break; case 0b100: output << disassemble_AM_11(bbb, "*SAX"); break; diff --git a/M6502/src/mos6502.cpp b/M6502/src/mos6502.cpp index 760c23d..4e4bab0 100644 --- a/M6502/src/mos6502.cpp +++ b/M6502/src/mos6502.cpp @@ -5,8 +5,8 @@ EightBit::MOS6502::MOS6502(Bus& bus) : Processor(bus) { m_timings = { //// 0 1 2 3 4 5 6 7 8 9 A B C D E F - /* 0 */ 7, 6, 0, 0, 3, 3, 5, 0, 3, 2, 2, 0, 4, 4, 6, 0, - /* 1 */ 2, 5, 0, 0, 4, 4, 6, 0, 2, 4, 2, 0, 4, 4, 7, 0, + /* 0 */ 7, 6, 0, 8, 3, 3, 5, 5, 3, 2, 2, 0, 4, 4, 6, 6, + /* 1 */ 2, 5, 0, 7, 4, 4, 6, 6, 2, 4, 2, 6, 4, 4, 7, 6, /* 2 */ 6, 6, 0, 0, 3, 3, 5, 0, 4, 2, 2, 0, 4, 4, 6, 0, /* 3 */ 2, 5, 0, 0, 4, 4, 6, 0, 2, 4, 2, 0, 4, 4, 7, 0, /* 4 */ 6, 6, 0, 0, 3, 3, 5, 0, 3, 2, 2, 0, 3, 4, 6, 0, @@ -294,7 +294,7 @@ int EightBit::MOS6502::execute(uint8_t cell) { case 0b01: switch (decoded.aaa) { case 0b000: // ORA - adjustNZ(A() |= AM_01(decoded.bbb)); + ORA(AM_01(decoded.bbb)); break; case 0b001: // AND adjustNZ(A() &= AM_01(decoded.bbb)); @@ -411,6 +411,9 @@ int EightBit::MOS6502::execute(uint8_t cell) { break; case 0b11: switch (decoded.aaa) { + case 0b000: // *SLO + SLO(decoded.bbb); + break; case 0b100: // *SAX AM_11(decoded.bbb, A() & X()); break;