Add CWAI command to the 6809

Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
Adrian Conlon 2018-08-21 09:52:03 +01:00
parent b4abd7c739
commit 0882513762
2 changed files with 17 additions and 0 deletions

View File

@ -184,6 +184,7 @@ namespace EightBit {
void cmp(uint8_t operand, uint8_t data);
void cmp(register16_t operand, register16_t data);
uint8_t com(uint8_t operand);
void cwai(uint8_t data);
uint8_t neg(uint8_t operand);
register16_t m_d;

View File

@ -155,6 +155,9 @@ int EightBit::mc6809::executeUnprefixed(uint8_t opcode) {
case 0x63: addCycles(6); BUS().write(com(AM_indexed_byte())); break; // COM (COM indexed)
case 0x73: addCycles(7); BUS().write(com(AM_extended_byte())); break; // COM (COM extended)
// CWAI
case 0x3c: addCycles(20); cwai(AM_direct_byte()); break; // CWAI (CWAI direct)
default:
UNREACHABLE;
}
@ -449,3 +452,16 @@ uint8_t EightBit::mc6809::com(uint8_t operand) {
setFlag(CC(), CF);
return result;
}
void EightBit::mc6809::cwai(uint8_t data) {
CC() &= data;
pushWord(PC());
pushWord(U());
pushWord(Y());
pushWord(X());
push(DP());
push(B());
push(A());
push(CC());
halt();
}