1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-24 12:30:17 +00:00

Adds memptr testing.

30 failures, for the record.
This commit is contained in:
Thomas Harte 2020-02-26 20:05:14 -05:00
parent 18bb90329a
commit da6d5e2e24

View File

@ -28,6 +28,7 @@ fileprivate struct RegisterState {
let i: UInt8, r: UInt8
let iff1: Bool, iff2: Bool, interruptMode: Int
let isHalted: Bool
let memptr: UInt16
let tStates: Int
func set(onMachine machine: CSTestMachineZ80) {
@ -48,6 +49,7 @@ fileprivate struct RegisterState {
machine.setValue(iff1 ? 1 : 0, for: .IFF1)
machine.setValue(iff2 ? 1 : 0, for: .IFF2)
machine.setValue(UInt16(interruptMode), for: .IM)
machine.setValue(memptr, for: .memPtr)
// TODO: isHalted
}
@ -83,6 +85,7 @@ fileprivate struct RegisterState {
interruptMode = (dictionary["im"] as! NSNumber).intValue
isHalted = (dictionary["halted"] as! NSNumber).boolValue
memptr = UInt16(truncating: dictionary["memptr"] as! NSNumber)
tStates = (dictionary["tStates"] as! NSNumber).intValue
}
@ -115,6 +118,7 @@ fileprivate struct RegisterState {
isHalted = machine.isHalted
tStates = 0 // TODO (?)
memptr = machine.value(for: .memPtr)
}
}
@ -138,7 +142,8 @@ fileprivate func ==(lhs: RegisterState, rhs: RegisterState) -> Bool {
lhs.iff1 == rhs.iff1 &&
lhs.iff2 == rhs.iff2 &&
lhs.interruptMode == rhs.interruptMode &&
lhs.isHalted == rhs.isHalted
lhs.isHalted == rhs.isHalted &&
lhs.memptr == rhs.memptr
}
class FUSETests: XCTestCase {
@ -167,7 +172,7 @@ class FUSETests: XCTestCase {
let name = itemDictionary["name"] as! String
// if name != "02" {
// if name != "01" {
// continue;
// }
// print("\(name)")