diff --git a/OSBindings/Mac/Clock SignalTests/68000ComparativeTests.mm b/OSBindings/Mac/Clock SignalTests/68000ComparativeTests.mm index 83947c847..019381314 100644 --- a/OSBindings/Mac/Clock SignalTests/68000ComparativeTests.mm +++ b/OSBindings/Mac/Clock SignalTests/68000ComparativeTests.mm @@ -187,10 +187,10 @@ struct TestProcessor: public CPU::MC68000Mk2::BusHandler { // @"rtr.json", // @"rts.json", @"swap.json", -// @"tas.json", + @"tas.json", // @"tst.json", ]]; -// _testSet = [NSSet setWithArray:@[@"PEA 0038"]]; +// _testSet = [NSSet setWithArray:@[@"TAS 4ac0"]]; } - (void)testAll { diff --git a/Processors/68000Mk2/Implementation/68000Mk2Implementation.hpp b/Processors/68000Mk2/Implementation/68000Mk2Implementation.hpp index 429cbb9fa..4b2eb5bc1 100644 --- a/Processors/68000Mk2/Implementation/68000Mk2Implementation.hpp +++ b/Processors/68000Mk2/Implementation/68000Mk2Implementation.hpp @@ -165,6 +165,7 @@ enum ExecutionState: int { MULU_MULS, LEA, PEA, + TAS, }; // MARK: - The state machine. @@ -714,6 +715,20 @@ void Processor void ProcessorBase::raise_exception(i exception_vector_ = vector; } +inline void ProcessorBase::tas(Preinstruction instruction, uint32_t) { + // This will be reached only if addressing mode is Dn. + const uint8_t value = registers_[instruction.reg(0)].b; + registers_[instruction.reg(0)].b |= 0x80; + + status_.overflow_flag = status_.carry_flag = 0; + status_.zero_result = value; + status_.negative_flag = value & 0x80; +} + // MARK: - External state. template diff --git a/Processors/68000Mk2/Implementation/68000Mk2Storage.hpp b/Processors/68000Mk2/Implementation/68000Mk2Storage.hpp index 8e93907da..706e27c4d 100644 --- a/Processors/68000Mk2/Implementation/68000Mk2Storage.hpp +++ b/Processors/68000Mk2/Implementation/68000Mk2Storage.hpp @@ -143,7 +143,7 @@ struct ProcessorBase: public InstructionSet::M68k::NullFlowController { inline void unlink(uint32_t &) {} // inline void move_to_usp(uint32_t) {} // inline void move_from_usp(uint32_t &) {} // - inline void tas(Preinstruction, uint32_t) {} // + inline void tas(Preinstruction, uint32_t); template void raise_exception(int); // These aren't implemented because the specific details of the implementation