mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2024-12-23 15:29:24 +00:00
Add RTI/RTS instructions to the 6809 processor
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
parent
07248972bf
commit
10684a02f4
@ -252,6 +252,8 @@ namespace EightBit {
|
||||
void pulu(uint8_t data);
|
||||
uint8_t rol(uint8_t operand);
|
||||
uint8_t ror(uint8_t operand);
|
||||
void rti();
|
||||
void rts();
|
||||
|
||||
register16_t m_d;
|
||||
register16_t m_x;
|
||||
|
@ -294,6 +294,12 @@ int EightBit::mc6809::executeUnprefixed(uint8_t opcode) {
|
||||
case 0x66: addCycles(6); BUS().write(ror(AM_indexed_byte())); break; // ROR (indexed)
|
||||
case 0x76: addCycles(7); BUS().write(ror(AM_extended_byte())); break; // ROR (extended)
|
||||
|
||||
// RTI
|
||||
case 0x38: addCycles(6); rti(); break; // RTI (RTI inherent)
|
||||
|
||||
// RTS
|
||||
case 0x39: addCycles(5); rts(); break; // RTS (RTS inherent)
|
||||
|
||||
default:
|
||||
UNREACHABLE;
|
||||
}
|
||||
@ -890,3 +896,21 @@ uint8_t EightBit::mc6809::ror(uint8_t operand) {
|
||||
adjustNZ(operand);
|
||||
return operand;
|
||||
}
|
||||
|
||||
void EightBit::mc6809::rti() {
|
||||
CC() = popS();
|
||||
if (CC() & EF) {
|
||||
addCycles(9); // One cycle per byte
|
||||
A() = popS();
|
||||
B() = popS();
|
||||
DP() = popS();
|
||||
X() = popWordS();
|
||||
Y() = popWordS();
|
||||
U() = popWordS();
|
||||
}
|
||||
ret();
|
||||
}
|
||||
|
||||
void EightBit::mc6809::rts() {
|
||||
ret();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user