From 47359dc8f11dfabe3a8d706d91c72b2c6407ea9c Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sat, 23 Mar 2019 21:41:47 -0400 Subject: [PATCH] Adds tests for MOVE.l (An), Dn, and thereby correct their implementation. --- OSBindings/Mac/Clock SignalTests/68000Tests.mm | 9 +++++++++ Processors/68000/Implementation/68000Storage.cpp | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/OSBindings/Mac/Clock SignalTests/68000Tests.mm b/OSBindings/Mac/Clock SignalTests/68000Tests.mm index a9946153e..6ca099aea 100644 --- a/OSBindings/Mac/Clock SignalTests/68000Tests.mm +++ b/OSBindings/Mac/Clock SignalTests/68000Tests.mm @@ -127,6 +127,9 @@ class RAM68000: public CPU::MC68000::BusHandler { 0x3040, // MOVEA D0, A0 0x3278, 0x0400, // MOVEA.w (0x0400), A1 + + 0x387c, 0x0400, // MOVE #$400, A4 + 0x2414, // MOVE.l (A4), D2 }); // Perform RESET. @@ -153,6 +156,12 @@ class RAM68000: public CPU::MC68000::BusHandler { _machine->run_for(Cycles(13)); state = _machine->get_processor_state(); XCTAssert(state.address[1] == 0x0000303c, "A1 was %08x instead of 0x0000303c", state.address[1]); + + // Perform MOVE #$400, A4, MOVE.l (A4), D2 + _machine->run_for(Cycles(20)); + state = _machine->get_processor_state(); + XCTAssert(state.address[4] == 0x0400, "A4 was %08x instead of 0x00000400", state.address[4]); + XCTAssert(state.data[2] == 0x303cfb2e, "D2 was %08x instead of 0x303cfb2e", state.data[2]); } @end diff --git a/Processors/68000/Implementation/68000Storage.cpp b/Processors/68000/Implementation/68000Storage.cpp index 91586ad82..c19db8839 100644 --- a/Processors/68000/Implementation/68000Storage.cpp +++ b/Processors/68000/Implementation/68000Storage.cpp @@ -445,7 +445,7 @@ struct ProcessorStorageConstructor { operation = Operation::MOVEAl; case 0x10200: // MOVE.l (An), Dn case 0x10300: // MOVE.l (An)+, Dn - op(Action::CopySourceToEffectiveAddress, seq("nR nr np")); + op(Action::CopySourceToEffectiveAddress, seq("nR nr np", {&storage_.effective_address_[0], &storage_.effective_address_[0]})); if(source_mode == 0x3) { op(int(Action::Increment4) | MicroOp::SourceMask); }