2015-07-17 00:52:16 +00:00
|
|
|
//
|
|
|
|
// Clock_SignalTests.swift
|
|
|
|
// Clock SignalTests
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 16/07/2015.
|
2018-05-13 19:19:52 +00:00
|
|
|
// Copyright 2015 Thomas Harte. All rights reserved.
|
2015-07-17 00:52:16 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
import XCTest
|
|
|
|
|
|
|
|
class AllSuiteATests: XCTestCase {
|
|
|
|
|
2015-07-31 00:51:32 +00:00
|
|
|
func testAllSuiteA() {
|
2016-09-16 02:12:12 +00:00
|
|
|
if let filename = Bundle(for: type(of: self)).path(forResource: "AllSuiteA", ofType: "bin") {
|
|
|
|
if let allSuiteA = try? Data(contentsOf: URL(fileURLWithPath: filename)) {
|
2020-09-27 02:31:50 +00:00
|
|
|
let machine = CSTestMachine6502(processor: .processor6502)
|
2015-07-17 00:52:16 +00:00
|
|
|
|
2015-07-31 00:51:32 +00:00
|
|
|
machine.setData(allSuiteA, atAddress: 0x4000)
|
2017-05-15 12:18:57 +00:00
|
|
|
machine.setValue(CSTestMachine6502JamOpcode, forAddress:0x45c0); // end
|
2015-07-17 00:52:16 +00:00
|
|
|
|
2017-05-15 12:18:57 +00:00
|
|
|
machine.setValue(0x4000, for: CSTestMachine6502Register.programCounter)
|
2015-07-31 00:51:32 +00:00
|
|
|
while !machine.isJammed {
|
2016-09-16 02:12:12 +00:00
|
|
|
machine.runForNumber(ofCycles: 1000)
|
2015-07-31 00:51:32 +00:00
|
|
|
}
|
2015-07-17 00:52:16 +00:00
|
|
|
|
2016-10-31 00:30:32 +00:00
|
|
|
XCTAssert(machine.value(forAddress: 0x0210) == 0xff, "Failed test \(machine.value(forAddress: 0x0210))")
|
2015-07-31 00:51:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-10-18 02:42:54 +00:00
|
|
|
|
2016-09-16 02:12:12 +00:00
|
|
|
}
|