From fadbfdf801feb5b57bd1d434216e67370e499171 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Mon, 19 Jun 2017 21:31:56 -0400 Subject: [PATCH] Added DJNZ test. --- .../Z80MachineCycleTests.swift | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/OSBindings/Mac/Clock SignalTests/Z80MachineCycleTests.swift b/OSBindings/Mac/Clock SignalTests/Z80MachineCycleTests.swift index c37cb98ba..c32b8d529 100644 --- a/OSBindings/Mac/Clock SignalTests/Z80MachineCycleTests.swift +++ b/OSBindings/Mac/Clock SignalTests/Z80MachineCycleTests.swift @@ -956,4 +956,27 @@ class Z80MachineCycleTests: XCTestCase { ] ) } + + // DJNZ + func testDJNZ() { + test( + program: [ + 0x06, 0x02, // LD B, 2 + 0x10, 0xfe, // DJNZ -2 + ], + busCycles: [ + MachineCycle(operation: .readOpcode, length: 4), + MachineCycle(operation: .read, length: 3), + + MachineCycle(operation: .readOpcode, length: 5), + MachineCycle(operation: .read, length: 3), + MachineCycle(operation: .internalOperation, length: 5), + + MachineCycle(operation: .readOpcode, length: 5), + MachineCycle(operation: .read, length: 3), + + MachineCycle(operation: .readOpcode, length: 4), + ] + ) + } }