From 368bff1a82f90a924adf0e52bc277c1d4d7781c6 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Mon, 10 Jul 2017 21:43:58 -0400 Subject: [PATCH] Added a shell class that will one day be able to parse CSW files, plus the logic and metadata to instantiate it when a CSW presents itself. --- .../Clock Signal.xcodeproj/project.pbxproj | 20 ++++++--- OSBindings/Mac/Clock Signal/Info.plist | 24 ++++++++++ StaticAnalyser/StaticAnalyser.cpp | 4 ++ Storage/Tape/Formats/CSW.cpp | 27 +++++++++++ Storage/Tape/Formats/CSW.hpp | 45 +++++++++++++++++++ Storage/Tape/Formats/ZX80O81P.hpp | 4 +- 6 files changed, 115 insertions(+), 9 deletions(-) create mode 100644 Storage/Tape/Formats/CSW.cpp create mode 100644 Storage/Tape/Formats/CSW.hpp diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index 23cdc4e5e..cf82f9e73 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -51,6 +51,7 @@ 4B3BA0CF1D318B44005DD7A7 /* MOS6522Bridge.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B3BA0C91D318B44005DD7A7 /* MOS6522Bridge.mm */; }; 4B3BA0D01D318B44005DD7A7 /* MOS6532Bridge.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B3BA0CB1D318B44005DD7A7 /* MOS6532Bridge.mm */; }; 4B3BA0D11D318B44005DD7A7 /* TestMachine6502.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B3BA0CD1D318B44005DD7A7 /* TestMachine6502.mm */; }; + 4B3BF5B01F146265005B6C36 /* CSW.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B3BF5AE1F146264005B6C36 /* CSW.cpp */; }; 4B3F1B461E0388D200DB26EE /* PCMPatchedTrack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B3F1B441E0388D200DB26EE /* PCMPatchedTrack.cpp */; }; 4B44EBF51DC987AF00A7820C /* AllSuiteA.bin in Resources */ = {isa = PBXBuildFile; fileRef = 4B44EBF41DC987AE00A7820C /* AllSuiteA.bin */; }; 4B44EBF71DC9883B00A7820C /* 6502_functional_test.bin in Resources */ = {isa = PBXBuildFile; fileRef = 4B44EBF61DC9883B00A7820C /* 6502_functional_test.bin */; }; @@ -539,6 +540,8 @@ 4B3BA0CB1D318B44005DD7A7 /* MOS6532Bridge.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MOS6532Bridge.mm; sourceTree = ""; }; 4B3BA0CC1D318B44005DD7A7 /* TestMachine6502.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestMachine6502.h; sourceTree = ""; }; 4B3BA0CD1D318B44005DD7A7 /* TestMachine6502.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TestMachine6502.mm; sourceTree = ""; }; + 4B3BF5AE1F146264005B6C36 /* CSW.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSW.cpp; sourceTree = ""; }; + 4B3BF5AF1F146264005B6C36 /* CSW.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = CSW.hpp; sourceTree = ""; }; 4B3F1B441E0388D200DB26EE /* PCMPatchedTrack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PCMPatchedTrack.cpp; sourceTree = ""; }; 4B3F1B451E0388D200DB26EE /* PCMPatchedTrack.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = PCMPatchedTrack.hpp; sourceTree = ""; }; 4B44EBF41DC987AE00A7820C /* AllSuiteA.bin */ = {isa = PBXFileReference; lastKnownFileType = archive.macbinary; name = AllSuiteA.bin; path = AllSuiteA/AllSuiteA.bin; sourceTree = ""; }; @@ -1394,17 +1397,19 @@ 4B69FB411C4D941400B5F0AA /* Formats */ = { isa = PBXGroup; children = ( - 4B69FB451C4D950F00B5F0AA /* libz.tbd */, - 4B69FB421C4D941400B5F0AA /* TapeUEF.cpp */, - 4B69FB431C4D941400B5F0AA /* TapeUEF.hpp */, 4BC91B811D1F160E00884B76 /* CommodoreTAP.cpp */, - 4BC91B821D1F160E00884B76 /* CommodoreTAP.hpp */, - 4B2BFC5D1D613E0200BA3AA9 /* TapePRG.cpp */, - 4B2BFC5E1D613E0200BA3AA9 /* TapePRG.hpp */, + 4B3BF5AE1F146264005B6C36 /* CSW.cpp */, 4B59199A1DAC6C46005BB85C /* OricTAP.cpp */, - 4B59199B1DAC6C46005BB85C /* OricTAP.hpp */, + 4B2BFC5D1D613E0200BA3AA9 /* TapePRG.cpp */, + 4B69FB421C4D941400B5F0AA /* TapeUEF.cpp */, 4B1497861EE4A1DA00CE2596 /* ZX80O81P.cpp */, + 4BC91B821D1F160E00884B76 /* CommodoreTAP.hpp */, + 4B3BF5AF1F146264005B6C36 /* CSW.hpp */, + 4B59199B1DAC6C46005BB85C /* OricTAP.hpp */, + 4B2BFC5E1D613E0200BA3AA9 /* TapePRG.hpp */, + 4B69FB431C4D941400B5F0AA /* TapeUEF.hpp */, 4B1497871EE4A1DA00CE2596 /* ZX80O81P.hpp */, + 4B69FB451C4D950F00B5F0AA /* libz.tbd */, ); path = Formats; sourceTree = ""; @@ -2593,6 +2598,7 @@ 4BD69F941D98760000243FE1 /* AcornADF.cpp in Sources */, 4BBF99181C8FBA6F0075DAFB /* TextureTarget.cpp in Sources */, 4BC76E691C98E31700E6EF73 /* FIRFilter.cpp in Sources */, + 4B3BF5B01F146265005B6C36 /* CSW.cpp in Sources */, 4B2A332A1DB8544D002876E3 /* MemoryFuzzer.cpp in Sources */, 4B55CE5F1C3B7D960093A61B /* MachineDocument.swift in Sources */, 4B2A332F1DB86869002876E3 /* OricOptionsPanel.swift in Sources */, diff --git a/OSBindings/Mac/Clock Signal/Info.plist b/OSBindings/Mac/Clock Signal/Info.plist index 42a1aec16..4ca666175 100644 --- a/OSBindings/Mac/Clock Signal/Info.plist +++ b/OSBindings/Mac/Clock Signal/Info.plist @@ -141,6 +141,8 @@ Electron/BBC Disk Image CFBundleTypeRole Editor + LSTypeIsPackage + 0 NSDocumentClass $(PRODUCT_MODULE_NAME).MachineDocument @@ -155,6 +157,8 @@ Disk Image CFBundleTypeRole Editor + LSTypeIsPackage + 0 NSDocumentClass $(PRODUCT_MODULE_NAME).MachineDocument @@ -170,6 +174,8 @@ ZX80 Tape Image CFBundleTypeRole Viewer + LSTypeIsPackage + 0 NSDocumentClass $(PRODUCT_MODULE_NAME).MachineDocument @@ -185,6 +191,24 @@ ZX81 Tape Image CFBundleTypeRole Viewer + LSTypeIsPackage + 0 + NSDocumentClass + $(PRODUCT_MODULE_NAME).MachineDocument + + + CFBundleTypeExtensions + + csw + + CFBundleTypeIconFile + cassette + CFBundleTypeName + Tape Image + CFBundleTypeRole + Viewer + LSTypeIsPackage + 0 NSDocumentClass $(PRODUCT_MODULE_NAME).MachineDocument diff --git a/StaticAnalyser/StaticAnalyser.cpp b/StaticAnalyser/StaticAnalyser.cpp index 2b18a921c..41c1b87ce 100644 --- a/StaticAnalyser/StaticAnalyser.cpp +++ b/StaticAnalyser/StaticAnalyser.cpp @@ -30,6 +30,7 @@ // Tapes #include "../Storage/Tape/Formats/CommodoreTAP.hpp" +#include "../Storage/Tape/Formats/CSW.hpp" #include "../Storage/Tape/Formats/OricTAP.hpp" #include "../Storage/Tape/Formats/TapePRG.hpp" #include "../Storage/Tape/Formats/TapeUEF.hpp" @@ -42,6 +43,8 @@ enum class TargetPlatform: TargetPlatformType { Commodore = 1 << 2, Oric = 1 << 3, ZX8081 = 1 << 4, + + AllTape = Acorn | Commodore | Oric | ZX8081, }; using namespace StaticAnalyser; @@ -94,6 +97,7 @@ std::list StaticAnalyser::GetTargets(const char *file_name) Format("a26", cartridges, Cartridge::BinaryDump, TargetPlatform::Atari2600) // A26 Format("adf", disks, Disk::AcornADF, TargetPlatform::Acorn) // ADF Format("bin", cartridges, Cartridge::BinaryDump, TargetPlatform::Atari2600) // BIN + Format("csw", tapes, Tape::CSW, TargetPlatform::AllTape) // CSW Format("d64", disks, Disk::D64, TargetPlatform::Commodore) // D64 Format("dsd", disks, Disk::SSD, TargetPlatform::Acorn) // DSD Format("dsk", disks, Disk::OricMFMDSK, TargetPlatform::Oric) // DSK diff --git a/Storage/Tape/Formats/CSW.cpp b/Storage/Tape/Formats/CSW.cpp new file mode 100644 index 000000000..957c8a448 --- /dev/null +++ b/Storage/Tape/Formats/CSW.cpp @@ -0,0 +1,27 @@ +// +// CSW.cpp +// Clock Signal +// +// Created by Thomas Harte on 10/07/2017. +// Copyright © 2017 Thomas Harte. All rights reserved. +// + +#include "CSW.hpp" + +using namespace Storage::Tape; + +CSW::CSW(const char *file_name) : + Storage::FileHolder(file_name) { +} + +bool CSW::is_at_end() { + return true; +} + +void CSW::virtual_reset() { +} + +Tape::Pulse CSW::virtual_get_next_pulse() { + Tape::Pulse pulse; + return pulse; +} diff --git a/Storage/Tape/Formats/CSW.hpp b/Storage/Tape/Formats/CSW.hpp new file mode 100644 index 000000000..ed98b3bed --- /dev/null +++ b/Storage/Tape/Formats/CSW.hpp @@ -0,0 +1,45 @@ +// +// CSW.hpp +// Clock Signal +// +// Created by Thomas Harte on 10/07/2017. +// Copyright © 2017 Thomas Harte. All rights reserved. +// + +#ifndef CSW_hpp +#define CSW_hpp + +#include "../Tape.hpp" +#include "../../FileHolder.hpp" + +namespace Storage { +namespace Tape { + +/*! + Provides a @c Tape containing a CSW tape image, which is a compressed 1-bit sampling. +*/ +class CSW: public Tape, public Storage::FileHolder { + public: + /*! + Constructs a @c CSW containing content from the file with name @c file_name. + + @throws ErrorNotCSW if this file could not be opened and recognised as a valid CSW file. + */ + CSW(const char *file_name); + + enum { + ErrorNotCSW + }; + + // implemented to satisfy @c Tape + bool is_at_end(); + + private: + void virtual_reset(); + Pulse virtual_get_next_pulse(); +}; + +} +} + +#endif /* CSW_hpp */ diff --git a/Storage/Tape/Formats/ZX80O81P.hpp b/Storage/Tape/Formats/ZX80O81P.hpp index b2ceb5ff8..efc2a5425 100644 --- a/Storage/Tape/Formats/ZX80O81P.hpp +++ b/Storage/Tape/Formats/ZX80O81P.hpp @@ -24,9 +24,9 @@ namespace Tape { class ZX80O81P: public Tape, public Storage::FileHolder { public: /*! - Constructs an @c ZX80O containing content from the file with name @c file_name. + Constructs a @c ZX80O containing content from the file with name @c file_name. - @throws ErrorNotZX80O if this file could not be opened and recognised as a valid ZX80-format .O. + @throws ErrorNotZX80O81P if this file could not be opened and recognised as a valid ZX80-format .O. */ ZX80O81P(const char *file_name);