Add TST instruction to the 6809 processor

Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
Adrian Conlon 2018-08-24 00:33:18 +01:00
parent c7ca555995
commit a43b1109bc
2 changed files with 10 additions and 5 deletions

View File

@ -300,6 +300,7 @@ namespace EightBit {
uint8_t st(uint8_t data);
register16_t st(register16_t data);
void tfr(uint8_t data);
void tst(uint8_t data);
register16_t m_d;
register16_t m_x;

View File

@ -374,11 +374,11 @@ int EightBit::mc6809::executeUnprefixed(uint8_t opcode) {
case 0x1f: addCycles(6); tfr(AM_immediate_byte()); break; // TFR (immediate)
// TST
case 0x0d: addCycles(6); break; // TST (direct)
case 0x4d: addCycles(2); break; // TST (TSTA inherent)
case 0x5d: addCycles(2); break; // TST (TSTB inherent)
case 0x6d: addCycles(6); break; // TST (indexed)
case 0x7d: addCycles(7); break; // TST (extended)
case 0x0d: addCycles(6); tst(AM_direct_byte()); break; // TST (direct)
case 0x4d: addCycles(2); tst(A()); break; // TST (TSTA inherent)
case 0x5d: addCycles(2); tst(B()); break; // TST (TSTB inherent)
case 0x6d: addCycles(6); tst(AM_indexed_byte()); break; // TST (indexed)
case 0x7d: addCycles(7); tst(AM_extended_byte()); break; // TST (extended)
// Branching
@ -1127,3 +1127,7 @@ EightBit::register16_t EightBit::mc6809::sub(register16_t operand, register16_t
adjustSubtraction(operand, data, subtraction);
return subtraction & Mask16;
}
void EightBit::mc6809::tst(uint8_t data) {
cmp(data, 0);
}