From 7d1f1a3175c6008471b0224241101928b12daf99 Mon Sep 17 00:00:00 2001 From: Thomas Harte <thomas.harte@gmail.com> Date: Sun, 22 May 2022 19:45:22 -0400 Subject: [PATCH] Implement MOVE [to/from] [CCR/SR]. --- .../68000ComparativeTests.mm | 4 +-- .../Implementation/68000Mk2Implementation.hpp | 25 +++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/OSBindings/Mac/Clock SignalTests/68000ComparativeTests.mm b/OSBindings/Mac/Clock SignalTests/68000ComparativeTests.mm index 19f3aaf9d..21686e9ae 100644 --- a/OSBindings/Mac/Clock SignalTests/68000ComparativeTests.mm +++ b/OSBindings/Mac/Clock SignalTests/68000ComparativeTests.mm @@ -175,7 +175,7 @@ struct TestProcessor: public CPU::MC68000Mk2::BusHandler { @"lea.json", // @"link_unlk.json", // @"lslr_aslr_roxlr_rolr.json", -// @"move_tofrom_srccr.json", + @"move_tofrom_srccr.json", // @"move.json", @"movem.json", @"movep.json", @@ -190,7 +190,7 @@ struct TestProcessor: public CPU::MC68000Mk2::BusHandler { @"tas.json", @"tst.json", ]]; -// _testSet = [NSSet setWithArray:@[@"TAS 4ac0"]]; + _testSet = [NSSet setWithArray:@[@"MOVE to CCR 44d3"]]; } - (void)testAll { diff --git a/Processors/68000Mk2/Implementation/68000Mk2Implementation.hpp b/Processors/68000Mk2/Implementation/68000Mk2Implementation.hpp index 3649f09b6..7fd5c2d78 100644 --- a/Processors/68000Mk2/Implementation/68000Mk2Implementation.hpp +++ b/Processors/68000Mk2/Implementation/68000Mk2Implementation.hpp @@ -166,6 +166,7 @@ enum ExecutionState: int { LEA, PEA, TAS, + MOVEtoCCRSR, }; // MARK: - The state machine. @@ -729,6 +730,17 @@ void Processor<BusHandler, dtack_is_implicit, permit_overrun, signal_will_perfor perform_state_ = Perform_np; }); + Duplicate(MOVEtoCCR, MOVEtoSR); + StdCASE(MOVEtoSR, perform_state_ = MOVEtoCCRSR); + + StdCASE(MOVEfromSR, { + if(instruction_.mode(0) == Mode::DataRegisterDirect) { + perform_state_ = Perform_np_n; + } else { + perform_state_ = Perform_np; + } + }); + default: assert(false); } @@ -1950,6 +1962,19 @@ void Processor<BusHandler, dtack_is_implicit, permit_overrun, signal_will_perfor Prefetch(); MoveToStateSpecific(Decode); + // + // MOVE to [CCR/SR] + // + BeginState(MOVEtoCCRSR): + PerformDynamic(); + + // Rewind the program counter and prefetch twice. + IdleBus(2); + program_counter_.l -= 2; + Prefetch(); + Prefetch(); + MoveToStateSpecific(Decode); + // // Various states TODO. //