1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 23:52:26 +00:00

Migrated the Vic document to a mere options panel.

This commit is contained in:
Thomas Harte 2016-10-03 07:42:05 -04:00
parent 9e6e84647e
commit bf468db73d
6 changed files with 94 additions and 95 deletions

View File

@ -46,7 +46,6 @@
4B69FB441C4D941400B5F0AA /* TapeUEF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B69FB421C4D941400B5F0AA /* TapeUEF.cpp */; }; 4B69FB441C4D941400B5F0AA /* TapeUEF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B69FB421C4D941400B5F0AA /* TapeUEF.cpp */; };
4B69FB461C4D950F00B5F0AA /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B69FB451C4D950F00B5F0AA /* libz.tbd */; }; 4B69FB461C4D950F00B5F0AA /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B69FB451C4D950F00B5F0AA /* libz.tbd */; };
4B6C73BD1D387AE500AFCFCA /* DiskController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B6C73BB1D387AE500AFCFCA /* DiskController.cpp */; }; 4B6C73BD1D387AE500AFCFCA /* DiskController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B6C73BB1D387AE500AFCFCA /* DiskController.cpp */; };
4B73C71A1D036BD90074D992 /* Vic20Document.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B73C7191D036BD90074D992 /* Vic20Document.swift */; };
4B8FE21B1DA19D5F0090D3CE /* Atari2600Options.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4B8FE2131DA19D5F0090D3CE /* Atari2600Options.xib */; }; 4B8FE21B1DA19D5F0090D3CE /* Atari2600Options.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4B8FE2131DA19D5F0090D3CE /* Atari2600Options.xib */; };
4B8FE21C1DA19D5F0090D3CE /* MachineDocument.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4B8FE2151DA19D5F0090D3CE /* MachineDocument.xib */; }; 4B8FE21C1DA19D5F0090D3CE /* MachineDocument.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4B8FE2151DA19D5F0090D3CE /* MachineDocument.xib */; };
4B8FE21D1DA19D5F0090D3CE /* ElectronOptions.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4B8FE2171DA19D5F0090D3CE /* ElectronOptions.xib */; }; 4B8FE21D1DA19D5F0090D3CE /* ElectronOptions.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4B8FE2171DA19D5F0090D3CE /* ElectronOptions.xib */; };
@ -57,6 +56,7 @@
4B8FE2291DA1EDDF0090D3CE /* ElectronOptionsPanel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B8FE2281DA1EDDF0090D3CE /* ElectronOptionsPanel.swift */; }; 4B8FE2291DA1EDDF0090D3CE /* ElectronOptionsPanel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B8FE2281DA1EDDF0090D3CE /* ElectronOptionsPanel.swift */; };
4B92EACA1B7C112B00246143 /* 6502TimingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B92EAC91B7C112B00246143 /* 6502TimingTests.swift */; }; 4B92EACA1B7C112B00246143 /* 6502TimingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B92EAC91B7C112B00246143 /* 6502TimingTests.swift */; };
4B96F7221D75119A0058BB2D /* Tape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B96F7201D75119A0058BB2D /* Tape.cpp */; }; 4B96F7221D75119A0058BB2D /* Tape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B96F7201D75119A0058BB2D /* Tape.cpp */; };
4B9CCDA11DA279CA0098B625 /* Vic20OptionsPanel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B9CCDA01DA279CA0098B625 /* Vic20OptionsPanel.swift */; };
4BA22B071D8817CE0008C640 /* Disk.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BA22B051D8817CE0008C640 /* Disk.cpp */; }; 4BA22B071D8817CE0008C640 /* Disk.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BA22B051D8817CE0008C640 /* Disk.cpp */; };
4BA61EB01D91515900B3C876 /* NSData+StdVector.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4BA61EAF1D91515900B3C876 /* NSData+StdVector.mm */; }; 4BA61EB01D91515900B3C876 /* NSData+StdVector.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4BA61EAF1D91515900B3C876 /* NSData+StdVector.mm */; };
4BA799951D8B656E0045123D /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BA799931D8B656E0045123D /* StaticAnalyser.cpp */; }; 4BA799951D8B656E0045123D /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BA799931D8B656E0045123D /* StaticAnalyser.cpp */; };
@ -468,7 +468,6 @@
4B69FB451C4D950F00B5F0AA /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; }; 4B69FB451C4D950F00B5F0AA /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; };
4B6C73BB1D387AE500AFCFCA /* DiskController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DiskController.cpp; sourceTree = "<group>"; }; 4B6C73BB1D387AE500AFCFCA /* DiskController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DiskController.cpp; sourceTree = "<group>"; };
4B6C73BC1D387AE500AFCFCA /* DiskController.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = DiskController.hpp; sourceTree = "<group>"; }; 4B6C73BC1D387AE500AFCFCA /* DiskController.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = DiskController.hpp; sourceTree = "<group>"; };
4B73C7191D036BD90074D992 /* Vic20Document.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Vic20Document.swift; sourceTree = "<group>"; };
4B8FE2141DA19D5F0090D3CE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = "Clock Signal/Base.lproj/Atari2600Options.xib"; sourceTree = SOURCE_ROOT; }; 4B8FE2141DA19D5F0090D3CE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = "Clock Signal/Base.lproj/Atari2600Options.xib"; sourceTree = SOURCE_ROOT; };
4B8FE2161DA19D5F0090D3CE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = "Clock Signal/Base.lproj/MachineDocument.xib"; sourceTree = SOURCE_ROOT; }; 4B8FE2161DA19D5F0090D3CE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = "Clock Signal/Base.lproj/MachineDocument.xib"; sourceTree = SOURCE_ROOT; };
4B8FE2181DA19D5F0090D3CE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = "Clock Signal/Base.lproj/ElectronOptions.xib"; sourceTree = SOURCE_ROOT; }; 4B8FE2181DA19D5F0090D3CE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = "Clock Signal/Base.lproj/ElectronOptions.xib"; sourceTree = SOURCE_ROOT; };
@ -481,6 +480,7 @@
4B92EAC91B7C112B00246143 /* 6502TimingTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = 6502TimingTests.swift; sourceTree = "<group>"; }; 4B92EAC91B7C112B00246143 /* 6502TimingTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = 6502TimingTests.swift; sourceTree = "<group>"; };
4B96F7201D75119A0058BB2D /* Tape.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Tape.cpp; path = ../../StaticAnalyser/Acorn/Tape.cpp; sourceTree = "<group>"; }; 4B96F7201D75119A0058BB2D /* Tape.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Tape.cpp; path = ../../StaticAnalyser/Acorn/Tape.cpp; sourceTree = "<group>"; };
4B96F7211D75119A0058BB2D /* Tape.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Tape.hpp; path = ../../StaticAnalyser/Acorn/Tape.hpp; sourceTree = "<group>"; }; 4B96F7211D75119A0058BB2D /* Tape.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Tape.hpp; path = ../../StaticAnalyser/Acorn/Tape.hpp; sourceTree = "<group>"; };
4B9CCDA01DA279CA0098B625 /* Vic20OptionsPanel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Vic20OptionsPanel.swift; sourceTree = "<group>"; };
4BA22B051D8817CE0008C640 /* Disk.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Disk.cpp; path = ../../StaticAnalyser/Commodore/Disk.cpp; sourceTree = "<group>"; }; 4BA22B051D8817CE0008C640 /* Disk.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Disk.cpp; path = ../../StaticAnalyser/Commodore/Disk.cpp; sourceTree = "<group>"; };
4BA22B061D8817CE0008C640 /* Disk.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Disk.hpp; path = ../../StaticAnalyser/Commodore/Disk.hpp; sourceTree = "<group>"; }; 4BA22B061D8817CE0008C640 /* Disk.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Disk.hpp; path = ../../StaticAnalyser/Commodore/Disk.hpp; sourceTree = "<group>"; };
4BA61EAE1D91515900B3C876 /* NSData+StdVector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSData+StdVector.h"; sourceTree = "<group>"; }; 4BA61EAE1D91515900B3C876 /* NSData+StdVector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSData+StdVector.h"; sourceTree = "<group>"; };
@ -1053,7 +1053,7 @@
4B8FE2281DA1EDDF0090D3CE /* ElectronOptionsPanel.swift */, 4B8FE2281DA1EDDF0090D3CE /* ElectronOptionsPanel.swift */,
4B55CE5E1C3B7D960093A61B /* MachineDocument.swift */, 4B55CE5E1C3B7D960093A61B /* MachineDocument.swift */,
4B8FE2211DA19FB20090D3CE /* MachinePanel.swift */, 4B8FE2211DA19FB20090D3CE /* MachinePanel.swift */,
4B73C7191D036BD90074D992 /* Vic20Document.swift */, 4B9CCDA01DA279CA0098B625 /* Vic20OptionsPanel.swift */,
4B8FE2131DA19D5F0090D3CE /* Atari2600Options.xib */, 4B8FE2131DA19D5F0090D3CE /* Atari2600Options.xib */,
4B8FE2171DA19D5F0090D3CE /* ElectronOptions.xib */, 4B8FE2171DA19D5F0090D3CE /* ElectronOptions.xib */,
4B8FE2151DA19D5F0090D3CE /* MachineDocument.xib */, 4B8FE2151DA19D5F0090D3CE /* MachineDocument.xib */,
@ -2157,7 +2157,6 @@
4B96F7221D75119A0058BB2D /* Tape.cpp in Sources */, 4B96F7221D75119A0058BB2D /* Tape.cpp in Sources */,
4B0BE4281D3481E700D5256B /* DigitalPhaseLockedLoop.cpp in Sources */, 4B0BE4281D3481E700D5256B /* DigitalPhaseLockedLoop.cpp in Sources */,
4BD69F941D98760000243FE1 /* AcornADF.cpp in Sources */, 4BD69F941D98760000243FE1 /* AcornADF.cpp in Sources */,
4B73C71A1D036BD90074D992 /* Vic20Document.swift in Sources */,
4BBF99181C8FBA6F0075DAFB /* TextureTarget.cpp in Sources */, 4BBF99181C8FBA6F0075DAFB /* TextureTarget.cpp in Sources */,
4BC76E691C98E31700E6EF73 /* FIRFilter.cpp in Sources */, 4BC76E691C98E31700E6EF73 /* FIRFilter.cpp in Sources */,
4B55CE5F1C3B7D960093A61B /* MachineDocument.swift in Sources */, 4B55CE5F1C3B7D960093A61B /* MachineDocument.swift in Sources */,
@ -2191,6 +2190,7 @@
4B2A53A21D117D36003C6002 /* CSElectron.mm in Sources */, 4B2A53A21D117D36003C6002 /* CSElectron.mm in Sources */,
4B8FE2201DA19D7C0090D3CE /* Atari2600OptionsPanel.swift in Sources */, 4B8FE2201DA19D7C0090D3CE /* Atari2600OptionsPanel.swift in Sources */,
4B2E2D9A1C3A06EC00138695 /* Atari2600.cpp in Sources */, 4B2E2D9A1C3A06EC00138695 /* Atari2600.cpp in Sources */,
4B9CCDA11DA279CA0098B625 /* Vic20OptionsPanel.swift in Sources */,
4B3051301D98ACC600B4FED8 /* Plus3.cpp in Sources */, 4B3051301D98ACC600B4FED8 /* Plus3.cpp in Sources */,
4B30512D1D989E2200B4FED8 /* Drive.cpp in Sources */, 4B30512D1D989E2200B4FED8 /* Drive.cpp in Sources */,
4BCA6CC81D9DD9F000C2D7B2 /* CommodoreROM.cpp in Sources */, 4BCA6CC81D9DD9F000C2D7B2 /* CommodoreROM.cpp in Sources */,

