mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-25 03:32:01 +00:00
Merge pull request #54 from TomHarte/BCDTest
Installs hoglet's BCDTest as a formal part of the test suite
This commit is contained in:
commit
ebef5ccdba
@ -7,6 +7,8 @@
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
4B049CDD1DA3C82F00322067 /* BCDTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B049CDC1DA3C82F00322067 /* BCDTest.swift */; };
|
||||
4B049CDF1DA3C85B00322067 /* BCDTEST_beeb in Resources */ = {isa = PBXBuildFile; fileRef = 4B049CDE1DA3C85B00322067 /* BCDTEST_beeb */; };
|
||||
4B0BE4281D3481E700D5256B /* DigitalPhaseLockedLoop.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B0BE4261D3481E700D5256B /* DigitalPhaseLockedLoop.cpp */; };
|
||||
4B0CCC451C62D0B3001CAC5F /* CRT.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B0CCC421C62D0B3001CAC5F /* CRT.cpp */; };
|
||||
4B14145B1B58879D00E04248 /* CPU6502.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B1414571B58879D00E04248 /* CPU6502.cpp */; };
|
||||
@ -389,6 +391,8 @@
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
4B046DC31CFE651500E9E45E /* CRTMachine.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = CRTMachine.hpp; sourceTree = "<group>"; };
|
||||
4B049CDC1DA3C82F00322067 /* BCDTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BCDTest.swift; sourceTree = "<group>"; };
|
||||
4B049CDE1DA3C85B00322067 /* BCDTEST_beeb */ = {isa = PBXFileReference; lastKnownFileType = file; path = BCDTEST_beeb; sourceTree = "<group>"; };
|
||||
4B0B6E121C9DBD5D00FFB60D /* CRTConstants.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = CRTConstants.hpp; sourceTree = "<group>"; };
|
||||
4B0BE4261D3481E700D5256B /* DigitalPhaseLockedLoop.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DigitalPhaseLockedLoop.cpp; sourceTree = "<group>"; };
|
||||
4B0BE4271D3481E700D5256B /* DigitalPhaseLockedLoop.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = DigitalPhaseLockedLoop.hpp; sourceTree = "<group>"; };
|
||||
@ -898,6 +902,7 @@
|
||||
4B1414631B588A1100E04248 /* Test Binaries */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4B049CDE1DA3C85B00322067 /* BCDTEST_beeb */,
|
||||
4BB297E01B587D8300A49093 /* 6502_functional_test.bin */,
|
||||
4BB297E11B587D8300A49093 /* AllSuiteA.bin */,
|
||||
4BB297E41B587D8300A49093 /* Wolfgang Lorenz 6502 test suite */,
|
||||
@ -1522,6 +1527,7 @@
|
||||
4BC751B11D157E61006C31D9 /* 6522Tests.swift */,
|
||||
4B1E85801D176468001EF87D /* 6532Tests.swift */,
|
||||
4BB73EB61B587A5100552FC2 /* AllSuiteATests.swift */,
|
||||
4B049CDC1DA3C82F00322067 /* BCDTest.swift */,
|
||||
4B3BA0C21D318AEB005DD7A7 /* C1540Tests.swift */,
|
||||
4BEF6AAB1D35D1C400E73575 /* DPLLTests.swift */,
|
||||
4B1414611B58888700E04248 /* KlausDormannTests.swift */,
|
||||
@ -1930,6 +1936,7 @@
|
||||
4BB299641B587D8400A49093 /* insiy in Resources */,
|
||||
4BB299E61B587D8400A49093 /* trap10 in Resources */,
|
||||
4BB299651B587D8400A49093 /* insz in Resources */,
|
||||
4B049CDF1DA3C85B00322067 /* BCDTEST_beeb in Resources */,
|
||||
4BB299161B587D8400A49093 /* bccr in Resources */,
|
||||
4BB299211B587D8400A49093 /* bvsr in Resources */,
|
||||
4BB2991F1B587D8400A49093 /* brkn in Resources */,
|
||||
@ -2227,6 +2234,7 @@
|
||||
4B3BA0C31D318AEC005DD7A7 /* C1540Tests.swift in Sources */,
|
||||
4B1414621B58888700E04248 /* KlausDormannTests.swift in Sources */,
|
||||
4B1414601B58885000E04248 /* WolfgangLorenzTests.swift in Sources */,
|
||||
4B049CDD1DA3C82F00322067 /* BCDTest.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
BIN
OSBindings/Mac/Clock SignalTests/BCDTEST_beeb
Executable file
BIN
OSBindings/Mac/Clock SignalTests/BCDTEST_beeb
Executable file
Binary file not shown.
58
OSBindings/Mac/Clock SignalTests/BCDTest.swift
Normal file
58
OSBindings/Mac/Clock SignalTests/BCDTest.swift
Normal file
@ -0,0 +1,58 @@
|
||||
//
|
||||
// BCDTest.swift
|
||||
// Clock Signal
|
||||
//
|
||||
// Created by Thomas Harte on 04/10/2016.
|
||||
// Copyright © 2016 Thomas Harte. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import XCTest
|
||||
|
||||
class BCDTest: XCTestCase, CSTestMachineJamHandler {
|
||||
|
||||
func testBCD() {
|
||||
if let filename = Bundle(for: type(of: self)).path(forResource: "BCDTEST_beeb", ofType: nil) {
|
||||
if let bcdTest = try? Data(contentsOf: URL(fileURLWithPath: filename)) {
|
||||
let machine = CSTestMachine()
|
||||
machine.jamHandler = self
|
||||
|
||||
machine.setData(bcdTest, atAddress: 0x2900)
|
||||
|
||||
// install a launchpad
|
||||
machine.setValue(0x20, forAddress:0x200) // JSR 0x2900
|
||||
machine.setValue(0x00, forAddress:0x201)
|
||||
machine.setValue(0x29, forAddress:0x202)
|
||||
machine.setValue(0x4c, forAddress:0x203) // JMP 0x0203
|
||||
machine.setValue(0x03, forAddress:0x204)
|
||||
machine.setValue(0x02, forAddress:0x205)
|
||||
|
||||
machine.setValue(0x200, for: CSTestMachineRegister.programCounter)
|
||||
|
||||
machine.setValue(CSTestMachineJamOpcode, forAddress:0xffee) // OSWRCH
|
||||
machine.setValue(CSTestMachineJamOpcode, forAddress:0xffff) // end of test
|
||||
|
||||
while(machine.value(for: .programCounter) != 0x203) {
|
||||
machine.runForNumber(ofCycles: 1000)
|
||||
}
|
||||
XCTAssert(machine.value(forAddress:0x84) == 0, output)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fileprivate var output: String = ""
|
||||
func testMachine(_ machine: CSTestMachine!, didJamAtAddress address: UInt16) {
|
||||
|
||||
switch address {
|
||||
case 0xffee:
|
||||
let character = machine.value(for: CSTestMachineRegister.A)
|
||||
output.append(Character(UnicodeScalar(character)!))
|
||||
|
||||
machine.returnFromSubroutine()
|
||||
|
||||
default:
|
||||
let hexAddress = String(format:"%04x", address)
|
||||
NSException(name: NSExceptionName(rawValue: "Failed Test"), reason: "Processor jammed unexpectedly at \(hexAddress)", userInfo: nil).raise()
|
||||
}
|
||||
}
|
||||
}
|
@ -226,11 +226,11 @@ class WolfgangLorenzTests: XCTestCase, CSTestMachineJamHandler {
|
||||
] as [UInt8]), count: 19)
|
||||
machine.setData( irqHandler, atAddress: 0xff48)
|
||||
|
||||
machine.setValue(CSTestMachineJamOpcode, forAddress:0xffd2); // print character
|
||||
machine.setValue(CSTestMachineJamOpcode, forAddress:0xe16f); // load
|
||||
machine.setValue(CSTestMachineJamOpcode, forAddress:0xffe4); // scan keyboard
|
||||
machine.setValue(CSTestMachineJamOpcode, forAddress:0x8000); // exit
|
||||
machine.setValue(CSTestMachineJamOpcode, forAddress:0xa474); // exit
|
||||
machine.setValue(CSTestMachineJamOpcode, forAddress:0xffd2) // print character
|
||||
machine.setValue(CSTestMachineJamOpcode, forAddress:0xe16f) // load
|
||||
machine.setValue(CSTestMachineJamOpcode, forAddress:0xffe4) // scan keyboard
|
||||
machine.setValue(CSTestMachineJamOpcode, forAddress:0x8000) // exit
|
||||
machine.setValue(CSTestMachineJamOpcode, forAddress:0xa474) // exit
|
||||
|
||||
machine.setValue(0x0801, for: CSTestMachineRegister.programCounter)
|
||||
machine.setValue(0xfd, for: CSTestMachineRegister.stackPointer)
|
||||
|
Loading…
Reference in New Issue
Block a user