mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-26 23:52:26 +00:00
Renamed TestMachine
to TestMachine6502
since there's going to be multiple of them.
This commit is contained in:
parent
7da51602d5
commit
df80c37adb
@ -44,7 +44,7 @@
|
|||||||
4B3BA0CE1D318B44005DD7A7 /* C1540Bridge.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B3BA0C61D318B44005DD7A7 /* C1540Bridge.mm */; };
|
4B3BA0CE1D318B44005DD7A7 /* C1540Bridge.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B3BA0C61D318B44005DD7A7 /* C1540Bridge.mm */; };
|
||||||
4B3BA0CF1D318B44005DD7A7 /* MOS6522Bridge.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B3BA0C91D318B44005DD7A7 /* MOS6522Bridge.mm */; };
|
4B3BA0CF1D318B44005DD7A7 /* MOS6522Bridge.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B3BA0C91D318B44005DD7A7 /* MOS6522Bridge.mm */; };
|
||||||
4B3BA0D01D318B44005DD7A7 /* MOS6532Bridge.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B3BA0CB1D318B44005DD7A7 /* MOS6532Bridge.mm */; };
|
4B3BA0D01D318B44005DD7A7 /* MOS6532Bridge.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B3BA0CB1D318B44005DD7A7 /* MOS6532Bridge.mm */; };
|
||||||
4B3BA0D11D318B44005DD7A7 /* TestMachine.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B3BA0CD1D318B44005DD7A7 /* TestMachine.mm */; };
|
4B3BA0D11D318B44005DD7A7 /* TestMachine6502.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B3BA0CD1D318B44005DD7A7 /* TestMachine6502.mm */; };
|
||||||
4B3F1B461E0388D200DB26EE /* PCMPatchedTrack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B3F1B441E0388D200DB26EE /* PCMPatchedTrack.cpp */; };
|
4B3F1B461E0388D200DB26EE /* PCMPatchedTrack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B3F1B441E0388D200DB26EE /* PCMPatchedTrack.cpp */; };
|
||||||
4B44EBF51DC987AF00A7820C /* AllSuiteA.bin in Resources */ = {isa = PBXBuildFile; fileRef = 4B44EBF41DC987AE00A7820C /* AllSuiteA.bin */; };
|
4B44EBF51DC987AF00A7820C /* AllSuiteA.bin in Resources */ = {isa = PBXBuildFile; fileRef = 4B44EBF41DC987AE00A7820C /* AllSuiteA.bin */; };
|
||||||
4B44EBF71DC9883B00A7820C /* 6502_functional_test.bin in Resources */ = {isa = PBXBuildFile; fileRef = 4B44EBF61DC9883B00A7820C /* 6502_functional_test.bin */; };
|
4B44EBF71DC9883B00A7820C /* 6502_functional_test.bin in Resources */ = {isa = PBXBuildFile; fileRef = 4B44EBF61DC9883B00A7820C /* 6502_functional_test.bin */; };
|
||||||
@ -504,8 +504,8 @@
|
|||||||
4B3BA0C91D318B44005DD7A7 /* MOS6522Bridge.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MOS6522Bridge.mm; sourceTree = "<group>"; };
|
4B3BA0C91D318B44005DD7A7 /* MOS6522Bridge.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MOS6522Bridge.mm; sourceTree = "<group>"; };
|
||||||
4B3BA0CA1D318B44005DD7A7 /* MOS6532Bridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MOS6532Bridge.h; sourceTree = "<group>"; };
|
4B3BA0CA1D318B44005DD7A7 /* MOS6532Bridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MOS6532Bridge.h; sourceTree = "<group>"; };
|
||||||
4B3BA0CB1D318B44005DD7A7 /* MOS6532Bridge.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MOS6532Bridge.mm; sourceTree = "<group>"; };
|
4B3BA0CB1D318B44005DD7A7 /* MOS6532Bridge.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MOS6532Bridge.mm; sourceTree = "<group>"; };
|
||||||
4B3BA0CC1D318B44005DD7A7 /* TestMachine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestMachine.h; sourceTree = "<group>"; };
|
4B3BA0CC1D318B44005DD7A7 /* TestMachine6502.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestMachine6502.h; sourceTree = "<group>"; };
|
||||||
4B3BA0CD1D318B44005DD7A7 /* TestMachine.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TestMachine.mm; sourceTree = "<group>"; };
|
4B3BA0CD1D318B44005DD7A7 /* TestMachine6502.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TestMachine6502.mm; sourceTree = "<group>"; };
|
||||||
4B3F1B441E0388D200DB26EE /* PCMPatchedTrack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PCMPatchedTrack.cpp; sourceTree = "<group>"; };
|
4B3F1B441E0388D200DB26EE /* PCMPatchedTrack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PCMPatchedTrack.cpp; sourceTree = "<group>"; };
|
||||||
4B3F1B451E0388D200DB26EE /* PCMPatchedTrack.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = PCMPatchedTrack.hpp; sourceTree = "<group>"; };
|
4B3F1B451E0388D200DB26EE /* PCMPatchedTrack.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = PCMPatchedTrack.hpp; sourceTree = "<group>"; };
|
||||||
4B44EBF41DC987AE00A7820C /* AllSuiteA.bin */ = {isa = PBXFileReference; lastKnownFileType = archive.macbinary; name = AllSuiteA.bin; path = AllSuiteA/AllSuiteA.bin; sourceTree = "<group>"; };
|
4B44EBF41DC987AE00A7820C /* AllSuiteA.bin */ = {isa = PBXFileReference; lastKnownFileType = archive.macbinary; name = AllSuiteA.bin; path = AllSuiteA/AllSuiteA.bin; sourceTree = "<group>"; };
|
||||||
@ -1176,12 +1176,12 @@
|
|||||||
4BEF6AA81D35CE9E00E73575 /* DigitalPhaseLockedLoopBridge.h */,
|
4BEF6AA81D35CE9E00E73575 /* DigitalPhaseLockedLoopBridge.h */,
|
||||||
4B3BA0C81D318B44005DD7A7 /* MOS6522Bridge.h */,
|
4B3BA0C81D318B44005DD7A7 /* MOS6522Bridge.h */,
|
||||||
4B3BA0CA1D318B44005DD7A7 /* MOS6532Bridge.h */,
|
4B3BA0CA1D318B44005DD7A7 /* MOS6532Bridge.h */,
|
||||||
4B3BA0CC1D318B44005DD7A7 /* TestMachine.h */,
|
4B3BA0CC1D318B44005DD7A7 /* TestMachine6502.h */,
|
||||||
4B3BA0C61D318B44005DD7A7 /* C1540Bridge.mm */,
|
4B3BA0C61D318B44005DD7A7 /* C1540Bridge.mm */,
|
||||||
4BEF6AA91D35CE9E00E73575 /* DigitalPhaseLockedLoopBridge.mm */,
|
4BEF6AA91D35CE9E00E73575 /* DigitalPhaseLockedLoopBridge.mm */,
|
||||||
4B3BA0C91D318B44005DD7A7 /* MOS6522Bridge.mm */,
|
4B3BA0C91D318B44005DD7A7 /* MOS6522Bridge.mm */,
|
||||||
4B3BA0CB1D318B44005DD7A7 /* MOS6532Bridge.mm */,
|
4B3BA0CB1D318B44005DD7A7 /* MOS6532Bridge.mm */,
|
||||||
4B3BA0CD1D318B44005DD7A7 /* TestMachine.mm */,
|
4B3BA0CD1D318B44005DD7A7 /* TestMachine6502.mm */,
|
||||||
);
|
);
|
||||||
path = Bridges;
|
path = Bridges;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -2553,7 +2553,7 @@
|
|||||||
4B50730A1DDFCFDF00C48FBD /* ArrayBuilderTests.mm in Sources */,
|
4B50730A1DDFCFDF00C48FBD /* ArrayBuilderTests.mm in Sources */,
|
||||||
4B2AF8691E513FC20027EE29 /* TIATests.mm in Sources */,
|
4B2AF8691E513FC20027EE29 /* TIATests.mm in Sources */,
|
||||||
4B3BA0CE1D318B44005DD7A7 /* C1540Bridge.mm in Sources */,
|
4B3BA0CE1D318B44005DD7A7 /* C1540Bridge.mm in Sources */,
|
||||||
4B3BA0D11D318B44005DD7A7 /* TestMachine.mm in Sources */,
|
4B3BA0D11D318B44005DD7A7 /* TestMachine6502.mm in Sources */,
|
||||||
4B92EACA1B7C112B00246143 /* 6502TimingTests.swift in Sources */,
|
4B92EACA1B7C112B00246143 /* 6502TimingTests.swift in Sources */,
|
||||||
4BB73EB71B587A5100552FC2 /* AllSuiteATests.swift in Sources */,
|
4BB73EB71B587A5100552FC2 /* AllSuiteATests.swift in Sources */,
|
||||||
4B121F9B1E06293F00BFDA12 /* PCMSegmentEventSourceTests.mm in Sources */,
|
4B121F9B1E06293F00BFDA12 /* PCMSegmentEventSourceTests.mm in Sources */,
|
||||||
|
@ -10,12 +10,12 @@ import XCTest
|
|||||||
|
|
||||||
class MOS6502InterruptTests: XCTestCase {
|
class MOS6502InterruptTests: XCTestCase {
|
||||||
|
|
||||||
var machine: CSTestMachine! = nil
|
var machine: CSTestMachine6502! = nil
|
||||||
override func setUp() {
|
override func setUp() {
|
||||||
super.setUp()
|
super.setUp()
|
||||||
|
|
||||||
// create a machine full of NOPs
|
// create a machine full of NOPs
|
||||||
machine = CSTestMachine()
|
machine = CSTestMachine6502()
|
||||||
for c in 0...65535 {
|
for c in 0...65535 {
|
||||||
machine.setValue(0xea, forAddress: UInt16(c))
|
machine.setValue(0xea, forAddress: UInt16(c))
|
||||||
}
|
}
|
||||||
@ -28,7 +28,7 @@ class MOS6502InterruptTests: XCTestCase {
|
|||||||
machine.setValue(0x58, forAddress: 0x4000)
|
machine.setValue(0x58, forAddress: 0x4000)
|
||||||
|
|
||||||
// pick things off at 0x4000
|
// pick things off at 0x4000
|
||||||
machine.setValue(0x4000, for: CSTestMachineRegister.programCounter)
|
machine.setValue(0x4000, for: CSTestMachine6502Register.programCounter)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testIRQLine() {
|
func testIRQLine() {
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|
||||||
class MOS6502TimingTests: XCTestCase, CSTestMachineJamHandler {
|
class MOS6502TimingTests: XCTestCase, CSTestMachine6502JamHandler {
|
||||||
|
|
||||||
fileprivate var endTime: UInt32 = 0
|
fileprivate var endTime: UInt32 = 0
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ class MOS6502TimingTests: XCTestCase, CSTestMachineJamHandler {
|
|||||||
0xca, // [2] DEX
|
0xca, // [2] DEX
|
||||||
0x18, // [2] CLC
|
0x18, // [2] CLC
|
||||||
0x2a, // [2] ROL A
|
0x2a, // [2] ROL A
|
||||||
CSTestMachineJamOpcode]
|
CSTestMachine6502JamOpcode]
|
||||||
self.runTest(code, expectedRunLength: 10)
|
self.runTest(code, expectedRunLength: 10)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ class MOS6502TimingTests: XCTestCase, CSTestMachineJamHandler {
|
|||||||
0xa1, 0x44, // [6] LDA ($44, x)
|
0xa1, 0x44, // [6] LDA ($44, x)
|
||||||
0xb1, 0x00, // [5] LDA ($00), y (no wrap)
|
0xb1, 0x00, // [5] LDA ($00), y (no wrap)
|
||||||
0xb1, 0x02, // [6] LDA ($01), y (wrap)
|
0xb1, 0x02, // [6] LDA ($01), y (wrap)
|
||||||
CSTestMachineJamOpcode]
|
CSTestMachine6502JamOpcode]
|
||||||
self.runTest(code, expectedRunLength: 48)
|
self.runTest(code, expectedRunLength: 48)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ class MOS6502TimingTests: XCTestCase, CSTestMachineJamHandler {
|
|||||||
let code: [UInt8] = [
|
let code: [UInt8] = [
|
||||||
0x24, 0x2a, // [3] BIT $2a
|
0x24, 0x2a, // [3] BIT $2a
|
||||||
0x2c, 0x2a, 0x2b, // [4] BIT $2b2a
|
0x2c, 0x2a, 0x2b, // [4] BIT $2b2a
|
||||||
CSTestMachineJamOpcode]
|
CSTestMachine6502JamOpcode]
|
||||||
self.runTest(code, expectedRunLength: 7)
|
self.runTest(code, expectedRunLength: 7)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ class MOS6502TimingTests: XCTestCase, CSTestMachineJamHandler {
|
|||||||
0x81, 0x44, // [6] STA ($44, x)
|
0x81, 0x44, // [6] STA ($44, x)
|
||||||
0x91, 0x00, // [6] STA ($00), y (no wrap)
|
0x91, 0x00, // [6] STA ($00), y (no wrap)
|
||||||
0x91, 0x02, // [6] STA ($01), y (wrap)
|
0x91, 0x02, // [6] STA ($01), y (wrap)
|
||||||
CSTestMachineJamOpcode]
|
CSTestMachine6502JamOpcode]
|
||||||
self.runTest(code, expectedRunLength: 49)
|
self.runTest(code, expectedRunLength: 49)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,14 +72,14 @@ class MOS6502TimingTests: XCTestCase, CSTestMachineJamHandler {
|
|||||||
0xee, 0x00, 0x00, // [6] INC $0000
|
0xee, 0x00, 0x00, // [6] INC $0000
|
||||||
0xfe, 0x00, 0x00, // [7] INC $0000, x (no wrap)
|
0xfe, 0x00, 0x00, // [7] INC $0000, x (no wrap)
|
||||||
0xfe, 0x02, 0x00, // [7] INC $0002, x (wrap)
|
0xfe, 0x02, 0x00, // [7] INC $0002, x (wrap)
|
||||||
CSTestMachineJamOpcode]
|
CSTestMachine6502JamOpcode]
|
||||||
self.runTest(code, expectedRunLength: 31)
|
self.runTest(code, expectedRunLength: 31)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testJSR() {
|
func testJSR() {
|
||||||
let code: [UInt8] = [
|
let code: [UInt8] = [
|
||||||
0x20, 0x04, 0x02, // [6] JSR $0204
|
0x20, 0x04, 0x02, // [6] JSR $0204
|
||||||
CSTestMachineJamOpcode,
|
CSTestMachine6502JamOpcode,
|
||||||
0x60, // [6] RTS
|
0x60, // [6] RTS
|
||||||
]
|
]
|
||||||
self.runTest(code, expectedRunLength: 12)
|
self.runTest(code, expectedRunLength: 12)
|
||||||
@ -90,7 +90,7 @@ class MOS6502TimingTests: XCTestCase, CSTestMachineJamHandler {
|
|||||||
0x6c, 0x04, 0x00, // [5] JMP ($0004)
|
0x6c, 0x04, 0x00, // [5] JMP ($0004)
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x4c, 0x0b, 0x02, // [3] JMP 020b
|
0x4c, 0x0b, 0x02, // [3] JMP 020b
|
||||||
CSTestMachineJamOpcode,
|
CSTestMachine6502JamOpcode,
|
||||||
]
|
]
|
||||||
self.runTest(code, expectedRunLength: 8)
|
self.runTest(code, expectedRunLength: 8)
|
||||||
}
|
}
|
||||||
@ -100,7 +100,7 @@ class MOS6502TimingTests: XCTestCase, CSTestMachineJamHandler {
|
|||||||
0x48, // [3] PHA
|
0x48, // [3] PHA
|
||||||
0x48, // [3] PHA
|
0x48, // [3] PHA
|
||||||
0x68, // [4] PLA
|
0x68, // [4] PLA
|
||||||
CSTestMachineJamOpcode,
|
CSTestMachine6502JamOpcode,
|
||||||
]
|
]
|
||||||
self.runTest(code, expectedRunLength: 10)
|
self.runTest(code, expectedRunLength: 10)
|
||||||
}
|
}
|
||||||
@ -128,7 +128,7 @@ class MOS6502TimingTests: XCTestCase, CSTestMachineJamHandler {
|
|||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
CSTestMachineJamOpcode]
|
CSTestMachine6502JamOpcode]
|
||||||
self.runTest(code, expectedRunLength: 14)
|
self.runTest(code, expectedRunLength: 14)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ class MOS6502TimingTests: XCTestCase, CSTestMachineJamHandler {
|
|||||||
let code: [UInt8] = [
|
let code: [UInt8] = [
|
||||||
0x8d, 0x08, 0x00, // [4] STA $0008
|
0x8d, 0x08, 0x00, // [4] STA $0008
|
||||||
0xc6, 0xb4, // [5] DEC $B4
|
0xc6, 0xb4, // [5] DEC $B4
|
||||||
CSTestMachineJamOpcode]
|
CSTestMachine6502JamOpcode]
|
||||||
self.runTest(code, expectedRunLength: 9)
|
self.runTest(code, expectedRunLength: 9)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,14 +144,14 @@ class MOS6502TimingTests: XCTestCase, CSTestMachineJamHandler {
|
|||||||
let code: [UInt8] = [
|
let code: [UInt8] = [
|
||||||
0x16, 0x16, // [6] ASL $16, x
|
0x16, 0x16, // [6] ASL $16, x
|
||||||
0x46, 0x46, // [5] LSR $46
|
0x46, 0x46, // [5] LSR $46
|
||||||
CSTestMachineJamOpcode]
|
CSTestMachine6502JamOpcode]
|
||||||
self.runTest(code, expectedRunLength: 11)
|
self.runTest(code, expectedRunLength: 11)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSnippet3() {
|
func testSnippet3() {
|
||||||
let code: [UInt8] = [
|
let code: [UInt8] = [
|
||||||
0x20, 0x04, 0x02, // [6] JSR $0204
|
0x20, 0x04, 0x02, // [6] JSR $0204
|
||||||
CSTestMachineJamOpcode,
|
CSTestMachine6502JamOpcode,
|
||||||
0x86, 0x09, // [3] STX $09
|
0x86, 0x09, // [3] STX $09
|
||||||
0x86, 0x09, // [3] STX $09
|
0x86, 0x09, // [3] STX $09
|
||||||
0x85, 0x09, // [3] STA $09
|
0x85, 0x09, // [3] STA $09
|
||||||
@ -171,7 +171,7 @@ class MOS6502TimingTests: XCTestCase, CSTestMachineJamHandler {
|
|||||||
0x86, 0x09, // [3] STX $09
|
0x86, 0x09, // [3] STX $09
|
||||||
0x87, 0x09, // [3] SAX $09
|
0x87, 0x09, // [3] SAX $09
|
||||||
0x60, // [6] RTS
|
0x60, // [6] RTS
|
||||||
CSTestMachineJamOpcode]
|
CSTestMachine6502JamOpcode]
|
||||||
self.runTest(code, expectedRunLength: 66)
|
self.runTest(code, expectedRunLength: 66)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,12 +191,12 @@ class MOS6502TimingTests: XCTestCase, CSTestMachineJamHandler {
|
|||||||
0xd4, 0x00, // [4] NOP zpg, x
|
0xd4, 0x00, // [4] NOP zpg, x
|
||||||
0xe2, 0x00, // [2] NOP #
|
0xe2, 0x00, // [2] NOP #
|
||||||
0xf4, 0x00, // [4] NOP zpg, x
|
0xf4, 0x00, // [4] NOP zpg, x
|
||||||
CSTestMachineJamOpcode]
|
CSTestMachine6502JamOpcode]
|
||||||
self.runTest(code, expectedRunLength: 43)
|
self.runTest(code, expectedRunLength: 43)
|
||||||
}
|
}
|
||||||
|
|
||||||
func runTest(_ code: [UInt8], expectedRunLength: UInt32) {
|
func runTest(_ code: [UInt8], expectedRunLength: UInt32) {
|
||||||
let machine = CSTestMachine()
|
let machine = CSTestMachine6502()
|
||||||
|
|
||||||
machine.jamHandler = self
|
machine.jamHandler = self
|
||||||
|
|
||||||
@ -208,9 +208,9 @@ class MOS6502TimingTests: XCTestCase, CSTestMachineJamHandler {
|
|||||||
machine.setValue(0x00, forAddress: 0x0003)
|
machine.setValue(0x00, forAddress: 0x0003)
|
||||||
machine.setValue(0x08, forAddress: 0x0004)
|
machine.setValue(0x08, forAddress: 0x0004)
|
||||||
machine.setValue(0x02, forAddress: 0x0005)
|
machine.setValue(0x02, forAddress: 0x0005)
|
||||||
machine.setValue(0x200, for: CSTestMachineRegister.programCounter)
|
machine.setValue(0x200, for: CSTestMachine6502Register.programCounter)
|
||||||
machine.setValue(0xff, for: CSTestMachineRegister.X)
|
machine.setValue(0xff, for: CSTestMachine6502Register.X)
|
||||||
machine.setValue(0xfe, for: CSTestMachineRegister.Y)
|
machine.setValue(0xfe, for: CSTestMachine6502Register.Y)
|
||||||
|
|
||||||
self.endTime = 0
|
self.endTime = 0
|
||||||
while self.endTime == 0 {
|
while self.endTime == 0 {
|
||||||
@ -220,7 +220,7 @@ class MOS6502TimingTests: XCTestCase, CSTestMachineJamHandler {
|
|||||||
XCTAssert(self.endTime == expectedRunLength, "Took \(self.endTime) cycles to perform rather than \(expectedRunLength)")
|
XCTAssert(self.endTime == expectedRunLength, "Took \(self.endTime) cycles to perform rather than \(expectedRunLength)")
|
||||||
}
|
}
|
||||||
|
|
||||||
func testMachine(_ machine: CSTestMachine!, didJamAtAddress address: UInt16) {
|
func testMachine(_ machine: CSTestMachine6502!, didJamAtAddress address: UInt16) {
|
||||||
if self.endTime == 0 {
|
if self.endTime == 0 {
|
||||||
self.endTime = machine.timestamp - 9
|
self.endTime = machine.timestamp - 9
|
||||||
}
|
}
|
||||||
|
@ -14,12 +14,12 @@ class AllSuiteATests: XCTestCase {
|
|||||||
func testAllSuiteA() {
|
func testAllSuiteA() {
|
||||||
if let filename = Bundle(for: type(of: self)).path(forResource: "AllSuiteA", ofType: "bin") {
|
if let filename = Bundle(for: type(of: self)).path(forResource: "AllSuiteA", ofType: "bin") {
|
||||||
if let allSuiteA = try? Data(contentsOf: URL(fileURLWithPath: filename)) {
|
if let allSuiteA = try? Data(contentsOf: URL(fileURLWithPath: filename)) {
|
||||||
let machine = CSTestMachine()
|
let machine = CSTestMachine6502()
|
||||||
|
|
||||||
machine.setData(allSuiteA, atAddress: 0x4000)
|
machine.setData(allSuiteA, atAddress: 0x4000)
|
||||||
machine.setValue(CSTestMachineJamOpcode, forAddress:0x45c0); // end
|
machine.setValue(CSTestMachine6502JamOpcode, forAddress:0x45c0); // end
|
||||||
|
|
||||||
machine.setValue(0x4000, for: CSTestMachineRegister.programCounter)
|
machine.setValue(0x4000, for: CSTestMachine6502Register.programCounter)
|
||||||
while !machine.isJammed {
|
while !machine.isJammed {
|
||||||
machine.runForNumber(ofCycles: 1000)
|
machine.runForNumber(ofCycles: 1000)
|
||||||
}
|
}
|
||||||
|
@ -9,12 +9,12 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|
||||||
class BCDTest: XCTestCase, CSTestMachineJamHandler {
|
class BCDTest: XCTestCase, CSTestMachine6502JamHandler {
|
||||||
|
|
||||||
func testBCD() {
|
func testBCD() {
|
||||||
if let filename = Bundle(for: type(of: self)).path(forResource: "BCDTEST_beeb", ofType: nil) {
|
if let filename = Bundle(for: type(of: self)).path(forResource: "BCDTEST_beeb", ofType: nil) {
|
||||||
if let bcdTest = try? Data(contentsOf: URL(fileURLWithPath: filename)) {
|
if let bcdTest = try? Data(contentsOf: URL(fileURLWithPath: filename)) {
|
||||||
let machine = CSTestMachine()
|
let machine = CSTestMachine6502()
|
||||||
machine.jamHandler = self
|
machine.jamHandler = self
|
||||||
|
|
||||||
machine.setData(bcdTest, atAddress: 0x2900)
|
machine.setData(bcdTest, atAddress: 0x2900)
|
||||||
@ -27,10 +27,10 @@ class BCDTest: XCTestCase, CSTestMachineJamHandler {
|
|||||||
machine.setValue(0x03, forAddress:0x204)
|
machine.setValue(0x03, forAddress:0x204)
|
||||||
machine.setValue(0x02, forAddress:0x205)
|
machine.setValue(0x02, forAddress:0x205)
|
||||||
|
|
||||||
machine.setValue(0x200, for: CSTestMachineRegister.programCounter)
|
machine.setValue(0x200, for: CSTestMachine6502Register.programCounter)
|
||||||
|
|
||||||
machine.setValue(CSTestMachineJamOpcode, forAddress:0xffee) // OSWRCH
|
machine.setValue(CSTestMachine6502JamOpcode, forAddress:0xffee) // OSWRCH
|
||||||
machine.setValue(CSTestMachineJamOpcode, forAddress:0xffff) // end of test
|
machine.setValue(CSTestMachine6502JamOpcode, forAddress:0xffff) // end of test
|
||||||
|
|
||||||
while(machine.value(for: .programCounter) != 0x203) {
|
while(machine.value(for: .programCounter) != 0x203) {
|
||||||
machine.runForNumber(ofCycles: 1000)
|
machine.runForNumber(ofCycles: 1000)
|
||||||
@ -41,11 +41,11 @@ class BCDTest: XCTestCase, CSTestMachineJamHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fileprivate var output: String = ""
|
fileprivate var output: String = ""
|
||||||
func testMachine(_ machine: CSTestMachine!, didJamAtAddress address: UInt16) {
|
func testMachine(_ machine: CSTestMachine6502!, didJamAtAddress address: UInt16) {
|
||||||
|
|
||||||
switch address {
|
switch address {
|
||||||
case 0xffee:
|
case 0xffee:
|
||||||
let character = machine.value(for: CSTestMachineRegister.A)
|
let character = machine.value(for: CSTestMachine6502Register.A)
|
||||||
output.append(Character(UnicodeScalar(character)!))
|
output.append(Character(UnicodeScalar(character)!))
|
||||||
|
|
||||||
machine.returnFromSubroutine()
|
machine.returnFromSubroutine()
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// Use this file to import your target's public headers that you would like to expose to Swift.
|
// Use this file to import your target's public headers that you would like to expose to Swift.
|
||||||
//
|
//
|
||||||
|
|
||||||
#import "TestMachine.h"
|
#import "TestMachine6502.h"
|
||||||
#import "MOS6522Bridge.h"
|
#import "MOS6522Bridge.h"
|
||||||
#import "MOS6532Bridge.h"
|
#import "MOS6532Bridge.h"
|
||||||
#import "C1540Bridge.h"
|
#import "C1540Bridge.h"
|
||||||
|
@ -1,47 +0,0 @@
|
|||||||
//
|
|
||||||
// Machine.h
|
|
||||||
// CLK
|
|
||||||
//
|
|
||||||
// Created by Thomas Harte on 29/06/2015.
|
|
||||||
// Copyright © 2015 Thomas Harte. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
|
||||||
|
|
||||||
typedef NS_ENUM(NSInteger, CSTestMachineRegister) {
|
|
||||||
CSTestMachineRegisterLastOperationAddress,
|
|
||||||
CSTestMachineRegisterProgramCounter,
|
|
||||||
CSTestMachineRegisterStackPointer,
|
|
||||||
CSTestMachineRegisterFlags,
|
|
||||||
CSTestMachineRegisterA,
|
|
||||||
CSTestMachineRegisterX,
|
|
||||||
CSTestMachineRegisterY,
|
|
||||||
};
|
|
||||||
|
|
||||||
extern const uint8_t CSTestMachineJamOpcode;
|
|
||||||
|
|
||||||
@class CSTestMachine;
|
|
||||||
@protocol CSTestMachineJamHandler <NSObject>
|
|
||||||
- (void)testMachine:(CSTestMachine *)machine didJamAtAddress:(uint16_t)address;
|
|
||||||
@end
|
|
||||||
|
|
||||||
@interface CSTestMachine : NSObject
|
|
||||||
|
|
||||||
- (void)setData:(NSData *)data atAddress:(uint16_t)startAddress;
|
|
||||||
- (void)runForNumberOfCycles:(int)cycles;
|
|
||||||
|
|
||||||
- (void)setValue:(uint8_t)value forAddress:(uint16_t)address;
|
|
||||||
- (uint8_t)valueForAddress:(uint16_t)address;
|
|
||||||
- (void)setValue:(uint16_t)value forRegister:(CSTestMachineRegister)reg;
|
|
||||||
- (uint16_t)valueForRegister:(CSTestMachineRegister)reg;
|
|
||||||
|
|
||||||
//- (void)reset;
|
|
||||||
- (void)returnFromSubroutine;
|
|
||||||
|
|
||||||
@property (nonatomic, readonly) BOOL isJammed;
|
|
||||||
@property (nonatomic, readonly) uint32_t timestamp;
|
|
||||||
@property (nonatomic, weak) id <CSTestMachineJamHandler> jamHandler;
|
|
||||||
@property (nonatomic, assign) BOOL irqLine;
|
|
||||||
@property (nonatomic, assign) BOOL nmiLine;
|
|
||||||
|
|
||||||
@end
|
|
46
OSBindings/Mac/Clock SignalTests/Bridges/TestMachine6502.h
Normal file
46
OSBindings/Mac/Clock SignalTests/Bridges/TestMachine6502.h
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
//
|
||||||
|
// TestMachine6502.h
|
||||||
|
// CLK
|
||||||
|
//
|
||||||
|
// Created by Thomas Harte on 29/06/2015.
|
||||||
|
// Copyright © 2015 Thomas Harte. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
typedef NS_ENUM(NSInteger, CSTestMachine6502Register) {
|
||||||
|
CSTestMachine6502RegisterLastOperationAddress,
|
||||||
|
CSTestMachine6502RegisterProgramCounter,
|
||||||
|
CSTestMachine6502RegisterStackPointer,
|
||||||
|
CSTestMachine6502RegisterFlags,
|
||||||
|
CSTestMachine6502RegisterA,
|
||||||
|
CSTestMachine6502RegisterX,
|
||||||
|
CSTestMachine6502RegisterY,
|
||||||
|
};
|
||||||
|
|
||||||
|
extern const uint8_t CSTestMachine6502JamOpcode;
|
||||||
|
|
||||||
|
@class CSTestMachine6502;
|
||||||
|
@protocol CSTestMachine6502JamHandler <NSObject>
|
||||||
|
- (void)testMachine:(CSTestMachine6502 *)machine didJamAtAddress:(uint16_t)address;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface CSTestMachine6502 : NSObject
|
||||||
|
|
||||||
|
- (void)setData:(NSData *)data atAddress:(uint16_t)startAddress;
|
||||||
|
- (void)runForNumberOfCycles:(int)cycles;
|
||||||
|
|
||||||
|
- (void)setValue:(uint8_t)value forAddress:(uint16_t)address;
|
||||||
|
- (uint8_t)valueForAddress:(uint16_t)address;
|
||||||
|
- (void)setValue:(uint16_t)value forRegister:(CSTestMachine6502Register)reg;
|
||||||
|
- (uint16_t)valueForRegister:(CSTestMachine6502Register)reg;
|
||||||
|
|
||||||
|
- (void)returnFromSubroutine;
|
||||||
|
|
||||||
|
@property (nonatomic, readonly) BOOL isJammed;
|
||||||
|
@property (nonatomic, readonly) uint32_t timestamp;
|
||||||
|
@property (nonatomic, weak) id <CSTestMachine6502JamHandler> jamHandler;
|
||||||
|
@property (nonatomic, assign) BOOL irqLine;
|
||||||
|
@property (nonatomic, assign) BOOL nmiLine;
|
||||||
|
|
||||||
|
@end
|
@ -6,25 +6,25 @@
|
|||||||
// Copyright © 2015 Thomas Harte. All rights reserved.
|
// Copyright © 2015 Thomas Harte. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
#import "TestMachine.h"
|
#import "TestMachine6502.h"
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "6502AllRAM.hpp"
|
#include "6502AllRAM.hpp"
|
||||||
|
|
||||||
const uint8_t CSTestMachineJamOpcode = CPU::MOS6502::JamOpcode;
|
const uint8_t CSTestMachine6502JamOpcode = CPU::MOS6502::JamOpcode;
|
||||||
|
|
||||||
class MachineJamHandler: public CPU::MOS6502::AllRAMProcessor::JamHandler {
|
class MachineJamHandler: public CPU::MOS6502::AllRAMProcessor::JamHandler {
|
||||||
public:
|
public:
|
||||||
MachineJamHandler(CSTestMachine *targetMachine) : _targetMachine(targetMachine) {}
|
MachineJamHandler(CSTestMachine6502 *targetMachine) : _targetMachine(targetMachine) {}
|
||||||
|
|
||||||
void processor_did_jam(CPU::MOS6502::AllRAMProcessor::Processor *processor, uint16_t address) override {
|
void processor_did_jam(CPU::MOS6502::AllRAMProcessor::Processor *processor, uint16_t address) override {
|
||||||
[_targetMachine.jamHandler testMachine:_targetMachine didJamAtAddress:address];
|
[_targetMachine.jamHandler testMachine:_targetMachine didJamAtAddress:address];
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CSTestMachine *_targetMachine;
|
CSTestMachine6502 *_targetMachine;
|
||||||
};
|
};
|
||||||
|
|
||||||
@implementation CSTestMachine {
|
@implementation CSTestMachine6502 {
|
||||||
CPU::MOS6502::AllRAMProcessor _processor;
|
CPU::MOS6502::AllRAMProcessor _processor;
|
||||||
MachineJamHandler *_cppJamHandler;
|
MachineJamHandler *_cppJamHandler;
|
||||||
}
|
}
|
||||||
@ -43,24 +43,24 @@ class MachineJamHandler: public CPU::MOS6502::AllRAMProcessor::JamHandler {
|
|||||||
_processor.return_from_subroutine();
|
_processor.return_from_subroutine();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (CPU::MOS6502::Register)registerForRegister:(CSTestMachineRegister)reg {
|
- (CPU::MOS6502::Register)registerForRegister:(CSTestMachine6502Register)reg {
|
||||||
switch (reg) {
|
switch (reg) {
|
||||||
case CSTestMachineRegisterProgramCounter: return CPU::MOS6502::Register::ProgramCounter;
|
case CSTestMachine6502RegisterProgramCounter: return CPU::MOS6502::Register::ProgramCounter;
|
||||||
case CSTestMachineRegisterLastOperationAddress: return CPU::MOS6502::Register::LastOperationAddress;
|
case CSTestMachine6502RegisterLastOperationAddress: return CPU::MOS6502::Register::LastOperationAddress;
|
||||||
case CSTestMachineRegisterFlags: return CPU::MOS6502::Register::Flags;
|
case CSTestMachine6502RegisterFlags: return CPU::MOS6502::Register::Flags;
|
||||||
case CSTestMachineRegisterA: return CPU::MOS6502::Register::A;
|
case CSTestMachine6502RegisterA: return CPU::MOS6502::Register::A;
|
||||||
case CSTestMachineRegisterX: return CPU::MOS6502::Register::X;
|
case CSTestMachine6502RegisterX: return CPU::MOS6502::Register::X;
|
||||||
case CSTestMachineRegisterY: return CPU::MOS6502::Register::Y;
|
case CSTestMachine6502RegisterY: return CPU::MOS6502::Register::Y;
|
||||||
case CSTestMachineRegisterStackPointer: return CPU::MOS6502::Register::S;
|
case CSTestMachine6502RegisterStackPointer: return CPU::MOS6502::Register::S;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setValue:(uint16_t)value forRegister:(CSTestMachineRegister)reg {
|
- (void)setValue:(uint16_t)value forRegister:(CSTestMachine6502Register)reg {
|
||||||
_processor.set_value_of_register([self registerForRegister:reg], value);
|
_processor.set_value_of_register([self registerForRegister:reg], value);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (uint16_t)valueForRegister:(CSTestMachineRegister)reg {
|
- (uint16_t)valueForRegister:(CSTestMachine6502Register)reg {
|
||||||
return _processor.get_value_of_register([self registerForRegister:reg]);
|
return _processor.get_value_of_register([self registerForRegister:reg]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,10 +68,6 @@ class MachineJamHandler: public CPU::MOS6502::AllRAMProcessor::JamHandler {
|
|||||||
_processor.set_data_at_address(startAddress, data.length, (const uint8_t *)data.bytes);
|
_processor.set_data_at_address(startAddress, data.length, (const uint8_t *)data.bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
//- (void)reset {
|
|
||||||
// _processor.reset();
|
|
||||||
//}
|
|
||||||
|
|
||||||
- (void)runForNumberOfCycles:(int)cycles {
|
- (void)runForNumberOfCycles:(int)cycles {
|
||||||
_processor.run_for_cycles(cycles);
|
_processor.run_for_cycles(cycles);
|
||||||
}
|
}
|
@ -34,15 +34,15 @@ class KlausDormannTests: XCTestCase {
|
|||||||
|
|
||||||
if let filename = Bundle(for: type(of: self)).path(forResource: "6502_functional_test", ofType: "bin") {
|
if let filename = Bundle(for: type(of: self)).path(forResource: "6502_functional_test", ofType: "bin") {
|
||||||
if let functionalTest = try? Data(contentsOf: URL(fileURLWithPath: filename)) {
|
if let functionalTest = try? Data(contentsOf: URL(fileURLWithPath: filename)) {
|
||||||
let machine = CSTestMachine()
|
let machine = CSTestMachine6502()
|
||||||
|
|
||||||
machine.setData(functionalTest, atAddress: 0)
|
machine.setData(functionalTest, atAddress: 0)
|
||||||
machine.setValue(0x400, for: CSTestMachineRegister.programCounter)
|
machine.setValue(0x400, for: CSTestMachine6502Register.programCounter)
|
||||||
|
|
||||||
while true {
|
while true {
|
||||||
let oldPC = machine.value(for: CSTestMachineRegister.lastOperationAddress)
|
let oldPC = machine.value(for: CSTestMachine6502Register.lastOperationAddress)
|
||||||
machine.runForNumber(ofCycles: 1000)
|
machine.runForNumber(ofCycles: 1000)
|
||||||
let newPC = machine.value(for: CSTestMachineRegister.lastOperationAddress)
|
let newPC = machine.value(for: CSTestMachine6502Register.lastOperationAddress)
|
||||||
|
|
||||||
if newPC == oldPC {
|
if newPC == oldPC {
|
||||||
let error = errorForTrapAddress(oldPC)
|
let error = errorForTrapAddress(oldPC)
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
import XCTest
|
import XCTest
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
class WolfgangLorenzTests: XCTestCase, CSTestMachineJamHandler {
|
class WolfgangLorenzTests: XCTestCase, CSTestMachine6502JamHandler {
|
||||||
|
|
||||||
func testWolfgangLorenzStart() {
|
func testWolfgangLorenzStart() {
|
||||||
self.runWolfgangLorenzTest(" start")
|
self.runWolfgangLorenzTest(" start")
|
||||||
@ -196,12 +196,12 @@ class WolfgangLorenzTests: XCTestCase, CSTestMachineJamHandler {
|
|||||||
fileprivate var output: String = ""
|
fileprivate var output: String = ""
|
||||||
fileprivate func runWolfgangLorenzTest(_ name: String) {
|
fileprivate func runWolfgangLorenzTest(_ name: String) {
|
||||||
|
|
||||||
var machine: CSTestMachine!
|
var machine: CSTestMachine6502!
|
||||||
|
|
||||||
if let filename = Bundle(for: type(of: self)).path(forResource: name, ofType: nil) {
|
if let filename = Bundle(for: type(of: self)).path(forResource: name, ofType: nil) {
|
||||||
if let testData = try? Data(contentsOf: URL(fileURLWithPath: filename)) {
|
if let testData = try? Data(contentsOf: URL(fileURLWithPath: filename)) {
|
||||||
|
|
||||||
machine = CSTestMachine()
|
machine = CSTestMachine6502()
|
||||||
machine.jamHandler = self
|
machine.jamHandler = self
|
||||||
// machine.logActivity = true
|
// machine.logActivity = true
|
||||||
output = ""
|
output = ""
|
||||||
@ -226,15 +226,15 @@ class WolfgangLorenzTests: XCTestCase, CSTestMachineJamHandler {
|
|||||||
] as [UInt8]), count: 19)
|
] as [UInt8]), count: 19)
|
||||||
machine.setData( irqHandler, atAddress: 0xff48)
|
machine.setData( irqHandler, atAddress: 0xff48)
|
||||||
|
|
||||||
machine.setValue(CSTestMachineJamOpcode, forAddress:0xffd2) // print character
|
machine.setValue(CSTestMachine6502JamOpcode, forAddress:0xffd2) // print character
|
||||||
machine.setValue(CSTestMachineJamOpcode, forAddress:0xe16f) // load
|
machine.setValue(CSTestMachine6502JamOpcode, forAddress:0xe16f) // load
|
||||||
machine.setValue(CSTestMachineJamOpcode, forAddress:0xffe4) // scan keyboard
|
machine.setValue(CSTestMachine6502JamOpcode, forAddress:0xffe4) // scan keyboard
|
||||||
machine.setValue(CSTestMachineJamOpcode, forAddress:0x8000) // exit
|
machine.setValue(CSTestMachine6502JamOpcode, forAddress:0x8000) // exit
|
||||||
machine.setValue(CSTestMachineJamOpcode, forAddress:0xa474) // exit
|
machine.setValue(CSTestMachine6502JamOpcode, forAddress:0xa474) // exit
|
||||||
|
|
||||||
machine.setValue(0x0801, for: CSTestMachineRegister.programCounter)
|
machine.setValue(0x0801, for: CSTestMachine6502Register.programCounter)
|
||||||
machine.setValue(0xfd, for: CSTestMachineRegister.stackPointer)
|
machine.setValue(0xfd, for: CSTestMachine6502Register.stackPointer)
|
||||||
machine.setValue(0x04, for: CSTestMachineRegister.flags)
|
machine.setValue(0x04, for: CSTestMachine6502Register.flags)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,7 +246,7 @@ class WolfgangLorenzTests: XCTestCase, CSTestMachineJamHandler {
|
|||||||
machine.runForNumber(ofCycles: 1000)
|
machine.runForNumber(ofCycles: 1000)
|
||||||
}
|
}
|
||||||
|
|
||||||
let jammedPC = machine.value(for: CSTestMachineRegister.lastOperationAddress)
|
let jammedPC = machine.value(for: CSTestMachine6502Register.lastOperationAddress)
|
||||||
if jammedPC != 0xe16f {
|
if jammedPC != 0xe16f {
|
||||||
let hexAddress = String(format:"%04x", jammedPC)
|
let hexAddress = String(format:"%04x", jammedPC)
|
||||||
NSException(name: NSExceptionName(rawValue: "Failed Test"), reason: "Processor jammed unexpectedly at \(hexAddress)", userInfo: nil).raise()
|
NSException(name: NSExceptionName(rawValue: "Failed Test"), reason: "Processor jammed unexpectedly at \(hexAddress)", userInfo: nil).raise()
|
||||||
@ -297,19 +297,19 @@ class WolfgangLorenzTests: XCTestCase, CSTestMachineJamHandler {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
func testMachine(_ machine: CSTestMachine!, didJamAtAddress address: UInt16) {
|
func testMachine(_ machine: CSTestMachine6502!, didJamAtAddress address: UInt16) {
|
||||||
|
|
||||||
switch address {
|
switch address {
|
||||||
case 0xffd2:
|
case 0xffd2:
|
||||||
machine.setValue(0x00, forAddress: 0x030c)
|
machine.setValue(0x00, forAddress: 0x030c)
|
||||||
|
|
||||||
let character = machine.value(for: CSTestMachineRegister.A)
|
let character = machine.value(for: CSTestMachine6502Register.A)
|
||||||
output.append(Character(UnicodeScalar(character)!))
|
output.append(Character(UnicodeScalar(character)!))
|
||||||
|
|
||||||
machine.returnFromSubroutine()
|
machine.returnFromSubroutine()
|
||||||
|
|
||||||
case 0xffe4:
|
case 0xffe4:
|
||||||
machine.setValue(0x3, for:CSTestMachineRegister.A)
|
machine.setValue(0x3, for:CSTestMachine6502Register.A)
|
||||||
machine.returnFromSubroutine()
|
machine.returnFromSubroutine()
|
||||||
|
|
||||||
case 0x8000, 0xa474:
|
case 0x8000, 0xa474:
|
||||||
|
Loading…
Reference in New Issue
Block a user