1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-25 18:30:21 +00:00

Discovered that Zexall is just really slow. Disabled the address sanitiser, and started working towards a verifiable end.

This commit is contained in:
Thomas Harte 2017-05-29 21:46:00 -04:00
parent 9d29cefe75
commit 4d4695032c
2 changed files with 9 additions and 5 deletions

View File

@ -27,8 +27,7 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES"
enableAddressSanitizer = "YES">
codeCoverageEnabled = "YES">
<Testables>
<TestableReference
skipped = "NO">

View File

@ -12,6 +12,7 @@ import Foundation
class ZexallTests: XCTestCase, CSTestMachineTrapHandler {
fileprivate var done = false
fileprivate var output = ""
func testZexall() {
if let filename = Bundle(for: type(of: self)).path(forResource: "zexall", ofType: "com") {
@ -23,6 +24,8 @@ class ZexallTests: XCTestCase, CSTestMachineTrapHandler {
// add a RET at the CP/M entry location, and establish it as a trap location
machine.setValue(0xc9, atAddress: 0x0005)
machine.setValue(0xff, atAddress: 0x0006)
machine.setValue(0xff, atAddress: 0x0007)
machine.addTrapAddress(0x0005);
machine.trapHandler = self
@ -37,6 +40,9 @@ class ZexallTests: XCTestCase, CSTestMachineTrapHandler {
while !done {
machine.runForNumber(ofCycles: 200)
}
print("Done!")
print(output)
}
}
}
@ -49,7 +55,6 @@ class ZexallTests: XCTestCase, CSTestMachineTrapHandler {
case 9:
var address = testMachine.value(for: .DE)
var character: Character = " "
var output = ""
while true {
character = Character(UnicodeScalar(testMachine.value(atAddress: address)))
if character == "$" {
@ -58,14 +63,14 @@ class ZexallTests: XCTestCase, CSTestMachineTrapHandler {
output = output + String(character)
address = address + 1
}
print(output)
case 5:
print(String(describing: UnicodeScalar(testMachine.value(for: .E))))
output += String(describing: UnicodeScalar(testMachine.value(for: .E)))
case 0:
done = true
default:
break
}
print(output)
case 0x0000:
done = true