From 4a66dd9e823559efc2ca28c83ed66795002c4fb1 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 27 Aug 2017 16:42:16 -0400 Subject: [PATCH] Arranges for the ZX80/81 to get a peek at target configuration prior to construction. I'm as yet undecided on whether to make this the norm. --- Machines/ZX8081/ZX8081.cpp | 4 ++-- Machines/ZX8081/ZX8081.hpp | 2 +- .../Mac/Clock Signal.xcodeproj/project.pbxproj | 2 ++ .../Machine/StaticAnalyser/CSStaticAnalyser.mm | 4 ++-- .../Machine/Wrappers/CSZX8081+Instantiation.h | 16 ++++++++++++++++ .../Mac/Clock Signal/Machine/Wrappers/CSZX8081.h | 2 -- .../Clock Signal/Machine/Wrappers/CSZX8081.mm | 4 ++-- 7 files changed, 25 insertions(+), 9 deletions(-) create mode 100644 OSBindings/Mac/Clock Signal/Machine/Wrappers/CSZX8081+Instantiation.h diff --git a/Machines/ZX8081/ZX8081.cpp b/Machines/ZX8081/ZX8081.cpp index 2737d3cf9..7bafe8185 100644 --- a/Machines/ZX8081/ZX8081.cpp +++ b/Machines/ZX8081/ZX8081.cpp @@ -388,8 +388,8 @@ class ConcreteMachine: using namespace ZX8081; -// See header; constructs and returns an instance of the ZX80/81. -Machine *Machine::ZX8081() { +// See header; constructs and returns an instance of the ZX80 or 81. +Machine *Machine::ZX8081(const StaticAnalyser::Target &target_hint) { return new ZX8081::ConcreteMachine; } diff --git a/Machines/ZX8081/ZX8081.hpp b/Machines/ZX8081/ZX8081.hpp index 7efbbe3fd..22025fcd2 100644 --- a/Machines/ZX8081/ZX8081.hpp +++ b/Machines/ZX8081/ZX8081.hpp @@ -38,7 +38,7 @@ class Machine: public ConfigurationTarget::Machine, public KeyboardMachine::Machine { public: - static Machine *ZX8081(); + static Machine *ZX8081(const StaticAnalyser::Target &target_hint); virtual ~Machine(); virtual void set_rom(ROMType type, std::vector data) = 0; diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index 40a7e30bb..13a55c0e9 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -1061,6 +1061,7 @@ 4BF1354A1D6D2C300054B2EA /* StaticAnalyser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StaticAnalyser.cpp; path = ../../StaticAnalyser/StaticAnalyser.cpp; sourceTree = ""; }; 4BF1354B1D6D2C300054B2EA /* StaticAnalyser.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = StaticAnalyser.hpp; path = ../../StaticAnalyser/StaticAnalyser.hpp; sourceTree = ""; }; 4BF4A2D91F534DB300B171F4 /* TargetPlatforms.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = TargetPlatforms.hpp; sourceTree = ""; }; + 4BF4A2DA1F5365C600B171F4 /* CSZX8081+Instantiation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CSZX8081+Instantiation.h"; sourceTree = ""; }; 4BF6606A1F281573002CB053 /* ClockReceiver.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = ClockReceiver.hpp; sourceTree = ""; }; 4BF8295B1D8F048B001BAE39 /* MFM.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MFM.cpp; path = Encodings/MFM.cpp; sourceTree = ""; }; 4BF8295C1D8F048B001BAE39 /* MFM.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = MFM.hpp; path = Encodings/MFM.hpp; sourceTree = ""; }; @@ -1238,6 +1239,7 @@ 4BCF1FA61DADC5250039D2E7 /* CSOric.h */, 4B2A539D1D117D36003C6002 /* CSVic20.h */, 4B14978D1EE4B4D200CE2596 /* CSZX8081.h */, + 4BF4A2DA1F5365C600B171F4 /* CSZX8081+Instantiation.h */, 4B38F34B1F2EC3CA00D9235D /* CSAmstradCPC.mm */, 4B2A539A1D117D36003C6002 /* CSAtari2600.mm */, 4B2A539C1D117D36003C6002 /* CSElectron.mm */, diff --git a/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.mm b/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.mm index 3ed7a118e..cea749cba 100644 --- a/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.mm +++ b/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.mm @@ -19,7 +19,7 @@ #import "CSElectron.h" #import "CSOric.h" #import "CSVic20.h" -#import "CSZX8081.h" +#import "CSZX8081+Instantiation.h" #import "Clock_Signal-Swift.h" @@ -59,7 +59,7 @@ case StaticAnalyser::Target::Electron: return [[CSElectron alloc] init]; case StaticAnalyser::Target::Oric: return [[CSOric alloc] init]; case StaticAnalyser::Target::Vic20: return [[CSVic20 alloc] init]; - case StaticAnalyser::Target::ZX8081: return [[CSZX8081 alloc] init]; + case StaticAnalyser::Target::ZX8081: return [[CSZX8081 alloc] initWithIntendedTarget:_target]; default: return nil; } } diff --git a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSZX8081+Instantiation.h b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSZX8081+Instantiation.h new file mode 100644 index 000000000..42930215a --- /dev/null +++ b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSZX8081+Instantiation.h @@ -0,0 +1,16 @@ +// +// CSZX8081+Instantiation.h +// Clock Signal +// +// Created by Thomas Harte on 27/08/2017. +// Copyright © 2017 Thomas Harte. All rights reserved. +// + +#include "StaticAnalyser.hpp" +#import "CSZX8081.h" + +@interface CSZX8081 (Instantiation) + +- (instancetype)initWithIntendedTarget:(const StaticAnalyser::Target &)target; + +@end diff --git a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSZX8081.h b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSZX8081.h index 9b0bc7758..3478e8c18 100644 --- a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSZX8081.h +++ b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSZX8081.h @@ -12,8 +12,6 @@ @interface CSZX8081 : CSMachine -- (instancetype)init; - @property (nonatomic, assign) BOOL useFastLoadingHack; @property (nonatomic, assign) BOOL useAutomaticTapeMotorControl; diff --git a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSZX8081.mm b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSZX8081.mm index 4f897cbce..2315d69d2 100644 --- a/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSZX8081.mm +++ b/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSZX8081.mm @@ -18,8 +18,8 @@ std::unique_ptr _zx8081; } -- (instancetype)init { - ZX8081::Machine *machine = ZX8081::Machine::ZX8081(); +- (instancetype)initWithIntendedTarget:(const StaticAnalyser::Target &)target { + ZX8081::Machine *machine = ZX8081::Machine::ZX8081(target); self = [super initWithMachine:machine]; if(self) {