mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-11 08:30:55 +00:00
Started towards running the FUSE tests. Just need to deal with the memory
segments.
This commit is contained in:
parent
00cd7e7e9c
commit
3c6f63abcc
@ -97,6 +97,8 @@
|
|||||||
4BAB62AD1D3272D200DF5BA0 /* Disk.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BAB62AB1D3272D200DF5BA0 /* Disk.cpp */; };
|
4BAB62AD1D3272D200DF5BA0 /* Disk.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BAB62AB1D3272D200DF5BA0 /* Disk.cpp */; };
|
||||||
4BAB62B51D327F7E00DF5BA0 /* G64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BAB62B31D327F7E00DF5BA0 /* G64.cpp */; };
|
4BAB62B51D327F7E00DF5BA0 /* G64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BAB62B31D327F7E00DF5BA0 /* G64.cpp */; };
|
||||||
4BAB62B81D3302CA00DF5BA0 /* PCMTrack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BAB62B61D3302CA00DF5BA0 /* PCMTrack.cpp */; };
|
4BAB62B81D3302CA00DF5BA0 /* PCMTrack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BAB62B61D3302CA00DF5BA0 /* PCMTrack.cpp */; };
|
||||||
|
4BB17D4E1ED7909F00ABD1E1 /* tests.expected.json in Resources */ = {isa = PBXBuildFile; fileRef = 4BB17D4C1ED7909F00ABD1E1 /* tests.expected.json */; };
|
||||||
|
4BB17D4F1ED7909F00ABD1E1 /* tests.in.json in Resources */ = {isa = PBXBuildFile; fileRef = 4BB17D4D1ED7909F00ABD1E1 /* tests.in.json */; };
|
||||||
4BB298F11B587D8400A49093 /* start in Resources */ = {isa = PBXBuildFile; fileRef = 4BB297E51B587D8300A49093 /* start */; };
|
4BB298F11B587D8400A49093 /* start in Resources */ = {isa = PBXBuildFile; fileRef = 4BB297E51B587D8300A49093 /* start */; };
|
||||||
4BB298F21B587D8400A49093 /* adca in Resources */ = {isa = PBXBuildFile; fileRef = 4BB297E61B587D8300A49093 /* adca */; };
|
4BB298F21B587D8400A49093 /* adca in Resources */ = {isa = PBXBuildFile; fileRef = 4BB297E61B587D8300A49093 /* adca */; };
|
||||||
4BB298F31B587D8400A49093 /* adcax in Resources */ = {isa = PBXBuildFile; fileRef = 4BB297E71B587D8300A49093 /* adcax */; };
|
4BB298F31B587D8400A49093 /* adcax in Resources */ = {isa = PBXBuildFile; fileRef = 4BB297E71B587D8300A49093 /* adcax */; };
|
||||||
@ -372,8 +374,6 @@
|
|||||||
4BB73EC21B587A5100552FC2 /* Clock_SignalUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BB73EC11B587A5100552FC2 /* Clock_SignalUITests.swift */; };
|
4BB73EC21B587A5100552FC2 /* Clock_SignalUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BB73EC11B587A5100552FC2 /* Clock_SignalUITests.swift */; };
|
||||||
4BBB14311CD2CECE00BDB55C /* IntermediateShader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBB142F1CD2CECE00BDB55C /* IntermediateShader.cpp */; };
|
4BBB14311CD2CECE00BDB55C /* IntermediateShader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBB142F1CD2CECE00BDB55C /* IntermediateShader.cpp */; };
|
||||||
4BBF49AF1ED2880200AB3669 /* FUSETests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BBF49AE1ED2880200AB3669 /* FUSETests.swift */; };
|
4BBF49AF1ED2880200AB3669 /* FUSETests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BBF49AE1ED2880200AB3669 /* FUSETests.swift */; };
|
||||||
4BBF49B21ED2881200AB3669 /* tests.expected in Resources */ = {isa = PBXBuildFile; fileRef = 4BBF49B01ED2881200AB3669 /* tests.expected */; };
|
|
||||||
4BBF49B31ED2881200AB3669 /* tests.in in Resources */ = {isa = PBXBuildFile; fileRef = 4BBF49B11ED2881200AB3669 /* tests.in */; };
|
|
||||||
4BBF99141C8FBA6F0075DAFB /* TextureBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBF99081C8FBA6F0075DAFB /* TextureBuilder.cpp */; };
|
4BBF99141C8FBA6F0075DAFB /* TextureBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBF99081C8FBA6F0075DAFB /* TextureBuilder.cpp */; };
|
||||||
4BBF99151C8FBA6F0075DAFB /* CRTOpenGL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBF990A1C8FBA6F0075DAFB /* CRTOpenGL.cpp */; };
|
4BBF99151C8FBA6F0075DAFB /* CRTOpenGL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBF990A1C8FBA6F0075DAFB /* CRTOpenGL.cpp */; };
|
||||||
4BBF99181C8FBA6F0075DAFB /* TextureTarget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBF99121C8FBA6F0075DAFB /* TextureTarget.cpp */; };
|
4BBF99181C8FBA6F0075DAFB /* TextureTarget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBF99121C8FBA6F0075DAFB /* TextureTarget.cpp */; };
|
||||||
@ -603,6 +603,8 @@
|
|||||||
4BAB62B41D327F7E00DF5BA0 /* G64.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = G64.hpp; sourceTree = "<group>"; };
|
4BAB62B41D327F7E00DF5BA0 /* G64.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = G64.hpp; sourceTree = "<group>"; };
|
||||||
4BAB62B61D3302CA00DF5BA0 /* PCMTrack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PCMTrack.cpp; sourceTree = "<group>"; };
|
4BAB62B61D3302CA00DF5BA0 /* PCMTrack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PCMTrack.cpp; sourceTree = "<group>"; };
|
||||||
4BAB62B71D3302CA00DF5BA0 /* PCMTrack.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = PCMTrack.hpp; sourceTree = "<group>"; };
|
4BAB62B71D3302CA00DF5BA0 /* PCMTrack.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = PCMTrack.hpp; sourceTree = "<group>"; };
|
||||||
|
4BB17D4C1ED7909F00ABD1E1 /* tests.expected.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = tests.expected.json; path = FUSE/tests.expected.json; sourceTree = "<group>"; };
|
||||||
|
4BB17D4D1ED7909F00ABD1E1 /* tests.in.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = tests.in.json; path = FUSE/tests.in.json; sourceTree = "<group>"; };
|
||||||
4BB297E51B587D8300A49093 /* start */ = {isa = PBXFileReference; lastKnownFileType = file; path = " start"; sourceTree = "<group>"; };
|
4BB297E51B587D8300A49093 /* start */ = {isa = PBXFileReference; lastKnownFileType = file; path = " start"; sourceTree = "<group>"; };
|
||||||
4BB297E61B587D8300A49093 /* adca */ = {isa = PBXFileReference; lastKnownFileType = file; path = adca; sourceTree = "<group>"; };
|
4BB297E61B587D8300A49093 /* adca */ = {isa = PBXFileReference; lastKnownFileType = file; path = adca; sourceTree = "<group>"; };
|
||||||
4BB297E71B587D8300A49093 /* adcax */ = {isa = PBXFileReference; lastKnownFileType = file; path = adcax; sourceTree = "<group>"; };
|
4BB297E71B587D8300A49093 /* adcax */ = {isa = PBXFileReference; lastKnownFileType = file; path = adcax; sourceTree = "<group>"; };
|
||||||
@ -890,8 +892,6 @@
|
|||||||
4BBB14301CD2CECE00BDB55C /* IntermediateShader.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = IntermediateShader.hpp; sourceTree = "<group>"; };
|
4BBB14301CD2CECE00BDB55C /* IntermediateShader.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = IntermediateShader.hpp; sourceTree = "<group>"; };
|
||||||
4BBC34241D2208B100FFC9DF /* CSFastLoading.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSFastLoading.h; sourceTree = "<group>"; };
|
4BBC34241D2208B100FFC9DF /* CSFastLoading.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSFastLoading.h; sourceTree = "<group>"; };
|
||||||
4BBF49AE1ED2880200AB3669 /* FUSETests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FUSETests.swift; sourceTree = "<group>"; };
|
4BBF49AE1ED2880200AB3669 /* FUSETests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FUSETests.swift; sourceTree = "<group>"; };
|
||||||
4BBF49B01ED2881200AB3669 /* tests.expected */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = tests.expected; path = FUSE/tests.expected; sourceTree = "<group>"; };
|
|
||||||
4BBF49B11ED2881200AB3669 /* tests.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = tests.in; path = FUSE/tests.in; sourceTree = "<group>"; };
|
|
||||||
4BBF99081C8FBA6F0075DAFB /* TextureBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextureBuilder.cpp; sourceTree = "<group>"; };
|
4BBF99081C8FBA6F0075DAFB /* TextureBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextureBuilder.cpp; sourceTree = "<group>"; };
|
||||||
4BBF99091C8FBA6F0075DAFB /* TextureBuilder.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = TextureBuilder.hpp; sourceTree = "<group>"; };
|
4BBF99091C8FBA6F0075DAFB /* TextureBuilder.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = TextureBuilder.hpp; sourceTree = "<group>"; };
|
||||||
4BBF990A1C8FBA6F0075DAFB /* CRTOpenGL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CRTOpenGL.cpp; sourceTree = "<group>"; };
|
4BBF990A1C8FBA6F0075DAFB /* CRTOpenGL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CRTOpenGL.cpp; sourceTree = "<group>"; };
|
||||||
@ -1845,8 +1845,8 @@
|
|||||||
4BBF49B41ED2881600AB3669 /* FUSE */ = {
|
4BBF49B41ED2881600AB3669 /* FUSE */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
4BBF49B01ED2881200AB3669 /* tests.expected */,
|
4BB17D4C1ED7909F00ABD1E1 /* tests.expected.json */,
|
||||||
4BBF49B11ED2881200AB3669 /* tests.in */,
|
4BB17D4D1ED7909F00ABD1E1 /* tests.in.json */,
|
||||||
);
|
);
|
||||||
name = FUSE;
|
name = FUSE;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -2286,6 +2286,7 @@
|
|||||||
4BB298F21B587D8400A49093 /* adca in Resources */,
|
4BB298F21B587D8400A49093 /* adca in Resources */,
|
||||||
4BB299391B587D8400A49093 /* cntdef in Resources */,
|
4BB299391B587D8400A49093 /* cntdef in Resources */,
|
||||||
4BB299591B587D8400A49093 /* flipos in Resources */,
|
4BB299591B587D8400A49093 /* flipos in Resources */,
|
||||||
|
4BB17D4E1ED7909F00ABD1E1 /* tests.expected.json in Resources */,
|
||||||
4BB2998F1B587D8400A49093 /* lsrax in Resources */,
|
4BB2998F1B587D8400A49093 /* lsrax in Resources */,
|
||||||
4BB299001B587D8400A49093 /* andix in Resources */,
|
4BB299001B587D8400A49093 /* andix in Resources */,
|
||||||
4BB2993A1B587D8400A49093 /* cnto2 in Resources */,
|
4BB2993A1B587D8400A49093 /* cnto2 in Resources */,
|
||||||
@ -2337,6 +2338,7 @@
|
|||||||
4BB299C61B587D8400A49093 /* sbcay in Resources */,
|
4BB299C61B587D8400A49093 /* sbcay in Resources */,
|
||||||
4BB299601B587D8400A49093 /* insa in Resources */,
|
4BB299601B587D8400A49093 /* insa in Resources */,
|
||||||
4BB299951B587D8400A49093 /* mmufetch in Resources */,
|
4BB299951B587D8400A49093 /* mmufetch in Resources */,
|
||||||
|
4BB17D4F1ED7909F00ABD1E1 /* tests.in.json in Resources */,
|
||||||
4BB299A71B587D8400A49093 /* phpn in Resources */,
|
4BB299A71B587D8400A49093 /* phpn in Resources */,
|
||||||
4BB299CC1B587D8400A49093 /* sbczx in Resources */,
|
4BB299CC1B587D8400A49093 /* sbczx in Resources */,
|
||||||
4BB299C91B587D8400A49093 /* sbcix in Resources */,
|
4BB299C91B587D8400A49093 /* sbcix in Resources */,
|
||||||
@ -2367,7 +2369,6 @@
|
|||||||
4BB299131B587D8400A49093 /* axsix in Resources */,
|
4BB299131B587D8400A49093 /* axsix in Resources */,
|
||||||
4BB299781B587D8400A49093 /* ldaix in Resources */,
|
4BB299781B587D8400A49093 /* ldaix in Resources */,
|
||||||
4B44EBF71DC9883B00A7820C /* 6502_functional_test.bin in Resources */,
|
4B44EBF71DC9883B00A7820C /* 6502_functional_test.bin in Resources */,
|
||||||
4BBF49B31ED2881200AB3669 /* tests.in in Resources */,
|
|
||||||
4BB299291B587D8400A49093 /* cia2pb7 in Resources */,
|
4BB299291B587D8400A49093 /* cia2pb7 in Resources */,
|
||||||
4BB2994A1B587D8400A49093 /* deca in Resources */,
|
4BB2994A1B587D8400A49093 /* deca in Resources */,
|
||||||
4BB299CA1B587D8400A49093 /* sbciy in Resources */,
|
4BB299CA1B587D8400A49093 /* sbciy in Resources */,
|
||||||
@ -2445,7 +2446,6 @@
|
|||||||
4BB2998D1B587D8400A49093 /* lsezx in Resources */,
|
4BB2998D1B587D8400A49093 /* lsezx in Resources */,
|
||||||
4BB299811B587D8400A49093 /* ldya in Resources */,
|
4BB299811B587D8400A49093 /* ldya in Resources */,
|
||||||
4BB299991B587D8400A49093 /* nopb in Resources */,
|
4BB299991B587D8400A49093 /* nopb in Resources */,
|
||||||
4BBF49B21ED2881200AB3669 /* tests.expected in Resources */,
|
|
||||||
4BB299581B587D8400A49093 /* finish in Resources */,
|
4BB299581B587D8400A49093 /* finish in Resources */,
|
||||||
4BB299D11B587D8400A49093 /* shaay in Resources */,
|
4BB299D11B587D8400A49093 /* shaay in Resources */,
|
||||||
4BB299A21B587D8400A49093 /* oraix in Resources */,
|
4BB299A21B587D8400A49093 /* oraix in Resources */,
|
||||||
|
@ -51,37 +51,33 @@ fileprivate struct RegisterState {
|
|||||||
// TODO: isHalted
|
// TODO: isHalted
|
||||||
}
|
}
|
||||||
|
|
||||||
init(scanner: Scanner) {
|
init(dictionary: [String: Any]) {
|
||||||
af = readHexInt16(from: scanner)
|
af = UInt16((dictionary["af"] as! NSNumber).int32Value)
|
||||||
bc = readHexInt16(from: scanner)
|
bc = UInt16((dictionary["bc"] as! NSNumber).int32Value)
|
||||||
de = readHexInt16(from: scanner)
|
de = UInt16((dictionary["de"] as! NSNumber).int32Value)
|
||||||
hl = readHexInt16(from: scanner)
|
hl = UInt16((dictionary["hl"] as! NSNumber).int32Value)
|
||||||
|
|
||||||
afDash = readHexInt16(from: scanner)
|
afDash = UInt16((dictionary["afDash"] as! NSNumber).int32Value)
|
||||||
bcDash = readHexInt16(from: scanner)
|
bcDash = UInt16((dictionary["bcDash"] as! NSNumber).int32Value)
|
||||||
deDash = readHexInt16(from: scanner)
|
deDash = UInt16((dictionary["deDash"] as! NSNumber).int32Value)
|
||||||
hlDash = readHexInt16(from: scanner)
|
hlDash = UInt16((dictionary["hlDash"] as! NSNumber).int32Value)
|
||||||
|
|
||||||
ix = readHexInt16(from: scanner)
|
ix = UInt16((dictionary["ix"] as! NSNumber).int32Value)
|
||||||
iy = readHexInt16(from: scanner)
|
iy = UInt16((dictionary["iy"] as! NSNumber).int32Value)
|
||||||
|
|
||||||
sp = readHexInt16(from: scanner)
|
sp = UInt16((dictionary["sp"] as! NSNumber).int32Value)
|
||||||
pc = readHexInt16(from: scanner)
|
pc = UInt16((dictionary["pc"] as! NSNumber).int32Value)
|
||||||
|
|
||||||
i = readHexInt8(from: scanner)
|
i = UInt8((dictionary["i"] as! NSNumber).int32Value)
|
||||||
r = readHexInt8(from: scanner)
|
r = UInt8((dictionary["r"] as! NSNumber).int32Value)
|
||||||
|
|
||||||
iff1 = readHexInt8(from: scanner) != 0
|
iff1 = (dictionary["iff1"] as! NSNumber).boolValue
|
||||||
iff2 = readHexInt8(from: scanner) != 0
|
iff2 = (dictionary["iff2"] as! NSNumber).boolValue
|
||||||
|
|
||||||
var temporary: UInt32 = 0
|
interruptMode = (dictionary["im"] as! NSNumber).intValue
|
||||||
scanner.scanHexInt32(&temporary)
|
isHalted = (dictionary["halted"] as! NSNumber).boolValue
|
||||||
interruptMode = Int(temporary)
|
|
||||||
|
|
||||||
isHalted = readHexInt8(from: scanner) == 1
|
tStates = (dictionary["tStates"] as! NSNumber).intValue
|
||||||
|
|
||||||
scanner.scanHexInt32(&temporary)
|
|
||||||
tStates = Int(temporary)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
init(machine: CSTestMachineZ80) {
|
init(machine: CSTestMachineZ80) {
|
||||||
@ -139,90 +135,40 @@ fileprivate func ==(lhs: RegisterState, rhs: RegisterState) -> Bool {
|
|||||||
class FUSETests: XCTestCase {
|
class FUSETests: XCTestCase {
|
||||||
|
|
||||||
func testFUSE() {
|
func testFUSE() {
|
||||||
if let inputFilename = Bundle(for: type(of: self)).path(forResource: "tests", ofType: "in"),
|
let inputFilename: String! = Bundle(for: type(of: self)).path(forResource: "tests.in", ofType: "json")
|
||||||
let outputFilename = Bundle(for: type(of: self)).path(forResource: "tests", ofType: "expected") {
|
let outputFilename: String! = Bundle(for: type(of: self)).path(forResource: "tests.expected", ofType: "json")
|
||||||
if let input = try? String(contentsOf: URL(fileURLWithPath: inputFilename), encoding: .utf8),
|
|
||||||
let output = try? String(contentsOf: URL(fileURLWithPath: outputFilename), encoding: .utf8) {
|
|
||||||
|
|
||||||
let inputScanner = Scanner(string: input)
|
XCTAssert(inputFilename != nil && outputFilename != nil)
|
||||||
let outputScanner = Scanner(string: output)
|
|
||||||
|
|
||||||
while !inputScanner.isAtEnd {
|
let inputData: Data! = try? Data(contentsOf: URL(fileURLWithPath: inputFilename))
|
||||||
autoreleasepool {
|
let outputData: Data! = try? Data(contentsOf: URL(fileURLWithPath: outputFilename))
|
||||||
var inputName: NSString?, outputName: NSString?
|
|
||||||
inputScanner.scanUpToCharacters(from: CharacterSet.newlines, into: &inputName)
|
|
||||||
outputScanner.scanUpToCharacters(from: CharacterSet.newlines, into: &outputName)
|
|
||||||
|
|
||||||
var outputBlock = ""
|
XCTAssert(inputData != nil && outputData != nil)
|
||||||
while true {
|
|
||||||
var nextLine: NSString?
|
|
||||||
outputScanner.scanUpTo("\n", into: &nextLine)
|
|
||||||
if let nextLine = nextLine {
|
|
||||||
print("!\(nextLine)")
|
|
||||||
outputBlock = outputBlock + " " + (nextLine as String)
|
|
||||||
if nextLine.length == 0 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if let inputName = inputName, let outputName = outputName {
|
let inputArray: [Any]! = try! JSONSerialization.jsonObject(with: inputData, options: []) as? [Any]
|
||||||
XCTAssertEqual(outputName, inputName)
|
let outputArray: [Any]! = try! JSONSerialization.jsonObject(with: outputData, options: []) as? [Any]
|
||||||
|
|
||||||
let machine = CSTestMachineZ80()
|
XCTAssert(inputArray != nil && outputArray != nil)
|
||||||
let initialState = RegisterState(scanner: inputScanner)
|
|
||||||
initialState.set(onMachine: machine)
|
|
||||||
|
|
||||||
while true {
|
var index = 0
|
||||||
var address: UInt32 = 0
|
for item in inputArray {
|
||||||
var negative: Int = 0
|
let itemDictionary = item as! [String: Any]
|
||||||
if inputScanner.scanHexInt32(&address) {
|
let outputDictionary = outputArray[index] as! [String: Any]
|
||||||
while true {
|
|
||||||
var value: UInt32 = 0
|
|
||||||
if inputScanner.scanHexInt32(&value) {
|
|
||||||
machine.setValue(UInt8(value), atAddress: UInt16(address))
|
|
||||||
address = address + 1
|
|
||||||
} else {
|
|
||||||
inputScanner.scanInt(&negative)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
inputScanner.scanInt(&negative)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
print("\(inputName)")
|
let initialState = RegisterState(dictionary: itemDictionary["state"] as! [String: Any])
|
||||||
|
let targetState = RegisterState(dictionary: outputDictionary["state"] as! [String: Any])
|
||||||
|
|
||||||
machine.captureBusActivity = true
|
let machine = CSTestMachineZ80()
|
||||||
machine.runForNumber(ofCycles: Int32(initialState.tStates))
|
initialState.set(onMachine: machine)
|
||||||
machine.runToNextInstruction()
|
|
||||||
|
|
||||||
// test that trapped memory accesses are correct
|
// machine.runForNumber(ofCycles: Int32(initialState.tStates))
|
||||||
while true {
|
// machine.runToNextInstruction()
|
||||||
var indentation: NSString?
|
|
||||||
outputScanner.scanCharacters(from: CharacterSet.whitespaces, into: &indentation)
|
|
||||||
if indentation == nil {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
var nextMemoryAccess: NSString?
|
// let finalState = RegisterState(machine: machine)
|
||||||
outputScanner.scanUpToCharacters(from: CharacterSet.newlines, into: &nextMemoryAccess)
|
|
||||||
print("\(indentation!): \(nextMemoryAccess)")
|
|
||||||
}
|
|
||||||
|
|
||||||
let finalState = RegisterState(machine: machine)
|
print("\(initialState) -> \(targetState)")
|
||||||
|
|
||||||
|
index = index + 1
|
||||||
|
|
||||||
print("\(machine.busOperationCaptures)")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user