FruitMachine-Swift/FruitMachine/AppleII/AppleII.swift

74 lines
3.5 KiB
Swift
Raw Normal View History

//
// AppleII.swift
// FruitMachine
//
// Created by Christopher Rohl on 8/1/17.
// Copyright © 2017 Christopher Rohl. All rights reserved.
//
import Cocoa
class AppleII: AppleIIBase {
static let sharedInstance = AppleII(cpuFrequency: 1000000, fps: 60.0)
required init(cpuFrequency: Double, fps: Double) {
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()
}
required init(cpuFrequency: Double, fps: Double, delegate: ScreenDelegate, view: ScreenView) {
fatalError("init(cpuFrequency:fps:delegate:view:) has not been implemented")
}
override func loadROMs() {
/* Integer BASIC */
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
/* Monitor */
CPU.sharedInstance.memoryInterface.loadBinary(path: "/Users/luigi/apple2/341-0004-00.f8", offset: 0xF800, length: 0x800)
}
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()
}
}
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-05 07:29:07 +00:00
@objc func debuggerBreak() {
}
}