more disk fixes

adding language card
This commit is contained in:
Luigi Thirty 2017-08-06 20:16:25 -04:00
parent e501990af3
commit 26549c7737
10 changed files with 457 additions and 89 deletions

View File

@ -7,6 +7,7 @@
objects = {
/* Begin PBXBuildFile section */
2A044E2C1F37D65A000E8085 /* LanguageCard16K.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A044E2B1F37D65A000E8085 /* LanguageCard16K.swift */; };
2A16ADBB1F33C341004A0333 /* DiskImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A16ADBA1F33C341004A0333 /* DiskImage.swift */; };
2A2126841F2A9FA300E43DC1 /* DebuggerWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A2126831F2A9FA300E43DC1 /* DebuggerWindowController.swift */; };
2A22EBFB1F21A7A700A36A61 /* IntegerExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A22EBFA1F21A7A700A36A61 /* IntegerExtensions.swift */; };
@ -56,6 +57,7 @@
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
2A044E2B1F37D65A000E8085 /* LanguageCard16K.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LanguageCard16K.swift; sourceTree = "<group>"; };
2A16ADBA1F33C341004A0333 /* DiskImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DiskImage.swift; sourceTree = "<group>"; };
2A2126831F2A9FA300E43DC1 /* DebuggerWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DebuggerWindowController.swift; sourceTree = "<group>"; };
2A22EBFA1F21A7A700A36A61 /* IntegerExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IntegerExtensions.swift; sourceTree = "<group>"; };
@ -150,6 +152,7 @@
isa = PBXGroup;
children = (
2A16ADB91F33C2ED004A0333 /* DiskII */,
2A044E2B1F37D65A000E8085 /* LanguageCard16K.swift */,
2A63C23B1F32CD4800D4F4F8 /* Peripheral.swift */,
);
path = Peripherals;
@ -430,6 +433,7 @@
2AE5BA061F2469EB00FAA343 /* AddressConversions.swift in Sources */,
2AE42E0A1F28521E00C4900E /* WriteOverride.swift in Sources */,
2A6DC7ED1F30492C0066FE0D /* ScreenDelegate.swift in Sources */,
2A044E2C1F37D65A000E8085 /* LanguageCard16K.swift in Sources */,
2A5BC5191F29A28D008C03BE /* AppleIScreenView.swift in Sources */,
2A63C2371F32C55100D4F4F8 /* VideoHelpers.swift in Sources */,
2A63C23A1F32CCE900D4F4F8 /* DiskII.swift in Sources */,
@ -510,6 +514,7 @@
SDKROOT = macosx;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.0;
};
name = Debug;
};
@ -559,6 +564,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.0;
};
name = Release;
};

View File