View File

@ -4,18 +4,14 @@
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11201"/> <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11201"/>
</dependencies> </dependencies>
<objects> <objects>
<customObject id="-2" userLabel="File's Owner" customClass="Vic20Document" customModule="Clock_Signal" customModuleProvider="target"> <customObject id="-2" userLabel="File's Owner" customClass="MachineDocument" customModule="Clock_Signal" customModuleProvider="target">
<connections> <connections>
<outlet property="countryButton" destination="MlB-rE-TXV" id="BCU-M7-TC5"/>
<outlet property="fastLoadingButton" destination="sBT-cU-h7s" id="gWf-9E-D7l"/>
<outlet property="loadAutomaticallyButton" destination="lbt-Wo-6fc" id="Xsc-dz-1a6"/>
<outlet property="memorySizeButton" destination="0NP-x1-qH2" id="Zxg-RB-IUl"/>
<outlet property="optionsPanel" destination="ota-g7-hOL" id="zeO-di-9i3"/> <outlet property="optionsPanel" destination="ota-g7-hOL" id="zeO-di-9i3"/>
</connections> </connections>
</customObject> </customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/> <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/> <customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="Options" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" hidesOnDeactivate="YES" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" frameAutosaveName="" animationBehavior="default" id="ota-g7-hOL" customClass="NSPanel"> <window title="Options" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" hidesOnDeactivate="YES" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" frameAutosaveName="" animationBehavior="default" id="ota-g7-hOL" customClass="Vic20OptionsPanel" customModule="Clock_Signal" customModuleProvider="target">
<windowStyleMask key="styleMask" titled="YES" closable="YES" utility="YES" HUD="YES"/> <windowStyleMask key="styleMask" titled="YES" closable="YES" utility="YES" HUD="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/> <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="83" y="102" width="200" height="134"/> <rect key="contentRect" x="83" y="102" width="200" height="134"/>
@ -31,7 +27,7 @@
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
</buttonCell> </buttonCell>
<connections> <connections>
<action selector="setFastLoading:" target="-2" id="ctR-h1-CYI"/> <action selector="setFastLoading:" target="ota-g7-hOL" id="me0-h2-Ga5"/>
</connections> </connections>
</button> </button>
<button translatesAutoresizingMaskIntoConstraints="NO" id="lbt-Wo-6fc"> <button translatesAutoresizingMaskIntoConstraints="NO" id="lbt-Wo-6fc">
@ -41,7 +37,7 @@
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
</buttonCell> </buttonCell>
<connections> <connections>
<action selector="setShouldLoadAutomatically:" target="-2" id="Ixe-HN-4XK"/> <action selector="setShouldLoadAutomatically:" target="ota-g7-hOL" id="T3i-gO-T1C"/>
</connections> </connections>
</button> </button>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="0NP-x1-qH2"> <popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="0NP-x1-qH2">
@ -58,7 +54,7 @@
</menu> </menu>
</popUpButtonCell> </popUpButtonCell>
<connections> <connections>
<action selector="setMemorySize:" target="-2" id="LSs-M5-2YZ"/> <action selector="setMemorySize:" target="ota-g7-hOL" id="lep-Qi-00V"/>
</connections> </connections>
</popUpButton> </popUpButton>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="MlB-rE-TXV" userLabel="Country Selector"> <popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="MlB-rE-TXV" userLabel="Country Selector">
@ -77,7 +73,7 @@
</menu> </menu>
</popUpButtonCell> </popUpButtonCell>
<connections> <connections>
<action selector="setCountry:" target="-2" id="hi5-76-cdO"/> <action selector="setCountry:" target="ota-g7-hOL" id="YIc-QB-R1S"/>
</connections> </connections>
</popUpButton> </popUpButton>
</subviews> </subviews>
@ -97,6 +93,12 @@
<constraint firstAttribute="trailing" secondItem="MlB-rE-TXV" secondAttribute="trailing" constant="20" id="v18-62-uee"/> <constraint firstAttribute="trailing" secondItem="MlB-rE-TXV" secondAttribute="trailing" constant="20" id="v18-62-uee"/>
</constraints> </constraints>
</view> </view>
<connections>
<outlet property="countryButton" destination="MlB-rE-TXV" id="Duc-AC-ZRO"/>
<outlet property="fastLoadingButton" destination="sBT-cU-h7s" id="uWa-EB-mbd"/>
<outlet property="loadAutomaticallyButton" destination="lbt-Wo-6fc" id="dv0-u8-BTc"/>
<outlet property="memorySizeButton" destination="0NP-x1-qH2" id="qYy-3f-o94"/>
</connections>
<point key="canvasLocation" x="-2" y="32"/> <point key="canvasLocation" x="-2" y="32"/>
</window> </window>
</objects> </objects>

