From b447f5f17426ff3f0dc87512febd46e313f86f45 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Wed, 17 Mar 2021 12:38:37 -0400 Subject: [PATCH] Starts adding the Spectrum to the static analyser. --- Analyser/Static/StaticAnalyser.cpp | 48 ++++++++++--------- Analyser/Static/ZXSpectrum/StaticAnalyser.cpp | 13 +++++ Analyser/Static/ZXSpectrum/StaticAnalyser.hpp | 26 ++++++++++ .../Clock Signal.xcodeproj/project.pbxproj | 16 +++++++ Storage/TargetPlatforms.hpp | 7 +-- 5 files changed, 84 insertions(+), 26 deletions(-) create mode 100644 Analyser/Static/ZXSpectrum/StaticAnalyser.cpp create mode 100644 Analyser/Static/ZXSpectrum/StaticAnalyser.hpp diff --git a/Analyser/Static/StaticAnalyser.cpp b/Analyser/Static/StaticAnalyser.cpp index 2b3cf18af..b81b4a9df 100644 --- a/Analyser/Static/StaticAnalyser.cpp +++ b/Analyser/Static/StaticAnalyser.cpp @@ -28,6 +28,7 @@ #include "Oric/StaticAnalyser.hpp" #include "Sega/StaticAnalyser.hpp" #include "ZX8081/StaticAnalyser.hpp" +#include "ZXSpectrum/StaticAnalyser.hpp" // Cartridges #include "../../Storage/Cartridge/Formats/BinaryDump.hpp" @@ -116,7 +117,7 @@ static Media GetMediaAndPlatforms(const std::string &file_name, TargetPlatform:: Format("bin", result.cartridges, Cartridge::BinaryDump, TargetPlatform::AllCartridge) // BIN (cartridge dump) Format("cas", result.tapes, Tape::CAS, TargetPlatform::MSX) // CAS Format("cdt", result.tapes, Tape::TZX, TargetPlatform::AmstradCPC) // CDT - Format("col", result.cartridges, Cartridge::BinaryDump, TargetPlatform::ColecoVision) // COL + Format("col", result.cartridges, Cartridge::BinaryDump, TargetPlatform::Coleco) // COL Format("csw", result.tapes, Tape::CSW, TargetPlatform::AllTape) // CSW Format("d64", result.disks, Disk::DiskImageHolder, TargetPlatform::Commodore) // D64 Format("dat", result.mass_storage_devices, MassStorage::DAT, TargetPlatform::Acorn) // DAT @@ -168,7 +169,7 @@ static Media GetMediaAndPlatforms(const std::string &file_name, TargetPlatform:: Format( "rom", result.cartridges, Cartridge::BinaryDump, - TargetPlatform::AcornElectron | TargetPlatform::ColecoVision | TargetPlatform::MSX) // ROM + TargetPlatform::AcornElectron | TargetPlatform::Coleco | TargetPlatform::MSX) // ROM Format("sg", result.cartridges, Cartridge::BinaryDump, TargetPlatform::Sega) // SG Format("sms", result.cartridges, Cartridge::BinaryDump, TargetPlatform::Sega) // SMS Format("ssd", result.disks, Disk::DiskImageHolder, TargetPlatform::Acorn) // SSD @@ -177,7 +178,7 @@ static Media GetMediaAndPlatforms(const std::string &file_name, TargetPlatform:: Format("tap", result.tapes, Tape::CommodoreTAP, TargetPlatform::Commodore) // TAP (Commodore) Format("tap", result.tapes, Tape::OricTAP, TargetPlatform::Oric) // TAP (Oric) Format("tsx", result.tapes, Tape::TZX, TargetPlatform::MSX) // TSX - Format("tzx", result.tapes, Tape::TZX, TargetPlatform::ZX8081) // TZX + Format("tzx", result.tapes, Tape::TZX, TargetPlatform::ZX8081 | TargetPlatform::ZXSpectrum) // TZX Format("uef", result.tapes, Tape::UEF, TargetPlatform::Acorn) // UEF (tape) Format("woz", result.disks, Disk::DiskImageHolder, TargetPlatform::DiskII) // WOZ @@ -204,27 +205,28 @@ TargetList Analyser::Static::GetTargets(const std::string &file_name) { // Hand off to platform-specific determination of whether these things are actually compatible and, // if so, how to load them. - #define Append(x) {\ - auto new_targets = x::GetTargets(media, file_name, potential_platforms);\ - std::move(new_targets.begin(), new_targets.end(), std::back_inserter(targets));\ - } - if(potential_platforms & TargetPlatform::Acorn) Append(Acorn); - if(potential_platforms & TargetPlatform::AmstradCPC) Append(AmstradCPC); - if(potential_platforms & TargetPlatform::AppleII) Append(AppleII); - if(potential_platforms & TargetPlatform::AppleIIgs) Append(AppleIIgs); - if(potential_platforms & TargetPlatform::Atari2600) Append(Atari2600); - if(potential_platforms & TargetPlatform::AtariST) Append(AtariST); - if(potential_platforms & TargetPlatform::ColecoVision) Append(Coleco); - if(potential_platforms & TargetPlatform::Commodore) Append(Commodore); - if(potential_platforms & TargetPlatform::DiskII) Append(DiskII); - if(potential_platforms & TargetPlatform::Macintosh) Append(Macintosh); - if(potential_platforms & TargetPlatform::MSX) Append(MSX); - if(potential_platforms & TargetPlatform::Oric) Append(Oric); - if(potential_platforms & TargetPlatform::Sega) Append(Sega); - if(potential_platforms & TargetPlatform::ZX8081) Append(ZX8081); - #undef Append +#define Append(x) if(potential_platforms & TargetPlatform::x) {\ + auto new_targets = x::GetTargets(media, file_name, potential_platforms);\ + std::move(new_targets.begin(), new_targets.end(), std::back_inserter(targets));\ +} + Append(Acorn); + Append(AmstradCPC); + Append(AppleII); + Append(AppleIIgs); + Append(Atari2600); + Append(AtariST); + Append(Coleco); + Append(Commodore); + Append(DiskII); + Append(Macintosh); + Append(MSX); + Append(Oric); + Append(Sega); + Append(ZX8081); + Append(ZXSpectrum); +#undef Append - // Reset any tapes to their initial position + // Reset any tapes to their initial position. for(const auto &target : targets) { for(auto &tape : target->media.tapes) { tape->reset(); diff --git a/Analyser/Static/ZXSpectrum/StaticAnalyser.cpp b/Analyser/Static/ZXSpectrum/StaticAnalyser.cpp new file mode 100644 index 000000000..bd9c0acf8 --- /dev/null +++ b/Analyser/Static/ZXSpectrum/StaticAnalyser.cpp @@ -0,0 +1,13 @@ +// +// StaticAnalyser.cpp +// Clock Signal +// +// Created by Thomas Harte on 17/03/2021. +// Copyright © 2021 Thomas Harte. All rights reserved. +// + +#include "StaticAnalyser.hpp" + +Analyser::Static::TargetList Analyser::Static::ZXSpectrum::GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms) { + return {}; +} diff --git a/Analyser/Static/ZXSpectrum/StaticAnalyser.hpp b/Analyser/Static/ZXSpectrum/StaticAnalyser.hpp new file mode 100644 index 000000000..756c28ad0 --- /dev/null +++ b/Analyser/Static/ZXSpectrum/StaticAnalyser.hpp @@ -0,0 +1,26 @@ +// +// StaticAnalyser.hpp +// Clock Signal +// +// Created by Thomas Harte on 17/03/2021. +// Copyright © 2021 Thomas Harte. All rights reserved. +// + +#ifndef Analyser_Static_ZXSpectrum_StaticAnalyser_hpp +#define Analyser_Static_ZXSpectrum_StaticAnalyser_hpp + +#include "../StaticAnalyser.hpp" +#include "../../../Storage/TargetPlatforms.hpp" +#include + +namespace Analyser { +namespace Static { +namespace ZXSpectrum { + +TargetList GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms); + +} +} +} + +#endif /* StaticAnalyser_hpp */ diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index 03d6f0e1b..0d4925e16 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -125,6 +125,8 @@ 4B0E04FA1FC9FA3100F43484 /* 9918.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B0E04F91FC9FA3100F43484 /* 9918.cpp */; }; 4B0E04FB1FC9FA3100F43484 /* 9918.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B0E04F91FC9FA3100F43484 /* 9918.cpp */; }; 4B0E61071FF34737002A9DBD /* MSX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B0E61051FF34737002A9DBD /* MSX.cpp */; }; + 4B0F1BB22602645900B85C66 /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B0F1BB02602645900B85C66 /* StaticAnalyser.cpp */; }; + 4B0F1BB32602645900B85C66 /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B0F1BB02602645900B85C66 /* StaticAnalyser.cpp */; }; 4B0F94FE208C1A1600FE41D9 /* NIB.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B0F94FC208C1A1600FE41D9 /* NIB.cpp */; }; 4B0F94FF208C1A1600FE41D9 /* NIB.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B0F94FC208C1A1600FE41D9 /* NIB.cpp */; }; 4B121F9B1E06293F00BFDA12 /* PCMSegmentEventSourceTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B121F9A1E06293F00BFDA12 /* PCMSegmentEventSourceTests.mm */; }; @@ -1053,6 +1055,8 @@ 4B0E04F91FC9FA3100F43484 /* 9918.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = 9918.cpp; path = 9918/9918.cpp; sourceTree = ""; }; 4B0E61051FF34737002A9DBD /* MSX.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = MSX.cpp; path = Parsers/MSX.cpp; sourceTree = ""; }; 4B0E61061FF34737002A9DBD /* MSX.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = MSX.hpp; path = Parsers/MSX.hpp; sourceTree = ""; }; + 4B0F1BB02602645900B85C66 /* StaticAnalyser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StaticAnalyser.cpp; sourceTree = ""; }; + 4B0F1BB12602645900B85C66 /* StaticAnalyser.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = StaticAnalyser.hpp; sourceTree = ""; }; 4B0F94FC208C1A1600FE41D9 /* NIB.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = NIB.cpp; sourceTree = ""; }; 4B0F94FD208C1A1600FE41D9 /* NIB.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = NIB.hpp; sourceTree = ""; }; 4B0F9500208C42A300FE41D9 /* Target.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = Target.hpp; path = AppleII/Target.hpp; sourceTree = ""; }; @@ -2150,6 +2154,15 @@ name = 9918; sourceTree = ""; }; + 4B0F1BAF2602645900B85C66 /* ZXSpectrum */ = { + isa = PBXGroup; + children = ( + 4B0F1BB02602645900B85C66 /* StaticAnalyser.cpp */, + 4B0F1BB12602645900B85C66 /* StaticAnalyser.hpp */, + ); + path = ZXSpectrum; + sourceTree = ""; + }; 4B1414561B58879D00E04248 /* 6502 */ = { isa = PBXGroup; children = ( @@ -3089,6 +3102,7 @@ 4B8944F6201967B4007DE474 /* Oric */, 4B7F1894215486A100388727 /* Sega */, 4B894504201967B4007DE474 /* ZX8081 */, + 4B0F1BAF2602645900B85C66 /* ZXSpectrum */, ); path = Static; sourceTree = ""; @@ -5214,6 +5228,7 @@ 4B595FAE2086DFBA0083CAA8 /* AudioToggle.cpp in Sources */, 4B055AB91FAE86170060FFFF /* Acorn.cpp in Sources */, 4B302185208A550100773308 /* DiskII.cpp in Sources */, + 4B0F1BB32602645900B85C66 /* StaticAnalyser.cpp in Sources */, 4B055A931FAE85B50060FFFF /* BinaryDump.cpp in Sources */, 4B89452D201967B4007DE474 /* Tape.cpp in Sources */, 4B055AD61FAE9B130060FFFF /* MemoryFuzzer.cpp in Sources */, @@ -5400,6 +5415,7 @@ 4B7F188E2154825E00388727 /* MasterSystem.cpp in Sources */, 4B8805F41DCFD22A003085B1 /* Commodore.cpp in Sources */, 4B3FCC40201EC24200960631 /* MultiMachine.cpp in Sources */, + 4B0F1BB22602645900B85C66 /* StaticAnalyser.cpp in Sources */, 4B8805F01DCFC99C003085B1 /* Acorn.cpp in Sources */, 4B3051301D98ACC600B4FED8 /* Plus3.cpp in Sources */, 4B30512D1D989E2200B4FED8 /* Drive.cpp in Sources */, diff --git a/Storage/TargetPlatforms.hpp b/Storage/TargetPlatforms.hpp index 91654ae23..298e2f816 100644 --- a/Storage/TargetPlatforms.hpp +++ b/Storage/TargetPlatforms.hpp @@ -26,7 +26,7 @@ enum Type: IntType { BBCMaster = 1 << 7, BBCModelA = 1 << 8, BBCModelB = 1 << 9, - ColecoVision = 1 << 10, + Coleco = 1 << 10, Commodore = 1 << 11, DiskII = 1 << 12, Sega = 1 << 13, @@ -35,12 +35,13 @@ enum Type: IntType { Oric = 1 << 16, ZX80 = 1 << 17, ZX81 = 1 << 18, + ZXSpectrum = 1 << 19, Acorn = AcornAtom | AcornElectron | BBCMaster | BBCModelA | BBCModelB, ZX8081 = ZX80 | ZX81, - AllCartridge = Atari2600 | AcornElectron | ColecoVision | MSX, + AllCartridge = Atari2600 | AcornElectron | Coleco | MSX, AllDisk = Acorn | AmstradCPC | Commodore | Oric | MSX, // TODO: | AtariST - AllTape = Acorn | AmstradCPC | Commodore | Oric | ZX80 | ZX81 | MSX, + AllTape = Acorn | AmstradCPC | Commodore | Oric | ZX80 | ZX81 | MSX | ZXSpectrum, }; class TypeDistinguisher {