From 6ff661c30d8f1deef1a06f737043b5cbb12c53c0 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 25 Jun 2019 22:34:04 -0400 Subject: [PATCH] Imports OR tests. --- .../Mac/Clock SignalTests/68000Tests.mm | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/OSBindings/Mac/Clock SignalTests/68000Tests.mm b/OSBindings/Mac/Clock SignalTests/68000Tests.mm index dae8a29e5..8ed5d1d68 100644 --- a/OSBindings/Mac/Clock SignalTests/68000Tests.mm +++ b/OSBindings/Mac/Clock SignalTests/68000Tests.mm @@ -3075,6 +3075,71 @@ class CPU::MC68000::ProcessorStorageTests { XCTAssertEqual(28, _machine->get_cycle_count()); } +// MARK: OR + +- (void)testORb { + _machine->set_program({ + 0x8604 // OR.b D4, D3 + }); + auto state = _machine->get_processor_state(); + state.data[3] = 0x54ff0056; + state.data[4] = 0x9853abcd; + state.status |= Flag::Extend | Flag::Carry | Flag::Overflow; + + _machine->set_processor_state(state); + _machine->run_for_instructions(1); + + state = _machine->get_processor_state(); + XCTAssertEqual(state.data[3], 0x54ff00df); + XCTAssertEqual(state.data[4], 0x9853abcd); + XCTAssertEqual(state.status & Flag::ConditionCodes, Flag::Extend | Flag::Negative); + XCTAssertEqual(4, _machine->get_cycle_count()); +} + +- (void)testORl_toDn { + _machine->set_program({ + 0x86ac, 0xfffa // OR.l -6(A4), D3 + }); + auto state = _machine->get_processor_state(); + state.data[3] = 0x54fff856; + state.address[4] = 0x3006; + *_machine->ram_at(0x3000) = 0x1253; + *_machine->ram_at(0x3002) = 0xfb34; + + _machine->set_processor_state(state); + _machine->run_for_instructions(1); + + state = _machine->get_processor_state(); + XCTAssertEqual(state.data[3], 0x56fffb76); + XCTAssertEqual(state.address[4], 0x3006); + XCTAssertEqual(*_machine->ram_at(0x3000), 0x1253); + XCTAssertEqual(*_machine->ram_at(0x3002), 0xfb34); + XCTAssertEqual(state.status & Flag::ConditionCodes, 0); + XCTAssertEqual(18, _machine->get_cycle_count()); +} + +- (void)testORl_fromDn { + _machine->set_program({ + 0x87ac, 0xfffa // OR.l D3, -6(A4) + }); + auto state = _machine->get_processor_state(); + state.data[3] = 0x54fff856; + state.address[4] = 0x3006; + *_machine->ram_at(0x3000) = 0x1253; + *_machine->ram_at(0x3002) = 0xfb34; + + _machine->set_processor_state(state); + _machine->run_for_instructions(1); + + state = _machine->get_processor_state(); + XCTAssertEqual(state.data[3], 0x54fff856); + XCTAssertEqual(state.address[4], 0x3006); + XCTAssertEqual(*_machine->ram_at(0x3000), 0x56ff); + XCTAssertEqual(*_machine->ram_at(0x3002), 0xfb76); + XCTAssertEqual(state.status & Flag::ConditionCodes, 0); + XCTAssertEqual(24, _machine->get_cycle_count()); +} + // MARK: PEA - (void)testPEA_A1 {