View File

@ -1,50 +1,17 @@
// //
// Vic20Document.swift // Vic20OptionsPanel.swift
// Clock Signal // Clock Signal
// //
// Created by Thomas Harte on 04/06/2016. // Created by Thomas Harte on 03/10/2016.
// Copyright © 2016 Thomas Harte. All rights reserved. // Copyright © 2016 Thomas Harte. All rights reserved.
// //
import Foundation class Vic20OptionsPanel: MachinePanel {
var vic20: CSVic20! {
class Vic20Document: MachineDocument {
/* fileprivate lazy var vic20 = CSVic20()
override var machine: CSMachine! {
get { get {
return vic20 return self.machine as! CSVic20
} }
} }
override var name: String! {
get {
return "vic20"
}
}
// MARK: NSDocument overrides
override init() {
super.init()
if let drive = dataForResource("1540", ofType: "bin", inDirectory: "ROMImages/Commodore1540") {
vic20.setDriveROM(drive)
}
establishStoredOptions()
}
override class func autosavesInPlace() -> Bool {
return true
}
override var windowNibName: String? {
return "Vic20Document"
}
// MARK: machine setup
fileprivate func rom(_ name: String) -> Data? {
return dataForResource(name, ofType: "bin", inDirectory: "ROMImages/Vic20")
}
// MARK: automatic loading tick box // MARK: automatic loading tick box
@IBOutlet var loadAutomaticallyButton: NSButton? @IBOutlet var loadAutomaticallyButton: NSButton?
@ -70,39 +37,19 @@ class Vic20Document: MachineDocument {
} }
fileprivate func setCountry(_ countryID: Int) { fileprivate func setCountry(_ countryID: Int) {
var charactersROM: String?
var kernelROM: String?
switch countryID { switch countryID {
case 0: // Danish case 0: // Danish
charactersROM = "characters-danish" vic20.country = .danish
kernelROM = "kernel-danish"
vic20.region = .PAL
case 1: // European case 1: // European
charactersROM = "characters-english" vic20.country = .european
kernelROM = "kernel-pal"
vic20.region = .PAL
case 2: // Japanese case 2: // Japanese
charactersROM = "characters-japanese" vic20.country = .japanese
kernelROM = "kernel-japanese"
vic20.region = .NTSC
case 3: // Swedish case 3: // Swedish
charactersROM = "characters-swedish" vic20.country = .swedish
kernelROM = "kernel-swedish"
vic20.region = .PAL
case 4: // US case 4: // US
charactersROM = "characters-english" vic20.country = .american
kernelROM = "kernel-ntsc"
vic20.region = .NTSC
default: break default: break
} }
if let charactersROM = charactersROM, let kernelROM = kernelROM {
if let kernel = rom(kernelROM), let basic = rom("basic"), let characters = rom(charactersROM) {
vic20.setKernelROM(kernel)
vic20.setBASICROM(basic)
vic20.setCharactersROM(characters)
}
}
} }
// MARK: memory model selector // MARK: memory model selector
@ -165,5 +112,5 @@ class Vic20Document: MachineDocument {
let country = standardUserDefaults.integer(forKey: self.countryUserDefaultsKey) let country = standardUserDefaults.integer(forKey: self.countryUserDefaultsKey)
setCountry(country) setCountry(country)
self.countryButton?.selectItem(at: country) self.countryButton?.selectItem(at: country)
}*/ }
} }

