mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-25 03:32:01 +00:00
Added Objective-C through wiring and a Swift test class for Memptr modifications. So far with a single test, that fails.
This commit is contained in:
parent
540a03f75c
commit
660f0e4c40
@ -7,6 +7,7 @@
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
4B01A6881F22F0DB001FD6E3 /* Z80MemptrTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B01A6871F22F0DB001FD6E3 /* Z80MemptrTests.swift */; };
|
||||
4B049CDD1DA3C82F00322067 /* BCDTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B049CDC1DA3C82F00322067 /* BCDTest.swift */; };
|
||||
4B08A2751EE35D56008B7065 /* Z80InterruptTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B08A2741EE35D56008B7065 /* Z80InterruptTests.swift */; };
|
||||
4B08A2781EE39306008B7065 /* TestMachine.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B08A2771EE39306008B7065 /* TestMachine.mm */; };
|
||||
@ -456,6 +457,7 @@
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
4B01A6871F22F0DB001FD6E3 /* Z80MemptrTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Z80MemptrTests.swift; sourceTree = "<group>"; };
|
||||
4B046DC31CFE651500E9E45E /* CRTMachine.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = CRTMachine.hpp; sourceTree = "<group>"; };
|
||||
4B049CDC1DA3C82F00322067 /* BCDTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BCDTest.swift; sourceTree = "<group>"; };
|
||||
4B08A2741EE35D56008B7065 /* Z80InterruptTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Z80InterruptTests.swift; sourceTree = "<group>"; };
|
||||
@ -1880,6 +1882,7 @@
|
||||
4B14145F1B58885000E04248 /* WolfgangLorenzTests.swift */,
|
||||
4B08A2741EE35D56008B7065 /* Z80InterruptTests.swift */,
|
||||
4BDDBA981EF3451200347E61 /* Z80MachineCycleTests.swift */,
|
||||
4B01A6871F22F0DB001FD6E3 /* Z80MemptrTests.swift */,
|
||||
4BFCA12A1ECBE7C400AC40C1 /* ZexallTests.swift */,
|
||||
4B3BA0C41D318B44005DD7A7 /* Bridges */,
|
||||
4B1414631B588A1100E04248 /* Test Binaries */,
|
||||
@ -2709,6 +2712,7 @@
|
||||
4B92EACA1B7C112B00246143 /* 6502TimingTests.swift in Sources */,
|
||||
4BFCA1201ECBDC1500AC40C1 /* Z80AllRAM.cpp in Sources */,
|
||||
4BB73EB71B587A5100552FC2 /* AllSuiteATests.swift in Sources */,
|
||||
4B01A6881F22F0DB001FD6E3 /* Z80MemptrTests.swift in Sources */,
|
||||
4B121F9B1E06293F00BFDA12 /* PCMSegmentEventSourceTests.mm in Sources */,
|
||||
4BEF6AAC1D35D1C400E73575 /* DPLLTests.swift in Sources */,
|
||||
4B3BA0CF1D318B44005DD7A7 /* MOS6522Bridge.mm in Sources */,
|
||||
|
@ -42,7 +42,8 @@ typedef NS_ENUM(NSInteger, CSTestMachineZ80Register) {
|
||||
CSTestMachineZ80RegisterHLDash,
|
||||
CSTestMachineZ80RegisterIX, CSTestMachineZ80RegisterIY,
|
||||
CSTestMachineZ80RegisterI, CSTestMachineZ80RegisterR,
|
||||
CSTestMachineZ80RegisterIFF1, CSTestMachineZ80RegisterIFF2, CSTestMachineZ80RegisterIM
|
||||
CSTestMachineZ80RegisterIFF1, CSTestMachineZ80RegisterIFF2, CSTestMachineZ80RegisterIM,
|
||||
CSTestMachineZ80RegisterMemPtr
|
||||
};
|
||||
|
||||
@interface CSTestMachineZ80 : CSTestMachine
|
||||
|
@ -65,6 +65,8 @@ static CPU::Z80::Register registerForRegister(CSTestMachineZ80Register reg) {
|
||||
|
||||
case CSTestMachineZ80RegisterProgramCounter: return CPU::Z80::Register::ProgramCounter;
|
||||
case CSTestMachineZ80RegisterStackPointer: return CPU::Z80::Register::StackPointer;
|
||||
|
||||
case CSTestMachineZ80RegisterMemPtr: return CPU::Z80::Register::MemPtr;
|
||||
}
|
||||
}
|
||||
|
||||
|
34
OSBindings/Mac/Clock SignalTests/Z80MemptrTests.swift
Normal file
34
OSBindings/Mac/Clock SignalTests/Z80MemptrTests.swift
Normal file
@ -0,0 +1,34 @@
|
||||
//
|
||||
// Z80MemptrTests.swift
|
||||
// Clock Signal
|
||||
//
|
||||
// Created by Thomas Harte on 21/07/2017.
|
||||
// Copyright © 2017 Thomas Harte. All rights reserved.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
class Z80MemptrTests: XCTestCase {
|
||||
private func test(program : [UInt8], length : Int32, initialValue : UInt16) -> UInt16 {
|
||||
// Create a machine and install the supplied program at address 0, setting the PC to run from there
|
||||
let machine = CSTestMachineZ80()
|
||||
machine.setValue(0x0000, for: .programCounter)
|
||||
machine.setData(Data(bytes: program), atAddress: 0x0000)
|
||||
|
||||
// Set the initial value of memptr, run for the requested number of cycles,
|
||||
// return the new value
|
||||
machine.setValue(initialValue, for: .memPtr)
|
||||
machine.runForNumber(ofCycles: length)
|
||||
return machine.value(for: .memPtr)
|
||||
}
|
||||
|
||||
// LD A,(addr)
|
||||
func testLDAnn() {
|
||||
let program: [UInt8] = [
|
||||
0x3a, 0x00, 0x00
|
||||
]
|
||||
let result = test(program: program, length: 13, initialValue: 0xffff)
|
||||
XCTAssertEqual(result, 0x0001)
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user