From e6683e7f2d92a3c954078a262400c3e626d7c19f Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Thu, 17 Aug 2017 21:48:48 -0400 Subject: [PATCH] Added the base skeletal stuff of HFE support. --- .../Clock Signal.xcodeproj/project.pbxproj | 6 +++ OSBindings/Mac/Clock Signal/Info.plist | 16 ++++++ StaticAnalyser/StaticAnalyser.cpp | 5 +- Storage/Disk/Formats/HFE.cpp | 35 +++++++++++++ Storage/Disk/Formats/HFE.hpp | 52 +++++++++++++++++++ 5 files changed, 113 insertions(+), 1 deletion(-) create mode 100644 Storage/Disk/Formats/HFE.cpp create mode 100644 Storage/Disk/Formats/HFE.hpp diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index ac8083b5e..106529857 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -442,6 +442,7 @@ 4BF8295D1D8F048B001BAE39 /* MFM.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8295B1D8F048B001BAE39 /* MFM.cpp */; }; 4BF829631D8F536B001BAE39 /* SSD.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF829611D8F536B001BAE39 /* SSD.cpp */; }; 4BF829661D8F732B001BAE39 /* Disk.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF829641D8F732B001BAE39 /* Disk.cpp */; }; + 4BFB9FAE1F467D3A00960122 /* HFE.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFB9FAC1F467D3A00960122 /* HFE.cpp */; }; 4BFCA1201ECBDC1500AC40C1 /* Z80AllRAM.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFCA11D1ECBD9BD00AC40C1 /* Z80AllRAM.cpp */; }; 4BFCA1241ECBDCB400AC40C1 /* AllRAMProcessor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFCA1211ECBDCAF00AC40C1 /* AllRAMProcessor.cpp */; }; 4BFCA1271ECBE33200AC40C1 /* TestMachineZ80.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4BFCA1261ECBE33200AC40C1 /* TestMachineZ80.mm */; }; @@ -1067,6 +1068,8 @@ 4BF829641D8F732B001BAE39 /* Disk.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Disk.cpp; path = ../../StaticAnalyser/Acorn/Disk.cpp; sourceTree = ""; }; 4BF829651D8F732B001BAE39 /* Disk.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Disk.hpp; path = ../../StaticAnalyser/Acorn/Disk.hpp; sourceTree = ""; }; 4BF829681D8F7361001BAE39 /* File.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = File.hpp; path = ../../StaticAnalyser/Acorn/File.hpp; sourceTree = ""; }; + 4BFB9FAC1F467D3A00960122 /* HFE.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HFE.cpp; sourceTree = ""; }; + 4BFB9FAD1F467D3A00960122 /* HFE.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = HFE.hpp; sourceTree = ""; }; 4BFCA11D1ECBD9BD00AC40C1 /* Z80AllRAM.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Z80AllRAM.cpp; path = Z80/Z80AllRAM.cpp; sourceTree = ""; }; 4BFCA11E1ECBD9BD00AC40C1 /* Z80AllRAM.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Z80AllRAM.hpp; path = Z80/Z80AllRAM.hpp; sourceTree = ""; }; 4BFCA1211ECBDCAF00AC40C1 /* AllRAMProcessor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AllRAMProcessor.cpp; sourceTree = ""; }; @@ -1587,6 +1590,8 @@ 4BF829621D8F536B001BAE39 /* SSD.hpp */, 4B838F1D1F35FDCD0016B5E6 /* CPCDSK.cpp */, 4B838F1E1F35FDCD0016B5E6 /* CPCDSK.hpp */, + 4BFB9FAC1F467D3A00960122 /* HFE.cpp */, + 4BFB9FAD1F467D3A00960122 /* HFE.hpp */, ); path = Formats; sourceTree = ""; @@ -2819,6 +2824,7 @@ 4B2A539F1D117D36003C6002 /* CSAudioQueue.m in Sources */, 4B37EE821D7345A6006A09A4 /* BinaryDump.cpp in Sources */, 4BB73EA21B587A5100552FC2 /* AppDelegate.swift in Sources */, + 4BFB9FAE1F467D3A00960122 /* HFE.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/OSBindings/Mac/Clock Signal/Info.plist b/OSBindings/Mac/Clock Signal/Info.plist index cd9bb6f73..ca23f90e0 100644 --- a/OSBindings/Mac/Clock Signal/Info.plist +++ b/OSBindings/Mac/Clock Signal/Info.plist @@ -245,6 +245,22 @@ NSDocumentClass $(PRODUCT_MODULE_NAME).MachineDocument + + CFBundleTypeExtensions + + hfe + + CFBundleTypeIconFile + floppy35 + CFBundleTypeName + HxC Disk Image + CFBundleTypeRole + Viewer + LSTypeIsPackage + 0 + NSDocumentClass + $(PRODUCT_MODULE_NAME).MachineDocument + CFBundleExecutable $(EXECUTABLE_NAME) diff --git a/StaticAnalyser/StaticAnalyser.cpp b/StaticAnalyser/StaticAnalyser.cpp index 1d20722e7..2c60792ee 100644 --- a/StaticAnalyser/StaticAnalyser.cpp +++ b/StaticAnalyser/StaticAnalyser.cpp @@ -27,6 +27,7 @@ #include "../Storage/Disk/Formats/CPCDSK.hpp" #include "../Storage/Disk/Formats/D64.hpp" #include "../Storage/Disk/Formats/G64.hpp" +#include "../Storage/Disk/Formats/HFE.hpp" #include "../Storage/Disk/Formats/OricMFMDSK.hpp" #include "../Storage/Disk/Formats/SSD.hpp" @@ -48,7 +49,8 @@ enum class TargetPlatform: TargetPlatformType { Oric = 1 << 4, ZX8081 = 1 << 5, - AllTape = Acorn | Commodore | Oric | ZX8081 | AmstradCPC, + AllTape = Acorn | AmstradCPC | Commodore | Oric | ZX8081, + AllDisk = Acorn | AmstradCPC | Commodore | Oric, }; using namespace StaticAnalyser; @@ -95,6 +97,7 @@ static Media GetMediaAndPlatforms(const char *file_name, TargetPlatformType &pot Format("dsk", result.disks, Disk::CPCDSK, TargetPlatform::AmstradCPC) // DSK (Amstrad CPC) Format("dsk", result.disks, Disk::OricMFMDSK, TargetPlatform::Oric) // DSK (Oric) Format("g64", result.disks, Disk::G64, TargetPlatform::Commodore) // G64 + Format("hfe", result.disks, Disk::HFE, TargetPlatform::AmstradCPC) // HFE (TODO: plus other target platforms) Format("o", result.tapes, Tape::ZX80O81P, TargetPlatform::ZX8081) // O Format("p", result.tapes, Tape::ZX80O81P, TargetPlatform::ZX8081) // P Format("p81", result.tapes, Tape::ZX80O81P, TargetPlatform::ZX8081) // P81 diff --git a/Storage/Disk/Formats/HFE.cpp b/Storage/Disk/Formats/HFE.cpp new file mode 100644 index 000000000..00c837669 --- /dev/null +++ b/Storage/Disk/Formats/HFE.cpp @@ -0,0 +1,35 @@ +// +// HFE.cpp +// Clock Signal +// +// Created by Thomas Harte on 17/08/2017. +// Copyright © 2017 Thomas Harte. All rights reserved. +// + +#include "HFE.hpp" + +using namespace Storage::Disk; + +HFE::HFE(const char *file_name) : + Storage::FileHolder(file_name) { + throw ErrorNotHFE; +} + +HFE::~HFE() { +} + +unsigned int HFE::get_head_position_count() { + return track_count_; +} + +unsigned int HFE::get_head_count() { + return head_count_; +} + +bool HFE::get_is_read_only() { + return true; +} + +std::shared_ptr HFE::get_uncached_track_at_position(unsigned int head, unsigned int position) { + return nullptr; +} diff --git a/Storage/Disk/Formats/HFE.hpp b/Storage/Disk/Formats/HFE.hpp new file mode 100644 index 000000000..6dc2d4888 --- /dev/null +++ b/Storage/Disk/Formats/HFE.hpp @@ -0,0 +1,52 @@ +// +// HFE.hpp +// Clock Signal +// +// Created by Thomas Harte on 17/08/2017. +// Copyright © 2017 Thomas Harte. All rights reserved. +// + +#ifndef HFE_hpp +#define HFE_hpp + +#include "../Disk.hpp" +#include "../../FileHolder.hpp" + +namespace Storage { +namespace Disk { + +/*! + Provies a @c Disk containing an HFE disk image — a bit stream representation of a floppy. +*/ +class HFE: public Disk, public Storage::FileHolder { + public: + /*! + Construct an @c SSD containing content from the file with name @c file_name. + + @throws ErrorCantOpen if this file can't be opened. + @throws ErrorNotSSD if the file doesn't appear to contain a .SSD format image. + */ + HFE(const char *file_name); + ~HFE(); + + enum { + ErrorNotHFE, + }; + + // implemented to satisfy @c Disk + unsigned int get_head_position_count(); + unsigned int get_head_count(); + bool get_is_read_only(); + + private: + std::shared_ptr get_uncached_track_at_position(unsigned int head, unsigned int position); + + unsigned int head_count_; + unsigned int track_count_; +}; + +} +} + + +#endif /* HFE_hpp */