mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2025-04-05 05:38:50 +00:00
Undocumented instruction: LAX added.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
parent
d4c08b2a25
commit
75aece30e3
@ -55,6 +55,10 @@ namespace EightBit {
|
||||
return AM_10_x_dump(bbb) + "\t" + instruction + " " + AM_10_x(bbb);
|
||||
}
|
||||
|
||||
std::string disassemble_AM_11(int bbb, const std::string& instruction) const {
|
||||
return AM_11_dump(bbb) + "\t" + instruction + " " + AM_11(bbb);
|
||||
}
|
||||
|
||||
std::string AM_Immediate_dump() const {
|
||||
return dump_Byte(m_address + 1);
|
||||
}
|
||||
@ -303,6 +307,52 @@ namespace EightBit {
|
||||
}
|
||||
}
|
||||
|
||||
std::string AM_11_dump(int bbb) const {
|
||||
switch (bbb) {
|
||||
case 0b000:
|
||||
return AM_IndexedIndirectX_dump();
|
||||
case 0b001:
|
||||
return AM_ZeroPage_dump();
|
||||
case 0b010:
|
||||
return AM_Immediate_dump();
|
||||
case 0b011:
|
||||
return AM_Absolute_dump();
|
||||
case 0b100:
|
||||
return AM_IndirectIndexedY_dump();
|
||||
case 0b101:
|
||||
return AM_ZeroPageY_dump();
|
||||
case 0b110:
|
||||
throw std::domain_error("Illegal addressing mode");
|
||||
case 0b111:
|
||||
return AM_AbsoluteY_dump();
|
||||
default:
|
||||
UNREACHABLE;
|
||||
}
|
||||
}
|
||||
|
||||
std::string AM_11(int bbb) const {
|
||||
switch (bbb) {
|
||||
case 0b000:
|
||||
return AM_IndexedIndirectX();
|
||||
case 0b001:
|
||||
return AM_ZeroPage();
|
||||
case 0b010:
|
||||
return AM_Immediate();
|
||||
case 0b011:
|
||||
return AM_Absolute();
|
||||
case 0b100:
|
||||
return AM_IndirectIndexedY();
|
||||
case 0b101:
|
||||
return AM_ZeroPageY();
|
||||
case 0b110:
|
||||
throw std::domain_error("Illegal addressing mode");
|
||||
case 0b111:
|
||||
return AM_AbsoluteY();
|
||||
default:
|
||||
UNREACHABLE;
|
||||
}
|
||||
}
|
||||
|
||||
static void dump(std::ostream& out, int value, int width);
|
||||
|
||||
uint8_t getByte(uint16_t address) const;
|
||||
|
@ -432,6 +432,30 @@ namespace EightBit {
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t AM_11(int bbb) {
|
||||
switch (bbb) {
|
||||
case 0b000:
|
||||
return AM_IndexedIndirectX();
|
||||
case 0b001:
|
||||
return AM_ZeroPage();
|
||||
case 0b010:
|
||||
return AM_Immediate();
|
||||
case 0b011:
|
||||
return AM_Absolute();
|
||||
case 0b100:
|
||||
return AM_IndirectIndexedY();
|
||||
case 0b101:
|
||||
return AM_ZeroPageY();
|
||||
case 0b110:
|
||||
assert(false);
|
||||
break;
|
||||
case 0b111:
|
||||
return AM_AbsoluteY();
|
||||
default:
|
||||
UNREACHABLE;
|
||||
}
|
||||
}
|
||||
|
||||
// Operations
|
||||
|
||||
void ASL(int bbb) {
|
||||
|
@ -388,7 +388,14 @@ std::string EightBit::Disassembly::disassemble(uint16_t current) const {
|
||||
}
|
||||
break;
|
||||
case 0b11:
|
||||
throw std::domain_error("Illegal instruction group");
|
||||
switch (aaa) {
|
||||
case 0b101:
|
||||
output << disassemble_AM_11(bbb, "*LAX");
|
||||
break;
|
||||
default:
|
||||
throw std::domain_error("Illegal instruction group");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE;
|
||||
}
|
||||
|
@ -15,8 +15,8 @@ EightBit::MOS6502::MOS6502(Bus& bus)
|
||||
/* 7 */ 2, 5, 0, 0, 4, 4, 6, 0, 2, 4, 2, 0, 4, 4, 7, 0,
|
||||
/* 8 */ 2, 6, 0, 0, 3, 3, 3, 0, 2, 0, 2, 0, 4, 4, 4, 0,
|
||||
/* 9 */ 2, 6, 0, 0, 4, 4, 4, 0, 2, 5, 2, 0, 0, 5, 0, 0,
|
||||
/* A */ 2, 6, 2, 0, 3, 3, 3, 0, 2, 2, 2, 0, 4, 4, 4, 0,
|
||||
/* B */ 2, 5, 0, 0, 4, 4, 4, 0, 2, 4, 2, 0, 4, 4, 4, 0,
|
||||
/* A */ 2, 6, 2, 6, 3, 3, 3, 3, 2, 2, 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,
|
||||
/* 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,
|
||||
@ -410,7 +410,14 @@ int EightBit::MOS6502::execute(uint8_t cell) {
|
||||
}
|
||||
break;
|
||||
case 0b11:
|
||||
throw std::domain_error("Illegal instruction group");
|
||||
switch (decoded.aaa) {
|
||||
case 0b101:
|
||||
adjustNZ(X() = A() = AM_11(decoded.bbb));
|
||||
break;
|
||||
default:
|
||||
throw std::domain_error("Illegal instruction group");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user