@ -36,15 +36,15 @@ final class AppleII: NSObject, EmulatedSystem {
videoMode = .Text
for i in 1...7 {
for i in 0...7 {
backplane[i] = nil
}
backplane[6] = DiskII(slot: 6, romPath: "/Users/luigi/apple2/341-0027-a.p5")
super.init()
loadROMs()
setupMemory(ramConfig: .fortyeightK)
setupPeripherals()
loadROMs()
emuScreenLayer.shouldRasterize = true
emuScreenLayer.delegate = emulatorViewDelegate
@ -52,7 +52,7 @@ final class AppleII: NSObject, EmulatedSystem {
emulatorView.wantsLayer = true
emuScreenLayer.setNeedsDisplay()
//emuScreenLayer.setNeedsDisplay()
emulatorView.layer?.addSublayer(emuScreenLayer)
installOverrides()
@ -70,11 +70,19 @@ final class AppleII: NSObject, EmulatedSystem {
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)
CPU.sharedInstance.memoryInterface.loadBinary(path: "/Users/luigi/apple2/341-0004-00.f8", offset: 0xF800, length: 0x800)
//Hardware handles this, really.
if(backplane[0] is LanguageCard16K) {
//Language Card ROM
CPU.sharedInstance.memoryInterface.loadBinary(path: "/Users/luigi/apple2/341-0020-00.f8", offset: 0xF800, length: 0x800)
} else {
//Integer BASIC ROM
CPU.sharedInstance.memoryInterface.loadBinary(path: "/Users/luigi/apple2/341-0004-00.f8", offset: 0xF800, length: 0x800)
}
}
func installOverrides() {
for (slotNum, peripheral) in backplane {
for (_, peripheral) in backplane {
if(peripheral != nil) {
peripheral!.installOverrides()
}
@ -203,6 +211,24 @@ final class AppleII: NSObject, EmulatedSystem {
}
}
func setupPeripherals() {
let defaults = UserDefaults.standard
let slot0 = defaults.string(forKey: "a2_Peripherals_Slot0")
if(slot0 == "Language Card (16K)") {
backplane[0] = LanguageCard16K(slot: 0, romPath: "/Users/luigi/apple2/341-0020-00.f8")
}
let slot6 = defaults.string(forKey: "a2_Peripherals_Slot6")
if(slot6 == "Disk II") {
backplane[6] = DiskII(slot: 6, romPath: "/Users/luigi/apple2/341-0027-a.p5")
let drive = backplane[6]! as! DiskII
drive.attachDiskImage(imagePath: "/Users/luigi/apple2/Apex II - Apple II Diagnostic (v4.7-1986).DSK")
//drive.attachDiskImage(imagePath: "/Users/luigi/apple2/clean332sysmas.do")
}
}
@objc func debuggerBreak() {
}

View File

@ -34,7 +34,9 @@ import Cocoa
H H WRITE LOAD
*/
class DiskII: NSObject, Peripheral {
class DiskII: NSObject, Peripheral, HasROM {
let debug = false
enum MotorPhase {
case Phase0
case Phase1
@ -77,6 +79,8 @@ class DiskII: NSObject, Peripheral {
var mediaPosition: Int = 0
var motorPhase: MotorPhase = .Phase0
var preloadedByte: UInt8 = 0x00
var diskImage: DiskImage?
init(slot: Int, romPath: String) {
@ -106,10 +110,11 @@ class DiskII: NSObject, Peripheral {
}
//http://ftp.twaren.net/NetBSD/misc/wrstuden/Apple_PDFs/Software%20control%20of%20IWM.pdf
private func actionDispatchOperation(something: AnyObject, address: UInt16, byte: UInt8?) -> UInt8? {
private func actionDispatchOperation(something: AnyObject, address: UInt16, byte: UInt8?) -> UInt8?
{
let operationNumber = UInt8(address & 0xFF) - UInt8(0x80 & 0xFF) - UInt8(0x10 * slotNumber)
print("Disk II command: \(operationNumber)")
if(debug) { print("Disk II command: \(operationNumber)") }
//Update the softswitches.
switch(operationNumber) {
@ -123,15 +128,15 @@ class DiskII: NSObject, Peripheral {
{
currentTrack -= 1
}
print("Drive now on track \(currentTrack)")
updateCurrentTrackDisplay(drive: softswitches.DriveSelect)
if(debug) { print("Drive now on track \(currentTrack)") }
//updateCurrentTrackDisplay(drive: softswitches.DriveSelect)
} else if(motorPhase == .Phase3) {
motorPhase = .Phase0
if(currentTrack % 2 == 1 && currentTrack < 34) {
currentTrack += 1
}
print("Drive now on track \(currentTrack)")
updateCurrentTrackDisplay(drive: softswitches.DriveSelect)
if(debug) { print("Drive now on track \(currentTrack)") }
//updateCurrentTrackDisplay(drive: softswitches.DriveSelect)
}
case 2:
softswitches.Phase1 = false
@ -149,15 +154,15 @@ class DiskII: NSObject, Peripheral {
if(currentTrack % 2 == 1 && currentTrack > 0) {
currentTrack -= 1
}
print("Drive now on track \(currentTrack)")
updateCurrentTrackDisplay(drive: softswitches.DriveSelect)
if(debug) { print("Drive now on track \(currentTrack)") }
//updateCurrentTrackDisplay(drive: softswitches.DriveSelect)
} else if(motorPhase == .Phase1) {
motorPhase = .Phase2
if(currentTrack % 2 == 0 && currentTrack < 34) {
currentTrack += 1;
}
print("Drive now on track \(currentTrack)")
updateCurrentTrackDisplay(drive: softswitches.DriveSelect)
if(debug) { print("Drive now on track \(currentTrack)") }
//updateCurrentTrackDisplay(drive: softswitches.DriveSelect)
}
case 6:
softswitches.Phase3 = false
@ -175,7 +180,7 @@ class DiskII: NSObject, Peripheral {
selector: #selector(disableDrive1Motor),
userInfo: nil,
repeats: false)
print("Drive 1 Motor will turn off in 1 second")
if(debug) { print("Drive 1 Motor will turn off in 1 second") }
} else {
NotificationCenter.default.post(name: DiskII.N_Drive2MotorOff, object: nil)
motor2OffTimer = Timer.scheduledTimer(timeInterval: 1.0,
@ -183,63 +188,80 @@ class DiskII: NSObject, Peripheral {
selector: #selector(disableDrive2Motor),
userInfo: nil,
repeats: false)
print("Drive 2 Motor will turn off in 1 second")
if(debug) { print("Drive 2 Motor will turn off in 1 second") }
}
case 9:
softswitches.MotorPowered = true
if(softswitches.DriveSelect == false) {
NotificationCenter.default.post(name: DiskII.N_Drive1MotorOn, object: nil)
motor1OffTimer?.invalidate()
print("Drive 1 Motor is on")
if(debug) { print("Drive 1 Motor is on") }
} else {
NotificationCenter.default.post(name: DiskII.N_Drive2MotorOn, object: nil)
motor1OffTimer?.invalidate()
print("Drive 2 Motor is on")
if(debug) { print("Drive 2 Motor is on") }
}
case 10:
softswitches.DriveSelect = false
print("Drive 1 selected")
if(debug) { print("Drive 1 selected") }
case 11:
softswitches.DriveSelect = true
print("Drive 2 selected")
if(debug) { print("Drive 2 selected") }
case 12:
softswitches.Q6 = false
if(softswitches.Q7 == false && byte == nil) {
//in read mode and a read was requested. get the next byte
let trk = CPU.sharedInstance.memoryInterface.readByte(offset: 0xB7EC, bypassOverrides: true)
let sec = CPU.sharedInstance.memoryInterface.readByte(offset: 0xB7ED, bypassOverrides: true)
let mode = CPU.sharedInstance.memoryInterface.readByte(offset: 0xB7F4, bypassOverrides: true)
if(trk == 2 && sec == 4 && mode == 1)
{
_ = 1
}
let modeString: String
switch (mode) {
case 0:
modeString = "seeking"
case 1:
modeString = "reading"
case 2:
modeString = "writing"
case 4:
modeString = "formatting"
default:
modeString = "???"
}
let trk = CPU.sharedInstance.memoryInterface.readByte(offset: 0xB7EC, bypassOverrides: true)
let sec = CPU.sharedInstance.memoryInterface.readByte(offset: 0xB7ED, bypassOverrides: true)
let mode = CPU.sharedInstance.memoryInterface.readByte(offset: 0xB7F4, bypassOverrides: true)
if(trk == 2 && sec == 4 && mode == 1)
{
_ = 1
}
let modeString: String
switch (mode) {
case 0:
modeString = "seeking"
case 1:
modeString = "reading"
case 2:
modeString = "writing"
case 4:
modeString = "formatting"
default:
modeString = "???"
}
if(debug) { print("Head is at nibble \(mediaPosition) of track \(currentTrack). DOS is \(modeString) T\(trk) S\(sec).") }
updateCurrentTrackSectorDisplay(drive: softswitches.DriveSelect, track: currentTrack, sector: Int(sec))
print("Head is at nibble \(mediaPosition) of track \(currentTrack). DOS is \(modeString) T\(trk) S\(sec).")
if(softswitches.Q7 == false && byte == nil) {
//in read mode and a read was requested. get the next nibble
return readByteOfTrack(track: currentTrack, advance: softswitches.MotorPowered ? 1 : 0)
}
if(softswitches.Q7 == true && byte == nil) {
//in write mode
writeNibbleOfTrack(track: currentTrack, advance: softswitches.MotorPowered ? 1 : 0, nibble: preloadedByte)
return 0x00
}
if(debug) { print("Disk II: Operation failed!") }
case 13:
//WRITE PROTECT SENSE MODE
softswitches.Q6 = true
case 14:
//READ MODE
if(debug) { print("Disk II: READ STATUS REGISTER") }
softswitches.Q7 = false
return 0x00 | (diskImage!.writeProtect ? 0x80 : 0x00) | (softswitches.MotorPowered ? 0x20 : 0x00)
case 15:
softswitches.Q7 = true
//STA $C
if(softswitches.Q6 == true && byte != nil) {
preloadedByte = byte!
if(debug) { print("WRITE LOAD: shift register contains \(preloadedByte.asHexString())") }
}
default:
print("Unknown command? This can't happen.")
if(debug) { print("Unknown command? This can't happen.") }
}
return 0x00
@ -258,12 +280,25 @@ class DiskII: NSObject, Peripheral {
return result
}
func updateCurrentTrackDisplay(drive: Bool) {
func writeNibbleOfTrack(track: Int, advance: Int, nibble: UInt8) {
if(diskImage == nil) { return} //No disk inserted, fail.
let trackData = diskImage?.encodedTracks[track]
if(trackData == nil) { return } //No disk inserted, fail.
if(debug) { print("wrote \(nibble.asHexString()) to disk") }
diskImage!.encodedTracks[track][mediaPosition] = nibble
mediaPosition = (mediaPosition + advance) % trackData!.count
}
func updateCurrentTrackSectorDisplay(drive: Bool, track: Int, sector: Int) {
if(drive == false) {
NotificationCenter.default.post(name: DiskII.N_Drive1TrackChanged, object: currentTrack)
NotificationCenter.default.post(name: DiskII.N_Drive1TrackChanged, object: (currentTrack, sector))
}
else {
NotificationCenter.default.post(name: DiskII.N_Drive2TrackChanged, object: currentTrack)
NotificationCenter.default.post(name: DiskII.N_Drive2TrackChanged, object: (currentTrack, sector))
}
}
@ -288,11 +323,11 @@ class DiskII: NSObject, Peripheral {
@objc func disableDrive1Motor() {
softswitches.MotorPowered = false
print("Drive 1 Motor is now off")
if(debug) { print("Drive 1 Motor is now off") }
}
@objc func disableDrive2Motor() {
softswitches.MotorPowered = false
print("Drive 2 Motor is now off")
if(debug) { print("Drive 2 Motor is now off") }
}
}

View File

@ -83,6 +83,7 @@ class DiskImage: NSObject {
var encodedTracks = [[UInt8]]()
var fileSize: UInt64 = 0
var image: DiskImageFormat?
var writeProtect = false
init(diskPath: String) {
do {

View File

@ -0,0 +1,60 @@
//
// LanguageCard16K.swift
// FruitMachine
//
// Created by Christopher Rohl on 8/6/17.
// Copyright © 2017 Christopher Rohl. All rights reserved.
//
import Cocoa
class LanguageCard16K: NSObject, Peripheral, HasROM {
var slotNumber: Int
var romManager: ROMManager
//16KB of RAM on the Language Card.
var ram = [UInt8](repeating: 0xCC, count: 16384)
var readIOOverride: ReadOverride? = nil
var writeIOOverride: WriteOverride? = nil
func installOverrides() {
func installOverrides() {
CPU.sharedInstance.memoryInterface.read_overrides.append(readIOOverride!)
CPU.sharedInstance.memoryInterface.write_overrides.append(writeIOOverride!)
}
}
init(slot: Int, romPath: String) {
slotNumber = slot
romManager = ROMManager(path: romPath, atAddress: 0x0, size: 2048)
super.init()
readIOOverride = ReadOverride(start: UInt16(0xC080 + (0x10 * slotNumber)),
end: UInt16(0xC08F + (0x10 * slotNumber)),
readAnyway: false,
action: actionDispatchOperation)
writeIOOverride = WriteOverride(start: UInt16(0xC080 + (0x10 * slotNumber)),
end: UInt16(0xC08F + (0x10 * slotNumber)),
writeAnyway: false,
action: actionDispatchOperation)
}
private func actionDispatchOperation(something: AnyObject, address: UInt16, byte: UInt8?) -> UInt8?
{
let operationNumber = UInt8(address & 0xFF) - UInt8(0x80 & 0xFF) - UInt8(0x10 * slotNumber)
var isRead = false
if(byte == nil) {
isRead = true
}
print("Language Card command: \(isRead == false ? "Read" : "Write") $\(operationNumber.asHexString())")
return 0x00
}
}

View File

@ -26,10 +26,8 @@ extension AppleII {
override func draw(_ dirtyRect: NSRect) {
super.draw(dirtyRect)
// Drawing code here.
layer?.sublayers![0].setNeedsDisplay()
layer?.sublayers![0].display()
}
}

View File

@ -27,12 +27,10 @@ class AppleIIViewController: NSViewController {
preferencesWindowController = PreferencesWindowController()
self.view.addSubview(computer.emulatorView)
preferencesWindowController.setupDefaultsIfRequired()
setupDriveNotifications()
NotificationCenter.default.addObserver(self, selector: #selector(self.debuggerBreak), name: DebuggerNotifications.Break, object: nil)
let drive = computer.backplane[6]! as! DiskII
drive.attachDiskImage(imagePath: "/Users/luigi/apple2/clean332sysmas.do")
self.frameTimer = Timer.scheduledTimer(timeInterval: 1.0/60.0,
target: self,
selector: #selector(runEmulation),
@ -60,6 +58,7 @@ class AppleIIViewController: NSViewController {
@IBAction func showPreferences(_ sender: Any) {
preferencesWindowController.loadWindow()
preferencesWindowController.showWindow(self)
}
@IBAction func doReset(_ sender: Any) {
@ -107,12 +106,12 @@ class AppleIIViewController: NSViewController {
/* drive lights */
@objc func drive1TrackChanged(notification: NSNotification) {
let num = notification.object as? Int
lbl_Drive1.stringValue = "D1 \(num!)"
let num = notification.object as? (Int, Int)
lbl_Drive1.stringValue = "D1 T\(num!.0) S\(num!.1)"
}
@objc func drive2TrackChanged(notification: NSNotification) {
let num = notification.object as? Int
lbl_Drive2.stringValue = "D2 \(num!)"
let num = notification.object as? (Int, Int)
lbl_Drive2.stringValue = "D1 T\(num!.0) S\(num!.1)"
}
@objc func drive1MotorOff(notification: NSNotification) {

View File

@ -187,19 +187,19 @@
<rect key="frame" x="0.0" y="0.0" width="560" height="400"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="jaO-yO-mV1">
<rect key="frame" x="446" y="0.0" width="46" height="17"/>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Xl9-rO-Y9T">
<rect key="frame" x="478" y="0.0" width="64" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Drive 1" id="Yaa-0g-KnI">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Drive 2" id="Kaf-uu-AhW">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Xl9-rO-Y9T">
<rect key="frame" x="496" y="0.0" width="46" height="17"/>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="jaO-yO-mV1">
<rect key="frame" x="410" y="0.0" width="64" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Drive 2" id="Kaf-uu-AhW">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Drive 1" id="Yaa-0g-KnI">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>

View File

@ -8,6 +8,8 @@
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="PreferencesWindowController" customModule="FruitMachine" customModuleProvider="target">
<connections>
<outlet property="a2_Peripherals_Slot0" destination="vWt-St-7kp" id="4VF-4b-kcd"/>
<outlet property="a2_Peripherals_Slot6" destination="1CB-yF-5GW" id="zcX-Ts-Jd4"/>
<outlet property="path_ROMBasic" destination="ilU-dc-qbI" id="HXt-ut-QQs"/>
<outlet property="path_ROMCharacter" destination="RaY-CW-boq" id="Ksl-Va-CNF"/>
<outlet property="path_ROMMonitor" destination="baZ-pZ-s9k" id="Pfr-1I-YVU"/>
@ -19,30 +21,30 @@
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" animationBehavior="default" id="F0z-JX-Cv5">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="196" y="240" width="600" height="270"/>
<rect key="contentRect" x="196" y="240" width="600" height="400"/>
<rect key="screenRect" x="0.0" y="0.0" width="1916" height="936"/>
<view key="contentView" wantsLayer="YES" id="se5-gp-TjO">
<rect key="frame" x="0.0" y="0.0" width="600" height="270"/>
<rect key="frame" x="0.0" y="0.0" width="600" height="400"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<tabView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="QBQ-oL-aRV">
<rect key="frame" x="13" y="2" width="574" height="254"/>
<rect key="frame" x="13" y="2" width="574" height="384"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<font key="font" metaFont="system"/>
<tabViewItems>
<tabViewItem label="General" identifier="1" id="nQU-pA-pvF">
<view key="view" id="iK8-x4-ay0">
<rect key="frame" x="10" y="33" width="554" height="208"/>
<rect key="frame" x="10" y="33" width="554" height="338"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
</view>
</tabViewItem>
<tabViewItem label="Paths" identifier="2" id="zXY-01-Th8">
<view key="view" id="tiQ-eh-pdD">
<rect key="frame" x="10" y="33" width="554" height="208"/>
<rect key="frame" x="10" y="33" width="554" height="338"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="0tt-yx-hQq">
<rect key="frame" x="15" y="158" width="98" height="17"/>
<rect key="frame" x="15" y="288" width="98" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Character ROM" id="DYu-44-QXW">
<font key="font" metaFont="system"/>
@ -51,7 +53,7 @@
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ahs-aw-sgj">
<rect key="frame" x="15" y="126" width="98" height="17"/>
<rect key="frame" x="15" y="256" width="98" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="BASIC" id="hqe-Cz-qLg">
<font key="font" metaFont="system"/>
@ -60,7 +62,7 @@
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="baZ-pZ-s9k">
<rect key="frame" x="119" y="185" width="300" height="22"/>
<rect key="frame" x="119" y="315" width="300" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" placeholderString="apple1.rom" drawsBackground="YES" id="Gpc-0E-NSa">
<font key="font" metaFont="system"/>
@ -69,7 +71,7 @@
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="RaY-CW-boq">
<rect key="frame" x="119" y="155" width="300" height="22"/>
<rect key="frame" x="119" y="285" width="300" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" placeholderString="apple1.vid" drawsBackground="YES" id="pOl-Qk-r52">
<font key="font" metaFont="system"/>
@ -78,7 +80,7 @@
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ilU-dc-qbI">
<rect key="frame" x="119" y="123" width="300" height="22"/>
<rect key="frame" x="119" y="253" width="300" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" placeholderString="basic.bin" drawsBackground="YES" id="MeQ-50-cJX">
<font key="font" metaFont="system"/>
@ -87,7 +89,7 @@
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="7mx-PW-Mqu">
<rect key="frame" x="15" y="188" width="98" height="17"/>
<rect key="frame" x="15" y="318" width="98" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Monitor ROM" id="Yjm-OO-WWk">
<font key="font" metaFont="system"/>
@ -96,7 +98,7 @@
</textFieldCell>
</textField>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="K1L-jr-UMJ">
<rect key="frame" x="421" y="179" width="81" height="32"/>
<rect key="frame" x="421" y="309" width="81" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="push" title="Browse" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="C7v-Nv-q0t">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
@ -107,7 +109,7 @@
</connections>
</button>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="NzD-Hf-wKo">
<rect key="frame" x="421" y="149" width="81" height="32"/>
<rect key="frame" x="421" y="279" width="81" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="push" title="Browse" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="Umn-qd-Iog">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
@ -118,7 +120,7 @@
</connections>
</button>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="cWc-WS-hPu">
<rect key="frame" x="421" y="117" width="81" height="32"/>
<rect key="frame" x="421" y="247" width="81" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="push" title="Browse" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="e8M-Tb-dKP">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
@ -133,14 +135,206 @@
</tabViewItem>
<tabViewItem label="Apple I" identifier="" id="0ak-CP-2BL">
<view key="view" id="BGQ-27-4EP">
<rect key="frame" x="10" y="33" width="554" height="208"/>
<rect key="frame" x="10" y="33" width="554" height="338"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
</view>
</tabViewItem>
<tabViewItem label="Apple II" identifier="" id="aVa-m9-VEl">
<view key="view" ambiguous="YES" id="mjS-Jn-KXO">
<rect key="frame" x="10" y="33" width="554" height="208"/>
<rect key="frame" x="10" y="33" width="554" height="338"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Vav-pa-mvK">
<rect key="frame" x="15" y="318" width="40" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Slot 0" id="WlR-dZ-W72">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Rlr-ba-8ra">
<rect key="frame" x="15" y="292" width="40" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Slot 1" id="9CT-bF-2b1">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<popUpButton verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Lvh-92-Ob0">
<rect key="frame" x="59" y="286" width="200" height="26"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<popUpButtonCell key="cell" type="push" title="Nothing" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="D6o-nP-s6d" id="RLd-bf-oyA">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" id="ehC-Uf-YRv">
<items>
<menuItem title="Nothing" state="on" id="D6o-nP-s6d"/>
<menuItem title="Item 2" id="3Aa-TF-wxE"/>
<menuItem title="Item 3" id="8zg-2V-4TE"/>
</items>
</menu>
</popUpButtonCell>
</popUpButton>
<popUpButton verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="tQA-LM-0T1">
<rect key="frame" x="59" y="260" width="200" height="26"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<popUpButtonCell key="cell" type="push" title="Nothing" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="RXL-80-c5U" id="M1v-yb-ebb">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" id="BVF-4V-WR3">
<items>
<menuItem title="Nothing" state="on" id="RXL-80-c5U"/>
<menuItem title="Item 2" id="zhp-yU-tJQ"/>
<menuItem title="Item 3" id="FgR-sg-Ycb"/>
</items>
</menu>
</popUpButtonCell>
</popUpButton>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="oeY-9x-3x1">
<rect key="frame" x="15" y="239" width="40" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Slot 3" id="qwP-Fk-pIB">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<popUpButton verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Ron-Jc-5NS">
<rect key="frame" x="59" y="233" width="200" height="26"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<popUpButtonCell key="cell" type="push" title="Nothing" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="khL-Nw-Yyb" id="5Uy-Yz-oHu">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" id="ABc-nU-K8e">
<items>
<menuItem title="Nothing" state="on" id="khL-Nw-Yyb"/>
<menuItem title="Item 2" id="vhM-Mc-BdY"/>
<menuItem title="Item 3" id="dvz-rg-5hC"/>
</items>
</menu>
</popUpButtonCell>
</popUpButton>
<popUpButton verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="vWt-St-7kp">
<rect key="frame" x="59" y="313" width="200" height="26"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<popUpButtonCell key="cell" type="push" title="Nothing" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="hE4-yk-CCz" id="SSf-AV-4XO">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" id="8JB-yG-5ex">
<items>
<menuItem title="Nothing" state="on" id="hE4-yk-CCz"/>
<menuItem title="Language Card (16K)" id="rIC-xs-0nk"/>
</items>
</menu>
</popUpButtonCell>
</popUpButton>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="wql-7f-Cmb">
<rect key="frame" x="15" y="212" width="40" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Slot 4" id="uVy-Wv-hRJ">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ZVS-Jk-MpZ">
<rect key="frame" x="15" y="186" width="40" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Slot 5" id="ua9-zw-Mzd">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<popUpButton verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="sjp-qD-NrB">
<rect key="frame" x="59" y="180" width="200" height="26"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<popUpButtonCell key="cell" type="push" title="Nothing" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="LS7-45-B1l" id="6hp-fp-PHh">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" id="MGk-a2-Wiw">
<items>
<menuItem title="Nothing" state="on" id="LS7-45-B1l"/>
<menuItem title="Item 2" id="QUc-2y-bgV"/>
<menuItem title="Item 3" id="hOL-mV-ObJ"/>
</items>
</menu>
</popUpButtonCell>
</popUpButton>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="nm9-Zu-F6e">
<rect key="frame" x="15" y="160" width="40" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Slot 6" id="SWC-La-cqL">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<popUpButton verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="1CB-yF-5GW">
<rect key="frame" x="59" y="154" width="200" height="26"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<popUpButtonCell key="cell" type="push" title="Disk II" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="2jc-dw-NSC" id="bnz-0t-Peo">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" id="Gmy-bt-yLT">
<items>
<menuItem title="Nothing" id="Fgn-3I-HS8"/>
<menuItem title="Disk II" state="on" id="2jc-dw-NSC"/>
</items>
</menu>
</popUpButtonCell>
</popUpButton>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="rtE-66-3Uw">
<rect key="frame" x="15" y="133" width="40" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Slot 7" id="9oV-LI-9Pq">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<popUpButton verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="al0-aZ-uIH">
<rect key="frame" x="59" y="127" width="200" height="26"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<popUpButtonCell key="cell" type="push" title="Nothing" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="Nxx-1S-5RB" id="eNb-sq-3kP">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" id="sm6-od-VnN">
<items>
<menuItem title="Nothing" state="on" id="Nxx-1S-5RB"/>
<menuItem title="Item 2" id="nhv-rv-a60"/>
<menuItem title="Item 3" id="M78-5p-KlG"/>
</items>
</menu>
</popUpButtonCell>
</popUpButton>
<popUpButton verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="cyH-8e-Kfo">
<rect key="frame" x="59" y="207" width="200" height="26"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<popUpButtonCell key="cell" type="push" title="Nothing" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="F24-4g-S0w" id="UNW-s2-DPf">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" id="HDF-3A-IYh">
<items>
<menuItem title="Nothing" state="on" id="F24-4g-S0w"/>
<menuItem title="Item 2" id="qAk-8l-I2H"/>
<menuItem title="Item 3" id="KF9-yU-sWA"/>
</items>
</menu>
</popUpButtonCell>
</popUpButton>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="xvm-ee-hrf">
<rect key="frame" x="15" y="266" width="40" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Slot 2" id="IDk-eE-egh">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
</view>
</tabViewItem>
</tabViewItems>

View File

@ -9,16 +9,50 @@
import Cocoa
class PreferencesWindowController: NSWindowController {
/* Apple I ROM paths */
@IBOutlet weak var path_ROMMonitor: NSTextField!
@IBOutlet weak var path_ROMCharacter: NSTextField!
@IBOutlet weak var path_ROMBasic: NSTextField!
/* Apple II ROM paths */
/* Apple II Peripherals */
@IBOutlet weak var a2_Peripherals_Slot0: NSPopUpButton!
@IBOutlet weak var a2_Peripherals_Slot6: NSPopUpButton!
let defaults = UserDefaults.standard
override func windowDidLoad() {
super.windowDidLoad()
NotificationCenter.default.addObserver(
self,
selector: #selector(windowWillClose),
name: NSWindow.willCloseNotification,
object: nil)
// Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.
setupPreferences()
super.windowDidLoad()
}
func setupDefaultsIfRequired() {
// UserDefaults.standard.removePersistentDomain(forName: Bundle.main.bundleIdentifier!)
// UserDefaults.standard.synchronize()
var slot0 = defaults.string(forKey: "a2_Peripherals_Slot0")
var slot6 = defaults.string(forKey: "a2_Peripherals_Slot6")
if(slot0 == nil) { slot0 = "Language Card (16K)" }
if(slot6 == nil) { slot6 = "Disk II" }
defaults.set(slot0, forKey: "a2_Peripherals_Slot0")
defaults.set(slot6, forKey: "a2_Peripherals_Slot6")
}
func setupPreferences() {
setupA1RomPaths()
setupA2Peripherals()
}
func setupA1RomPaths() {
let monitorPath = defaults.string(forKey: "path_ROMMonitor")
let characterPath = defaults.string(forKey: "path_ROMCharacter")
let basicPath = defaults.string(forKey: "path_ROMBasic")
@ -36,11 +70,26 @@ class PreferencesWindowController: NSWindowController {
}
}
func windowWillClose(_ notification: Notification) {
func setupA2Peripherals() {
let slot0 = defaults.string(forKey: "a2_Peripherals_Slot0")
if(slot0 != nil) {
a2_Peripherals_Slot6.selectItem(withTitle: slot0!)
}
let slot6 = defaults.string(forKey: "a2_Peripherals_Slot6")
if(slot6 != nil) {
a2_Peripherals_Slot6.selectItem(withTitle: slot6!)
}
}
@objc func windowWillClose(_ notification: Notification) {
defaults.set(path_ROMMonitor.stringValue, forKey: "path_ROMMonitor")
defaults.set(path_ROMCharacter.stringValue, forKey: "path_ROMCharacter")
defaults.set(path_ROMBasic.stringValue, forKey: "path_ROMBasic")
defaults.set(a2_Peripherals_Slot0.selectedItem?.title, forKey: "a2_Peripherals_Slot0")
defaults.set(a2_Peripherals_Slot6.selectedItem?.title, forKey: "a2_Peripherals_Slot6")
defaults.synchronize()
}