From 728143247db8e3b91883026affd9a504e4dd4b85 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Wed, 26 Jul 2017 18:56:35 -0400 Subject: [PATCH] Added a test for RLD and RRD. Which already passes. --- .../Clock SignalTests/Z80MemptrTests.swift | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/OSBindings/Mac/Clock SignalTests/Z80MemptrTests.swift b/OSBindings/Mac/Clock SignalTests/Z80MemptrTests.swift index 445f816ac..75bfde211 100644 --- a/OSBindings/Mac/Clock SignalTests/Z80MemptrTests.swift +++ b/OSBindings/Mac/Clock SignalTests/Z80MemptrTests.swift @@ -172,10 +172,24 @@ class Z80MemptrTests: XCTestCase { MEMPTR = rp1_before_operation + 1 */ - /* TODO: - RLD/RRD - MEMPTR = HL + 1 - */ + // RLD/RRD + func testRLDRRD() { + // MEMPTR = HL + 1 + let rldProgram: [UInt8] = [ + 0xed, 0x6f + ] + let rrdProgram: [UInt8] = [ + 0xed, 0x67 + ] + + for addr in 0 ..< 65536 { + let expectedResult = UInt16((addr + 1) & 0xffff) + machine.setValue(UInt16(addr), for: .HL) + + XCTAssertEqual(test(program: rldProgram, length: 18, initialValue: 0xffff), expectedResult) + XCTAssertEqual(test(program: rrdProgram, length: 18, initialValue: 0xffff), expectedResult) + } + } /* TODO: JR/DJNZ/RET/RETI/RST (jumping to addr)