diff --git a/Analyser/Machines.hpp b/Analyser/Machines.hpp index fde24ec46..796c376de 100644 --- a/Analyser/Machines.hpp +++ b/Analyser/Machines.hpp @@ -17,6 +17,7 @@ enum class Machine { Atari2600, ColecoVision, Electron, + Macintosh, MasterSystem, MSX, Oric, diff --git a/Machines/Apple/Macintosh/Macintosh.cpp b/Machines/Apple/Macintosh/Macintosh.cpp new file mode 100644 index 000000000..22972e929 --- /dev/null +++ b/Machines/Apple/Macintosh/Macintosh.cpp @@ -0,0 +1,48 @@ +// +// Macintosh.cpp +// Clock Signal +// +// Created by Thomas Harte on 03/05/2019. +// Copyright © 2019 Thomas Harte. All rights reserved. +// + +#include "Macintosh.hpp" + +#include "../../../Processors/68000/68000.hpp" +#include "../../../Components/6522/6522.hpp" + +namespace Apple { +namespace Macintosh { + +class ConcreteMachine: + public Machine, + public CPU::MC68000::BusHandler { + public: + ConcreteMachine(const ROMMachine::ROMFetcher &rom_fetcher) : + mc68000_(*this) { + + const auto roms = rom_fetcher("Macintosh", { "mac128k.rom" }); + if(!roms[0]) { + throw ROMMachine::Error::MissingROMs; + } + + roms[0]->resize(64*1024); + memcpy(rom_, roms[0]->data(), roms[0]->size()); + } + + private: + CPU::MC68000::Processor mc68000_; + uint8_t rom_[64*1024]; + uint8_t ram_[128*1024]; +}; + +} +} + +using namespace Apple::Macintosh; + +Machine *Machine::Macintosh(const Analyser::Static::Target *target, const ROMMachine::ROMFetcher &rom_fetcher) { + return new ConcreteMachine(rom_fetcher); +} + +Machine::~Machine() {} diff --git a/Machines/Apple/Macintosh/Macintosh.hpp b/Machines/Apple/Macintosh/Macintosh.hpp new file mode 100644 index 000000000..e39462f01 --- /dev/null +++ b/Machines/Apple/Macintosh/Macintosh.hpp @@ -0,0 +1,30 @@ +// +// Macintosh.hpp +// Clock Signal +// +// Created by Thomas Harte on 03/05/2019. +// Copyright © 2019 Thomas Harte. All rights reserved. +// + +#ifndef Macintosh_hpp +#define Macintosh_hpp + +#include "../../../Analyser/Static/StaticAnalyser.hpp" +#include "../../ROMMachine.hpp" + +namespace Apple { +namespace Macintosh { + +class Machine { + public: + virtual ~Machine(); + + /// Creates and returns a Macintosh. + static Machine *Macintosh(const Analyser::Static::Target *target, const ROMMachine::ROMFetcher &rom_fetcher); +}; + + +} +} + +#endif /* Macintosh_hpp */ diff --git a/Machines/Utility/MachineForTarget.cpp b/Machines/Utility/MachineForTarget.cpp index 22df44a9b..5cf0ad735 100644 --- a/Machines/Utility/MachineForTarget.cpp +++ b/Machines/Utility/MachineForTarget.cpp @@ -10,6 +10,7 @@ #include "../AmstradCPC/AmstradCPC.hpp" #include "../Apple/AppleII/AppleII.hpp" +#include "../Apple/Macintosh/Macintosh.hpp" #include "../Atari2600/Atari2600.hpp" #include "../ColecoVision/ColecoVision.hpp" #include "../Commodore/Vic-20/Vic20.hpp" @@ -34,6 +35,7 @@ namespace { switch(target->machine) { Bind(AmstradCPC) BindD(Apple::II, AppleII) + BindD(Apple::Macintosh, Macintosh) Bind(Atari2600) BindD(Coleco::Vision, ColecoVision) Bind(Electron) @@ -103,6 +105,7 @@ std::string Machine::ShortNameForTargetMachine(const Analyser::Machine machine) case Analyser::Machine::Atari2600: return "Atari2600"; case Analyser::Machine::ColecoVision: return "ColecoVision"; case Analyser::Machine::Electron: return "Electron"; + case Analyser::Machine::Macintosh: return "Macintosh"; case Analyser::Machine::MSX: return "MSX"; case Analyser::Machine::Oric: return "Oric"; case Analyser::Machine::Vic20: return "Vic20"; @@ -119,6 +122,7 @@ std::string Machine::LongNameForTargetMachine(Analyser::Machine machine) { case Analyser::Machine::Atari2600: return "Atari 2600"; case Analyser::Machine::ColecoVision: return "ColecoVision"; case Analyser::Machine::Electron: return "Acorn Electron"; + case Analyser::Machine::Macintosh: return "Apple Macintosh"; case Analyser::Machine::MSX: return "MSX"; case Analyser::Machine::Oric: return "Oric"; case Analyser::Machine::Vic20: return "Vic 20"; diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index cc5674bbd..f8bf87bff 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -615,6 +615,7 @@ 4BCE0051227CE8CA000CA200 /* Video.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BCE004D227CE8CA000CA200 /* Video.cpp */; }; 4BCE0052227CE8CA000CA200 /* DiskIICard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BCE004E227CE8CA000CA200 /* DiskIICard.cpp */; }; 4BCE0053227CE8CA000CA200 /* AppleII.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BCE0050227CE8CA000CA200 /* AppleII.cpp */; }; + 4BCE005A227CFFCA000CA200 /* Macintosh.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BCE0058227CFFCA000CA200 /* Macintosh.cpp */; }; 4BCF1FA41DADC3DD0039D2E7 /* Oric.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BCF1FA21DADC3DD0039D2E7 /* Oric.cpp */; }; 4BD191F42191180E0042E144 /* ScanTarget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BD191F22191180E0042E144 /* ScanTarget.cpp */; }; 4BD191F52191180E0042E144 /* ScanTarget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BD191F22191180E0042E144 /* ScanTarget.cpp */; }; @@ -1377,6 +1378,8 @@ 4BCE004E227CE8CA000CA200 /* DiskIICard.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DiskIICard.cpp; sourceTree = ""; }; 4BCE004F227CE8CA000CA200 /* Video.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Video.hpp; sourceTree = ""; }; 4BCE0050227CE8CA000CA200 /* AppleII.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AppleII.cpp; sourceTree = ""; }; + 4BCE0058227CFFCA000CA200 /* Macintosh.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Macintosh.cpp; sourceTree = ""; }; + 4BCE0059227CFFCA000CA200 /* Macintosh.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Macintosh.hpp; sourceTree = ""; }; 4BCF1FA21DADC3DD0039D2E7 /* Oric.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Oric.cpp; path = Oric/Oric.cpp; sourceTree = ""; }; 4BCF1FA31DADC3DD0039D2E7 /* Oric.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Oric.hpp; path = Oric/Oric.hpp; sourceTree = ""; }; 4BD060A51FE49D3C006E14BE /* Speaker.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Speaker.hpp; sourceTree = ""; }; @@ -3029,6 +3032,7 @@ isa = PBXGroup; children = ( 4BCE0049227CE8CA000CA200 /* AppleII */, + 4BCE0057227CFFCA000CA200 /* Macintosh */, ); path = Apple; sourceTree = ""; @@ -3047,6 +3051,15 @@ path = AppleII; sourceTree = ""; }; + 4BCE0057227CFFCA000CA200 /* Macintosh */ = { + isa = PBXGroup; + children = ( + 4BCE0058227CFFCA000CA200 /* Macintosh.cpp */, + 4BCE0059227CFFCA000CA200 /* Macintosh.hpp */, + ); + path = Macintosh; + sourceTree = ""; + }; 4BCF1FA51DADC3E10039D2E7 /* Oric */ = { isa = PBXGroup; children = ( @@ -3920,6 +3933,7 @@ 4BD424E52193B5830097291A /* Shader.cpp in Sources */, 4B0333AF2094081A0050B93D /* AppleDSK.cpp in Sources */, 4B894518201967B4007DE474 /* ConfidenceCounter.cpp in Sources */, + 4BCE005A227CFFCA000CA200 /* Macintosh.cpp in Sources */, 4B89452E201967B4007DE474 /* StaticAnalyser.cpp in Sources */, 4BD5D2682199148100DDF17D /* ScanTargetGLSLFragments.cpp in Sources */, 4B38F3481F2EC11D00D9235D /* AmstradCPC.cpp in Sources */, diff --git a/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.h b/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.h index 0316568c3..4064935ab 100644 --- a/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.h +++ b/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.h @@ -29,6 +29,10 @@ typedef NS_ENUM(NSInteger, CSMachineCPCModel) { CSMachineCPCModel6128 }; +typedef NS_ENUM(NSInteger, CSMachineMacintoshModel) { + CSMachineMacintoshModel128k +}; + typedef NS_ENUM(NSInteger, CSMachineOricModel) { CSMachineOricModelOric1, CSMachineOricModelOricAtmos, @@ -69,6 +73,7 @@ typedef int Kilobytes; - (instancetype)initWithZX80MemorySize:(Kilobytes)memorySize useZX81ROM:(BOOL)useZX81ROM; - (instancetype)initWithZX81MemorySize:(Kilobytes)memorySize; - (instancetype)initWithAppleIIModel:(CSMachineAppleIIModel)model diskController:(CSMachineAppleIIDiskController)diskController; +- (instancetype)initWithMacintoshModel:(CSMachineMacintoshModel)model; @property(nonatomic, readonly) NSString *optionsPanelNibName; @property(nonatomic, readonly) NSString *displayName; diff --git a/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.mm b/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.mm index 8dcdff8c0..062437925 100644 --- a/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.mm +++ b/OSBindings/Mac/Clock Signal/Machine/StaticAnalyser/CSStaticAnalyser.mm @@ -188,7 +188,17 @@ static Analyser::Static::ZX8081::Target::MemoryModel ZX8081MemoryModelFromSize(K _targets.push_back(std::move(target)); } return self; +} +- (instancetype)initWithMacintoshModel:(CSMachineMacintoshModel)model { + self = [super init]; + if(self) { + using Target = Analyser::Static::Target; + std::unique_ptr target(new Target); + target->machine = Analyser::Machine::Macintosh; + _targets.push_back(std::move(target)); + } + return self; } - (NSString *)optionsPanelNibName { diff --git a/OSBindings/Mac/Clock Signal/MachinePicker/Base.lproj/MachinePicker.xib b/OSBindings/Mac/Clock Signal/MachinePicker/Base.lproj/MachinePicker.xib index 458589a8d..39373b44b 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 @@ - + - + @@ -17,14 +17,14 @@ - + - +