View File

@ -39,7 +39,7 @@
switch(_target.machine) switch(_target.machine)
{ {
case StaticAnalyser::Target::Electron: return @"ElectronOptions"; case StaticAnalyser::Target::Electron: return @"ElectronOptions";
case StaticAnalyser::Target::Vic20: return nil; case StaticAnalyser::Target::Vic20: return @"Vic20Options";
case StaticAnalyser::Target::Atari2600: return @"Atari2600Options"; case StaticAnalyser::Target::Atari2600: return @"Atari2600Options";
} }

View File

@ -10,10 +10,13 @@
#import "CSKeyboardMachine.h" #import "CSKeyboardMachine.h"
#import "CSFastLoading.h" #import "CSFastLoading.h"
typedef NS_ENUM(NSInteger, CSVic20Region) typedef NS_ENUM(NSInteger, CSVic20Country)
{ {
CSVic20RegionPAL, CSVic20CountryDanish,
CSVic20RegionNTSC CSVic20CountryEuropean,
CSVic20CountryJapanese,
CSVic20CountrySwedish,
CSVic20CountryAmerican
}; };
typedef NS_ENUM(NSInteger, CSVic20MemorySize) typedef NS_ENUM(NSInteger, CSVic20MemorySize)
@ -25,14 +28,9 @@ typedef NS_ENUM(NSInteger, CSVic20MemorySize)
@interface CSVic20 : CSMachine <CSKeyboardMachine, CSFastLoading> @interface CSVic20 : CSMachine <CSKeyboardMachine, CSFastLoading>
- (void)setKernelROM:(nonnull NSData *)rom;
- (void)setBASICROM:(nonnull NSData *)rom;
- (void)setCharactersROM:(nonnull NSData *)rom;
- (void)setDriveROM:(nonnull NSData *)rom;
@property (nonatomic, assign) BOOL useFastLoadingHack; @property (nonatomic, assign) BOOL useFastLoadingHack;
@property (nonatomic, assign) BOOL shouldLoadAutomatically; @property (nonatomic, assign) BOOL shouldLoadAutomatically;
@property (nonatomic, assign) CSVic20Region region; @property (nonatomic, assign) CSVic20Country country;
@property (nonatomic, assign) CSVic20MemorySize memorySize; @property (nonatomic, assign) CSVic20MemorySize memorySize;
@end @end

