mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2024-12-22 09:30:32 +00:00
Add undocumented 6502 instruction: ISB
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
parent
12565966de
commit
cb89eb8c82
@ -572,9 +572,15 @@ namespace EightBit {
|
||||
}
|
||||
|
||||
void DCP(int bbb) {
|
||||
const auto result = AM_11_x(bbb) - 1;
|
||||
setByte(result);
|
||||
CMP(A(), result);
|
||||
auto operand = AM_11_x(bbb);
|
||||
setByte(--operand);
|
||||
CMP(A(), operand);
|
||||
}
|
||||
|
||||
void ISB(int bbb) {
|
||||
auto operand = AM_01(bbb);
|
||||
setByte(++operand);
|
||||
A() = SBC(A(), operand);
|
||||
}
|
||||
|
||||
void ROR(uint8_t& output);
|
||||
|
@ -399,7 +399,22 @@ std::string EightBit::Disassembly::disassemble(uint16_t current) const {
|
||||
output << disassemble_AM_11_x(bbb, "*DCP");
|
||||
break;
|
||||
case 0b111:
|
||||
output << disassemble_AM_11(bbb, "*SBC");
|
||||
switch (bbb) {
|
||||
case 0b000: // *ISB
|
||||
case 0b001:
|
||||
case 0b011:
|
||||
case 0b100:
|
||||
case 0b101:
|
||||
case 0b110:
|
||||
case 0b111:
|
||||
output << disassemble_AM_01(bbb, "*ISB");
|
||||
break;
|
||||
case 0b010:
|
||||
output << disassemble_AM_11(bbb, "*SBC");
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw std::domain_error("Illegal instruction group");
|
||||
|
@ -19,8 +19,8 @@ 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, 8, 3, 3, 5, 5, 2, 2, 2, 0, 4, 4, 6, 6,
|
||||
/* D */ 2, 5, 0, 7, 4, 4, 6, 6, 2, 4, 2, 6, 4, 4, 7, 6,
|
||||
/* 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,
|
||||
/* E */ 2, 6, 0, 8, 3, 3, 5, 5, 2, 2, 2, 2, 4, 4, 6, 6,
|
||||
/* F */ 2, 5, 0, 7, 4, 4, 6, 6, 2, 4, 2, 6, 4, 4, 7, 6,
|
||||
};
|
||||
|
||||
|
||||
@ -421,7 +421,22 @@ int EightBit::MOS6502::execute(uint8_t cell) {
|
||||
DCP(decoded.bbb);
|
||||
break;
|
||||
case 0b111: // *SBC
|
||||
A() = SBC(A(), AM_11(decoded.bbb));
|
||||
switch (decoded.bbb) {
|
||||
case 0b000: // *ISB
|
||||
case 0b001:
|
||||
case 0b011:
|
||||
case 0b100:
|
||||
case 0b101:
|
||||
case 0b110:
|
||||
case 0b111:
|
||||
ISB(decoded.bbb);
|
||||
break;
|
||||
case 0b010:
|
||||
A() = SBC(A(), AM_11(decoded.bbb));
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw std::domain_error("Illegal instruction group");
|
||||
|
Loading…
Reference in New Issue
Block a user