2016-07-09 19:44:55 +00:00
|
|
|
//
|
|
|
|
// C1540Tests.swift
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 09/07/2016.
|
|
|
|
// Copyright © 2016 Thomas Harte. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import XCTest
|
|
|
|
|
|
|
|
class C1540Tests: XCTestCase {
|
|
|
|
|
2016-07-09 19:47:53 +00:00
|
|
|
private func with1540(action: (C1540Bridge) -> ()) {
|
|
|
|
let bridge = C1540Bridge()
|
|
|
|
|
|
|
|
if let path = NSBundle.mainBundle().pathForResource("1541", ofType: "bin", inDirectory: "ROMImages/Commodore1540") {
|
|
|
|
let data = NSData(contentsOfFile: path)
|
|
|
|
bridge.setROM(data)
|
|
|
|
}
|
|
|
|
|
|
|
|
action(bridge)
|
|
|
|
}
|
|
|
|
|
|
|
|
// MARK: EOI
|
|
|
|
|
2016-07-09 21:22:10 +00:00
|
|
|
func testTransmission() {
|
2016-07-09 19:47:53 +00:00
|
|
|
with1540 {
|
2016-07-09 21:22:10 +00:00
|
|
|
// allow some booting time
|
|
|
|
$0.runForCycles(2000000)
|
|
|
|
|
|
|
|
// I want to be talker, so hold attention and clock low
|
|
|
|
$0.clockLine = false
|
|
|
|
$0.attentionLine = false
|
|
|
|
$0.runForCycles(200)
|
|
|
|
|
|
|
|
XCTAssert($0.dataLine == false, "Listener should have taken data line low")
|
2016-07-09 19:47:53 +00:00
|
|
|
}
|
|
|
|
}
|
2016-07-09 19:44:55 +00:00
|
|
|
}
|