mirror of
https://github.com/TomHarte/CLK.git
synced 2025-08-07 23:25:00 +00:00
Exploit test's 65C02 abilities.
This commit is contained in:
@@ -11,10 +11,10 @@ import XCTest
|
|||||||
|
|
||||||
class BCDTest: XCTestCase, CSTestMachineTrapHandler {
|
class BCDTest: XCTestCase, CSTestMachineTrapHandler {
|
||||||
|
|
||||||
func testBCD() {
|
func testBCD(processor: CSTestMachine6502Processor) {
|
||||||
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 = CSTestMachine6502(processor: .processor6502)
|
let machine = CSTestMachine6502(processor: processor)
|
||||||
machine.trapHandler = self
|
machine.trapHandler = self
|
||||||
|
|
||||||
machine.setData(bcdTest, atAddress: 0x2900)
|
machine.setData(bcdTest, atAddress: 0x2900)
|
||||||
@@ -40,6 +40,14 @@ class BCDTest: XCTestCase, CSTestMachineTrapHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func test6502BCD() {
|
||||||
|
testBCD(processor: .processor6502)
|
||||||
|
}
|
||||||
|
|
||||||
|
func test65C02BCD() {
|
||||||
|
testBCD(processor: .processor65C02)
|
||||||
|
}
|
||||||
|
|
||||||
private var output: String = ""
|
private var output: String = ""
|
||||||
func testMachine(_ testMachine: CSTestMachine, didTrapAtAddress address: UInt16) {
|
func testMachine(_ testMachine: CSTestMachine, didTrapAtAddress address: UInt16) {
|
||||||
let machine6502 = testMachine as! CSTestMachine6502
|
let machine6502 = testMachine as! CSTestMachine6502
|
||||||
|
Reference in New Issue
Block a user