1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-26 09:29:45 +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" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES" shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES" codeCoverageEnabled = "YES">
enableAddressSanitizer = "YES">
<Testables> <Testables>
<TestableReference <TestableReference
skipped = "NO"> skipped = "NO">

View File

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