From 23177df26ae7ac5ddafb9cd9fd10bf5077ca6b19 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Mon, 19 Jun 2017 19:53:26 -0400 Subject: [PATCH] Added various tests of the basic ALU ops. --- .../Z80MachineCycleTests.swift | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/OSBindings/Mac/Clock SignalTests/Z80MachineCycleTests.swift b/OSBindings/Mac/Clock SignalTests/Z80MachineCycleTests.swift index ad7b63f9a..e4e2f49db 100644 --- a/OSBindings/Mac/Clock SignalTests/Z80MachineCycleTests.swift +++ b/OSBindings/Mac/Clock SignalTests/Z80MachineCycleTests.swift @@ -556,4 +556,50 @@ class Z80MachineCycleTests: XCTestCase { ] ) } + + // ADD A,r + func testADDAr() { + test( + program: [0x80], + busCycles: [ + MachineCycle(operation: .readOpcode, length: 4), + ] + ) + } + + // ADD A,n + func testADDAn() { + test( + program: [0xc6, 0x00], + busCycles: [ + MachineCycle(operation: .readOpcode, length: 4), + MachineCycle(operation: .read, length: 3), + ] + ) + } + + // ADD A,(HL) + func testADDAHL() { + test( + program: [0x86], + busCycles: [ + MachineCycle(operation: .readOpcode, length: 4), + MachineCycle(operation: .read, length: 3), + ] + ) + } + + // ADD A,(IX+d) + func testADDAIXd() { + test( + program: [0xdd, 0x86], + busCycles: [ + MachineCycle(operation: .readOpcode, length: 4), + MachineCycle(operation: .readOpcode, length: 4), + MachineCycle(operation: .read, length: 3), + MachineCycle(operation: .internalOperation, length: 5), + MachineCycle(operation: .read, length: 3), + ] + ) + } }