From 6b001e310694519b27b20b2a88158b652e663d50 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Wed, 10 Aug 2022 14:58:19 -0400 Subject: [PATCH] Add ST RAM size selection to the macOS UI. --- .../Machine/StaticAnalyser/CSStaticAnalyser.h | 2 +- .../StaticAnalyser/CSStaticAnalyser.mm | 7 +++- .../Base.lproj/MachinePicker.xib | 40 ++++++++++++++----- .../MachinePicker/MachinePicker.swift | 12 +++++- 4 files changed, 47 insertions(+), 14 deletions(-) diff --git a/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.h b/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.h index 970dbf641..4f96141f6 100644 --- a/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.h +++ b/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.h @@ -128,7 +128,7 @@ typedef int Kilobytes; - (instancetype)initWithAmstradCPCModel:(CSMachineCPCModel)model; - (instancetype)initWithAppleIIModel:(CSMachineAppleIIModel)model diskController:(CSMachineAppleIIDiskController)diskController; - (instancetype)initWithAppleIIgsModel:(CSMachineAppleIIgsModel)model memorySize:(Kilobytes)memorySize; -- (instancetype)initWithAtariSTModel:(CSMachineAtariSTModel)model; +- (instancetype)initWithAtariSTModel:(CSMachineAtariSTModel)model memorySize:(Kilobytes)memorySize; - (instancetype)initWithElectronDFS:(BOOL)dfs adfs:(BOOL)adfs ap6:(BOOL)ap6 sidewaysRAM:(BOOL)sidewaysRAM; - (instancetype)initWithEnterpriseModel:(CSMachineEnterpriseModel)model speed:(CSMachineEnterpriseSpeed)speed exosVersion:(CSMachineEnterpriseEXOS)exosVersion basicVersion:(CSMachineEnterpriseBASIC)basicVersion dos:(CSMachineEnterpriseDOS)dos; - (instancetype)initWithMacintoshModel:(CSMachineMacintoshModel)model; diff --git a/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.mm b/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.mm index 5da15a508..964dd8612 100644 --- a/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.mm +++ b/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.mm @@ -135,11 +135,16 @@ } -- (instancetype)initWithAtariSTModel:(CSMachineAtariSTModel)model { +- (instancetype)initWithAtariSTModel:(CSMachineAtariSTModel)model memorySize:(Kilobytes)memorySize { self = [super init]; if(self) { using Target = Analyser::Static::AtariST::Target; auto target = std::make_unique(); + switch(memorySize) { + default: target->memory_size = Target::MemorySize::FiveHundredAndTwelveKilobytes; break; + case 1024: target->memory_size = Target::MemorySize::OneMegabyte; break; + case 4096: target->memory_size = Target::MemorySize::FourMegabytes; break; + } _targets.push_back(std::move(target)); } return self; diff --git a/OSBindings/Mac/Clock Signal/MachinePicker/Base.lproj/MachinePicker.xib b/OSBindings/Mac/Clock Signal/MachinePicker/Base.lproj/MachinePicker.xib index 51d26aa1c..a1a5ebc4e 100644 --- a/OSBindings/Mac/Clock Signal/MachinePicker/Base.lproj/MachinePicker.xib +++ b/OSBindings/Mac/Clock Signal/MachinePicker/Base.lproj/MachinePicker.xib @@ -1,8 +1,8 @@ - + - + @@ -300,22 +300,39 @@ Gw - + - - - - + + + + - + + + + + + + + + + + + + + + - - - + + + + + + @@ -959,6 +976,7 @@ Gw + diff --git a/OSBindings/Mac/Clock Signal/MachinePicker/MachinePicker.swift b/OSBindings/Mac/Clock Signal/MachinePicker/MachinePicker.swift index d6749071a..b70d4c3df 100644 --- a/OSBindings/Mac/Clock Signal/MachinePicker/MachinePicker.swift +++ b/OSBindings/Mac/Clock Signal/MachinePicker/MachinePicker.swift @@ -31,6 +31,9 @@ class MachinePicker: NSObject, NSTableViewDataSource, NSTableViewDelegate { @IBOutlet var appleIIgsModelButton: NSPopUpButton! @IBOutlet var appleIIgsMemorySizeButton: NSPopUpButton! + // MARK: - Atari ST properties + @IBOutlet var atariSTMemorySizeButton: NSPopUpButton! + // MARK: - CPC properties @IBOutlet var cpcModelTypeButton: NSPopUpButton! @@ -108,6 +111,9 @@ class MachinePicker: NSObject, NSTableViewDataSource, NSTableViewDelegate { appleIIgsModelButton.selectItem(withTag: standardUserDefaults.integer(forKey: "new.appleIIgsModel")) appleIIgsMemorySizeButton.selectItem(withTag: standardUserDefaults.integer(forKey: "new.appleIIgsMemorySize")) + // Atari ST settings + atariSTMemorySizeButton.selectItem(withTag: standardUserDefaults.integer(forKey: "new.atariSTMemorySize")) + // CPC settings cpcModelTypeButton.selectItem(withTag: standardUserDefaults.integer(forKey: "new.cpcModel")) @@ -169,6 +175,9 @@ class MachinePicker: NSObject, NSTableViewDataSource, NSTableViewDelegate { standardUserDefaults.set(appleIIgsModelButton.selectedTag(), forKey: "new.appleIIgsModel") standardUserDefaults.set(appleIIgsMemorySizeButton.selectedTag(), forKey: "new.appleIIgsMemorySize") + // Atari ST settings + standardUserDefaults.set(atariSTMemorySizeButton.selectedTag(), forKey: "new.atariSTMemorySize") + // CPC settings standardUserDefaults.set(cpcModelTypeButton.selectedTag(), forKey: "new.cpcModel") @@ -275,7 +284,8 @@ class MachinePicker: NSObject, NSTableViewDataSource, NSTableViewDelegate { return CSStaticAnalyser(appleIIgsModel: model, memorySize: memorySize) case "atarist": - return CSStaticAnalyser(atariSTModel: .model512k) + let memorySize = Kilobytes(atariSTMemorySizeButton.selectedTag()) + return CSStaticAnalyser(atariSTModel: .model512k, memorySize: memorySize) case "cpc": switch cpcModelTypeButton.selectedTag() {