Undocumented variant of SBC added.

Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
Adrian Conlon 2018-01-01 12:55:47 +00:00
parent 1beee9782f
commit 5f54f61514
2 changed files with 9 additions and 3 deletions

View File

@ -395,6 +395,9 @@ std::string EightBit::Disassembly::disassemble(uint16_t current) const {
case 0b101: case 0b101:
output << disassemble_AM_11(bbb, "*LAX"); output << disassemble_AM_11(bbb, "*LAX");
break; break;
case 0b111:
output << disassemble_AM_11(bbb, "*SBC");
break;
default: default:
throw std::domain_error("Illegal instruction group"); throw std::domain_error("Illegal instruction group");
} }

View File

@ -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, /* 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, /* 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, /* 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, /* 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; break;
case 0b11: case 0b11:
switch (decoded.aaa) { switch (decoded.aaa) {
case 0b100: // SAX case 0b100: // *SAX
AM_11(decoded.bbb, A() & X()); AM_11(decoded.bbb, A() & X());
break; break;
case 0b101: // LAX case 0b101: // *LAX
adjustNZ(X() = A() = AM_11(decoded.bbb)); adjustNZ(X() = A() = AM_11(decoded.bbb));
break; break;
case 0b111: // *SBC
SBC(AM_11(decoded.bbb));
break;
default: default:
throw std::domain_error("Illegal instruction group"); throw std::domain_error("Illegal instruction group");
} }