2017-08-01 06:02:49 +00:00
|
|
|
//
|
|
|
|
// AppleII.swift
|
|
|
|
// FruitMachine
|
|
|
|
//
|
|
|
|
// Created by Christopher Rohl on 8/1/17.
|
|
|
|
// Copyright © 2017 Christopher Rohl. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import Cocoa
|
|
|
|
|
2017-08-07 06:32:24 +00:00
|
|
|
class AppleII: AppleIIBase {
|
|
|
|
static let sharedInstance = AppleII(cpuFrequency: 1000000, fps: 60.0)
|
2017-08-01 06:02:49 +00:00
|
|
|
|
|
|
|
required init(cpuFrequency: Double, fps: Double) {
|
2017-08-07 06:32:24 +00:00
|
|
|
super.init(cpuFrequency: cpuFrequency,
|
|
|
|
fps: fps,
|
|
|
|
delegate: ScreenDelegate(),
|
|
|
|
view: ScreenView(frame: NSMakeRect(0, 16, 560, 384)))
|
2017-08-02 22:54:50 +00:00
|
|
|
|
2017-08-07 00:16:25 +00:00
|
|
|
loadROMs()
|
2017-08-02 08:01:06 +00:00
|
|
|
doReset()
|
|
|
|
}
|
|
|
|
|
2017-08-07 06:32:24 +00:00
|
|
|
required init(cpuFrequency: Double, fps: Double, delegate: ScreenDelegate, view: ScreenView) {
|
|
|
|
fatalError("init(cpuFrequency:fps:delegate:view:) has not been implemented")
|
2017-08-01 06:02:49 +00:00
|
|
|
}
|
|
|
|
|
2017-08-07 06:32:24 +00:00
|
|
|
override func loadROMs() {
|
|
|
|
|
|
|
|
/* Integer BASIC */
|
2017-08-01 06:02:49 +00:00
|
|
|
CPU.sharedInstance.memoryInterface.loadBinary(path: "/Users/luigi/apple2/341-0001-00.e0", offset: 0xE000, length: 0x800)
|
|
|
|
CPU.sharedInstance.memoryInterface.loadBinary(path: "/Users/luigi/apple2/341-0002-00.e8", offset: 0xE800, length: 0x800)
|
|
|
|
CPU.sharedInstance.memoryInterface.loadBinary(path: "/Users/luigi/apple2/341-0003-00.f0", offset: 0xF000, length: 0x800)
|
2017-08-07 00:16:25 +00:00
|
|
|
|
2017-08-07 06:32:24 +00:00
|
|
|
/* Monitor */
|
|
|
|
CPU.sharedInstance.memoryInterface.loadBinary(path: "/Users/luigi/apple2/341-0004-00.f8", offset: 0xF800, length: 0x800)
|
2017-08-01 06:02:49 +00:00
|
|
|
}
|
|
|
|
|
2017-08-07 06:32:24 +00:00
|
|
|
override func installOverrides() {
|
2017-08-07 00:16:25 +00:00
|
|
|
for (_, peripheral) in backplane {
|
2017-08-03 04:31:12 +00:00
|
|
|
if(peripheral != nil) {
|
|
|
|
peripheral!.installOverrides()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-01 21:40:01 +00:00
|
|
|
CPU.sharedInstance.memoryInterface.read_overrides.append(SoftswitchOverrides.readKeyboard)
|
|
|
|
CPU.sharedInstance.memoryInterface.read_overrides.append(SoftswitchOverrides.clearKeypressStrobeR)
|
|
|
|
CPU.sharedInstance.memoryInterface.write_overrides.append(SoftswitchOverrides.clearKeypressStrobeW)
|
2017-08-02 22:54:50 +00:00
|
|
|
|
|
|
|
CPU.sharedInstance.memoryInterface.read_overrides.append(SoftswitchOverrides.switchC050R)
|
|
|
|
CPU.sharedInstance.memoryInterface.read_overrides.append(SoftswitchOverrides.switchC051R)
|
|
|
|
CPU.sharedInstance.memoryInterface.read_overrides.append(SoftswitchOverrides.switchC052R)
|
|
|
|
CPU.sharedInstance.memoryInterface.read_overrides.append(SoftswitchOverrides.switchC053R)
|
|
|
|
CPU.sharedInstance.memoryInterface.read_overrides.append(SoftswitchOverrides.switchC054R)
|
|
|
|
CPU.sharedInstance.memoryInterface.read_overrides.append(SoftswitchOverrides.switchC055R)
|
|
|
|
CPU.sharedInstance.memoryInterface.read_overrides.append(SoftswitchOverrides.switchC056R)
|
|
|
|
CPU.sharedInstance.memoryInterface.read_overrides.append(SoftswitchOverrides.switchC057R)
|
|
|
|
|
|
|
|
CPU.sharedInstance.memoryInterface.write_overrides.append(SoftswitchOverrides.switchC050W)
|
|
|
|
CPU.sharedInstance.memoryInterface.write_overrides.append(SoftswitchOverrides.switchC051W)
|
|
|
|
CPU.sharedInstance.memoryInterface.write_overrides.append(SoftswitchOverrides.switchC052W)
|
|
|
|
CPU.sharedInstance.memoryInterface.write_overrides.append(SoftswitchOverrides.switchC053W)
|
|
|
|
CPU.sharedInstance.memoryInterface.write_overrides.append(SoftswitchOverrides.switchC054W)
|
|
|
|
CPU.sharedInstance.memoryInterface.write_overrides.append(SoftswitchOverrides.switchC055W)
|
|
|
|
CPU.sharedInstance.memoryInterface.write_overrides.append(SoftswitchOverrides.switchC056W)
|
|
|
|
CPU.sharedInstance.memoryInterface.write_overrides.append(SoftswitchOverrides.switchC057W)
|
2017-08-01 06:02:49 +00:00
|
|
|
}
|
|
|
|
|
2017-08-05 07:29:07 +00:00
|
|
|
@objc func debuggerBreak() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2017-08-01 06:02:49 +00:00
|
|
|
}
|