Add undocumented 6502 instruction RRA. nestest.nes now runs to completion: Hurrah!

Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
Adrian Conlon 2018-01-07 23:42:26 +00:00
parent 4d9c0b490a
commit 847e07be86
3 changed files with 15 additions and 2 deletions

View File

@ -616,6 +616,13 @@ namespace EightBit {
EORA(operand);
}
void RRA(int bbb) {
auto operand = AM_01(bbb);
ROR(operand);
setByte(operand);
A() = ADC(A(), operand);
}
void ROR(uint8_t& output);
void LSR(uint8_t& output);

View File

@ -398,6 +398,9 @@ std::string EightBit::Disassembly::disassemble(uint16_t current) const {
case 0b010:
output << disassemble_AM_01(bbb, "*SRE");
break;
case 0b011:
output << disassemble_AM_01(bbb, "*RRA");
break;
case 0b100:
output << disassemble_AM_11(bbb, "*SAX");
break;

View File

@ -11,8 +11,8 @@ EightBit::MOS6502::MOS6502(Bus& bus)
/* 3 */ 2, 5, 0, 7, 4, 4, 6, 6, 2, 4, 2, 6, 4, 4, 7, 6,
/* 4 */ 6, 6, 0, 8, 3, 3, 5, 5, 3, 2, 2, 0, 3, 4, 6, 6,
/* 5 */ 2, 5, 0, 7, 4, 4, 6, 6, 2, 4, 2, 6, 4, 4, 7, 6,
/* 6 */ 6, 6, 0, 0, 3, 3, 5, 0, 4, 2, 2, 0, 5, 4, 6, 0,
/* 7 */ 2, 5, 0, 0, 4, 4, 6, 0, 2, 4, 2, 0, 4, 4, 7, 0,
/* 6 */ 6, 6, 0, 8, 3, 3, 5, 5, 4, 2, 2, 0, 5, 4, 6, 6,
/* 7 */ 2, 5, 0, 7, 4, 4, 6, 6, 2, 4, 2, 6, 4, 4, 7, 6,
/* 8 */ 2, 6, 0, 6, 3, 3, 3, 3, 2, 0, 2, 0, 4, 4, 4, 4,
/* 9 */ 2, 6, 0, 0, 4, 4, 4, 4, 2, 5, 2, 0, 0, 5, 0, 0,
/* A */ 2, 6, 2, 6, 3, 3, 3, 3, 2, 2, 2, 0, 4, 4, 4, 4,
@ -420,6 +420,9 @@ int EightBit::MOS6502::execute(uint8_t cell) {
case 0b010: // *SRE
SRE(decoded.bbb);
break;
case 0b011: // *RRA
RRA(decoded.bbb);
break;
case 0b100: // *SAX
AM_11(decoded.bbb, A() & X());
break;