View File

@ -13,6 +13,8 @@
#include "G64.hpp" #include "G64.hpp"
#include "D64.hpp" #include "D64.hpp"
#import "NSBundle+DataResource.h"
using namespace Commodore::Vic20; using namespace Commodore::Vic20;
@implementation CSVic20 { @implementation CSVic20 {
@ -20,10 +22,27 @@ using namespace Commodore::Vic20;
BOOL _joystickMode; BOOL _joystickMode;
} }
- (CRTMachine::Machine * const)machine { - (CRTMachine::Machine * const)machine { return &_vic20; }
return &_vic20; - (NSString *)userDefaultsPrefix { return @"vic20"; }
- (instancetype)init {
self = [super init];
if(self)
{
[self setDriveROM:[[NSBundle mainBundle] dataForResource:@"1540" withExtension:@"bin" subdirectory:@"ROMImages/Commodore1540"]];
[self setBASICROM:[self rom:@"basic"]];
[self setCountry:CSVic20CountryEuropean];
}
return self;
} }
- (NSData *)rom:(NSString *)name
{
return [[NSBundle mainBundle] dataForResource:name withExtension:@"bin" subdirectory:@"ROMImages/Vic20"];
}
#pragma mark - ROM setting
- (void)setROM:(nonnull NSData *)rom slot:(ROMSlot)slot { - (void)setROM:(nonnull NSData *)rom slot:(ROMSlot)slot {
@synchronized(self) { @synchronized(self) {
_vic20.set_rom(slot, rom.length, (const uint8_t *)rom.bytes); _vic20.set_rom(slot, rom.length, (const uint8_t *)rom.bytes);
@ -46,6 +65,8 @@ using namespace Commodore::Vic20;
[self setROM:rom slot:Drive]; [self setROM:rom slot:Drive];
} }
#pragma mark - Keyboard map
- (void)setKey:(uint16_t)key isPressed:(BOOL)isPressed { - (void)setKey:(uint16_t)key isPressed:(BOOL)isPressed {
static NSDictionary<NSNumber *, NSNumber *> *vicKeysByKeys = @{ static NSDictionary<NSNumber *, NSNumber *> *vicKeysByKeys = @{
@(VK_ANSI_1): @(Key::Key1), @(VK_ANSI_2): @(Key::Key2), @(VK_ANSI_1): @(Key::Key1), @(VK_ANSI_2): @(Key::Key2),
@ -164,10 +185,43 @@ using namespace Commodore::Vic20;
} }
} }
- (void)setRegion:(CSVic20Region)region { - (void)setCountry:(CSVic20Country)country {
_region = region; _country = country;
NSString *charactersROM, *kernelROM;
Commodore::Vic20::Region region;
switch(country)
{
case CSVic20CountryDanish:
region = Commodore::Vic20::Region::PAL;
charactersROM = @"characters-danish";
kernelROM = @"kernel-danish";
break;
case CSVic20CountryEuropean:
region = Commodore::Vic20::Region::PAL;
charactersROM = @"characters-english";
kernelROM = @"kernel-pal";
break;
case CSVic20CountryJapanese:
region = Commodore::Vic20::Region::NTSC;
charactersROM = @"characters-japanese";
kernelROM = @"kernel-japanese";
break;
case CSVic20CountrySwedish:
region = Commodore::Vic20::Region::PAL;
charactersROM = @"characters-swedish";
kernelROM = @"kernel-swedish";
break;
case CSVic20CountryAmerican:
region = Commodore::Vic20::Region::NTSC;
charactersROM = @"characters-english";
kernelROM = @"kernel-ntsc";
break;
}
@synchronized(self) { @synchronized(self) {
_vic20.set_region( (region == CSVic20RegionPAL) ? Commodore::Vic20::Region::PAL : Commodore::Vic20::Region::NTSC); _vic20.set_region(region);
[self setCharactersROM:[self rom:charactersROM]];
[self setKernelROM:[self rom:kernelROM]];
} }
} }
@ -182,6 +236,4 @@ using namespace Commodore::Vic20;
} }
} }
- (NSString *)userDefaultsPrefix { return @"vic20"; }
@end @end