mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2024-09-01 15:29:11 +00:00
Add INC instruction to the 6809 processor.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
parent
8c8c02f4b7
commit
d44718ed22
@ -195,6 +195,7 @@ namespace EightBit {
|
|||||||
uint8_t dec(uint8_t operand);
|
uint8_t dec(uint8_t operand);
|
||||||
uint8_t eor(uint8_t operand, uint8_t data);
|
uint8_t eor(uint8_t operand, uint8_t data);
|
||||||
void exg(uint8_t data);
|
void exg(uint8_t data);
|
||||||
|
uint8_t inc(uint8_t operand);
|
||||||
uint8_t neg(uint8_t operand);
|
uint8_t neg(uint8_t operand);
|
||||||
|
|
||||||
register16_t m_d;
|
register16_t m_d;
|
||||||
|
@ -187,6 +187,13 @@ int EightBit::mc6809::executeUnprefixed(uint8_t opcode) {
|
|||||||
// EXG
|
// EXG
|
||||||
case 0x1e: addCycles(8); exg(AM_immediate_byte()); break; // EXG (EXG R1,R2 immediate)
|
case 0x1e: addCycles(8); exg(AM_immediate_byte()); break; // EXG (EXG R1,R2 immediate)
|
||||||
|
|
||||||
|
// INC
|
||||||
|
case 0x0c: addCycles(6); BUS().write(inc(AM_direct_byte())); break; // INC (INC direct)
|
||||||
|
case 0x4c: addCycles(2); A() = inc(A()); break; // INC (INCA inherent)
|
||||||
|
case 0x5c: addCycles(2); B() = inc(B()); break; // INC (INCB inherent)
|
||||||
|
case 0x6c: addCycles(6); BUS().write(inc(AM_indexed_byte())); break; // INC (INC indexed)
|
||||||
|
case 0x7c: addCycles(7); BUS().write(inc(AM_extended_byte())); break; // INC (INC extended)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
UNREACHABLE;
|
UNREACHABLE;
|
||||||
}
|
}
|
||||||
@ -572,3 +579,10 @@ void EightBit::mc6809::exg(uint8_t data) {
|
|||||||
else
|
else
|
||||||
std::swap(referenceTransfer8(reg1), referenceTransfer8(reg2));
|
std::swap(referenceTransfer8(reg1), referenceTransfer8(reg2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t EightBit::mc6809::inc(uint8_t operand) {
|
||||||
|
const uint8_t result = operand + 1;
|
||||||
|
adjustNZ(result);
|
||||||
|
adjustOverflow(operand, 1, result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user