From c7373a5d3e5a7831c04831edb39c5367646d4d10 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sat, 13 Aug 2022 10:09:34 -0400 Subject: [PATCH] Overtly treat .ST images as FAT12. --- Analyser/Static/StaticAnalyser.cpp | 3 +- .../Clock Signal.xcodeproj/project.pbxproj | 10 ----- Storage/Disk/DiskImage/Formats/FAT12.cpp | 2 +- Storage/Disk/DiskImage/Formats/ST.cpp | 42 ------------------ Storage/Disk/DiskImage/Formats/ST.hpp | 43 ------------------- 5 files changed, 2 insertions(+), 98 deletions(-) delete mode 100644 Storage/Disk/DiskImage/Formats/ST.cpp delete mode 100644 Storage/Disk/DiskImage/Formats/ST.hpp diff --git a/Analyser/Static/StaticAnalyser.cpp b/Analyser/Static/StaticAnalyser.cpp index 99668d6e1..dc59652d8 100644 --- a/Analyser/Static/StaticAnalyser.cpp +++ b/Analyser/Static/StaticAnalyser.cpp @@ -53,7 +53,6 @@ #include "../../Storage/Disk/DiskImage/Formats/NIB.hpp" #include "../../Storage/Disk/DiskImage/Formats/OricMFMDSK.hpp" #include "../../Storage/Disk/DiskImage/Formats/SSD.hpp" -#include "../../Storage/Disk/DiskImage/Formats/ST.hpp" #include "../../Storage/Disk/DiskImage/Formats/STX.hpp" #include "../../Storage/Disk/DiskImage/Formats/WOZ.hpp" @@ -199,7 +198,7 @@ static Media GetMediaAndPlatforms(const std::string &file_name, TargetPlatform:: 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 - Format("st", result.disks, Disk::DiskImageHolder, TargetPlatform::AtariST) // ST + Format("st", result.disks, Disk::DiskImageHolder, TargetPlatform::AtariST) // ST Format("stx", result.disks, Disk::DiskImageHolder, TargetPlatform::AtariST) // STX Format("tap", result.tapes, Tape::CommodoreTAP, TargetPlatform::Commodore) // TAP (Commodore) Format("tap", result.tapes, Tape::OricTAP, TargetPlatform::Oric) // TAP (Oric) diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index 4d3770d04..bc29cfaa2 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -366,7 +366,6 @@ 4B778F0223A5EBA40000D260 /* MFMSectorDump.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B58601C1F806AB200AEE2E3 /* MFMSectorDump.cpp */; }; 4B778F0323A5EBB00000D260 /* FAT12.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BEBFB4B2002C4BF000708CC /* FAT12.cpp */; }; 4B778F0423A5EBB00000D260 /* OricMFMDSK.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B4518971F75FD1B00926311 /* OricMFMDSK.cpp */; }; - 4B778F0523A5EBB00000D260 /* ST.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BE0A3EC237BB170002AB46F /* ST.cpp */; }; 4B778F0623A5EC150000D260 /* CAS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B0E04E81FC9E5DA00F43484 /* CAS.cpp */; }; 4B778F0723A5EC150000D260 /* CommodoreTAP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC91B811D1F160E00884B76 /* CommodoreTAP.cpp */; }; 4B778F0823A5EC150000D260 /* CSW.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B3BF5AE1F146264005B6C36 /* CSW.cpp */; }; @@ -1018,8 +1017,6 @@ 4BDB61EB2032806E0048AF91 /* CSAtari2600.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B2A539A1D117D36003C6002 /* CSAtari2600.mm */; }; 4BDB61EC203285AE0048AF91 /* Atari2600OptionsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B8FE21F1DA19D7C0090D3CE /* Atari2600OptionsController.swift */; }; 4BDDBA991EF3451200347E61 /* Z80MachineCycleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BDDBA981EF3451200347E61 /* Z80MachineCycleTests.swift */; }; - 4BE0A3EE237BB170002AB46F /* ST.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BE0A3EC237BB170002AB46F /* ST.cpp */; }; - 4BE0A3EF237BB170002AB46F /* ST.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BE0A3EC237BB170002AB46F /* ST.cpp */; }; 4BE211DE253E4E4800435408 /* 65C02_no_Rockwell_test.bin in Resources */ = {isa = PBXBuildFile; fileRef = 4BE211DD253E4E4800435408 /* 65C02_no_Rockwell_test.bin */; }; 4BE211FF253FC80900435408 /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BE211FE253FC80900435408 /* StaticAnalyser.cpp */; }; 4BE21200253FC80900435408 /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BE211FE253FC80900435408 /* StaticAnalyser.cpp */; }; @@ -2134,8 +2131,6 @@ 4BDCC5F81FB27A5E001220C5 /* ROMMachine.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = ROMMachine.hpp; sourceTree = ""; }; 4BDDBA981EF3451200347E61 /* Z80MachineCycleTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Z80MachineCycleTests.swift; sourceTree = ""; }; 4BE0151C286A8C8E00EA42E9 /* MemorySwitches.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = MemorySwitches.hpp; sourceTree = ""; }; - 4BE0A3EC237BB170002AB46F /* ST.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ST.cpp; sourceTree = ""; }; - 4BE0A3ED237BB170002AB46F /* ST.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = ST.hpp; sourceTree = ""; }; 4BE211DD253E4E4800435408 /* 65C02_no_Rockwell_test.bin */ = {isa = PBXFileReference; lastKnownFileType = archive.macbinary; name = 65C02_no_Rockwell_test.bin; path = "Klaus Dormann/65C02_no_Rockwell_test.bin"; sourceTree = ""; }; 4BE211FC253FC80800435408 /* StaticAnalyser.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = StaticAnalyser.hpp; sourceTree = ""; }; 4BE211FD253FC80900435408 /* Target.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Target.hpp; sourceTree = ""; }; @@ -2874,7 +2869,6 @@ 4B0F94FC208C1A1600FE41D9 /* NIB.cpp */, 4B4518971F75FD1B00926311 /* OricMFMDSK.cpp */, 4B4518991F75FD1B00926311 /* SSD.cpp */, - 4BE0A3EC237BB170002AB46F /* ST.cpp */, 4B7BA03323C58B1E00B98D9E /* STX.cpp */, 4B6ED2EE208E2F8A0047B343 /* WOZ.cpp */, 4B80CD75256CA15E00176FCC /* 2MG.hpp */, @@ -2894,7 +2888,6 @@ 4B0F94FD208C1A1600FE41D9 /* NIB.hpp */, 4B4518981F75FD1B00926311 /* OricMFMDSK.hpp */, 4B45189A1F75FD1B00926311 /* SSD.hpp */, - 4BE0A3ED237BB170002AB46F /* ST.hpp */, 4B7BA03223C58B1E00B98D9E /* STX.hpp */, 4B6ED2EF208E2F8A0047B343 /* WOZ.hpp */, 4BFDD7891F7F2DB4008579B9 /* Utility */, @@ -5660,7 +5653,6 @@ 4B8318BC22D3E588006DB630 /* DisplayMetrics.cpp in Sources */, 4BEDA40E25B2844B000C2DBD /* Decoder.cpp in Sources */, 4B1B88BD202E3D3D00B67DFF /* MultiMachine.cpp in Sources */, - 4BE0A3EF237BB170002AB46F /* ST.cpp in Sources */, 4B055A971FAE85BB0060FFFF /* ZX8081.cpp in Sources */, 4B055AAD1FAE85FD0060FFFF /* PCMTrack.cpp in Sources */, 4B2130E3273A7A0A008A77B4 /* Audio.cpp in Sources */, @@ -5862,7 +5854,6 @@ 4BD67DD0209BF27B00AB2146 /* Encoder.cpp in Sources */, 4BAE495920328897004BE78E /* ZX8081Controller.swift in Sources */, 4B89451A201967B4007DE474 /* ConfidenceSummary.cpp in Sources */, - 4BE0A3EE237BB170002AB46F /* ST.cpp in Sources */, 4B54C0C51F8D91D90050900F /* Keyboard.cpp in Sources */, 4BEE149A227FC0EA00133682 /* IWM.cpp in Sources */, 4B69FB441C4D941400B5F0AA /* TapeUEF.cpp in Sources */, @@ -6183,7 +6174,6 @@ 4BE90FFD22D5864800FB464D /* MacintoshVideoTests.mm in Sources */, 4B4F478A25367EDC004245B8 /* 65816AddressingTests.swift in Sources */, 4B778F0B23A5EC150000D260 /* TapeUEF.cpp in Sources */, - 4B778F0523A5EBB00000D260 /* ST.cpp in Sources */, 4B778F0C23A5EC150000D260 /* TZX.cpp in Sources */, 4B778F1B23A5ED380000D260 /* Video.cpp in Sources */, 4B778F4723A5F1DD0000D260 /* StaticAnalyser.cpp in Sources */, diff --git a/Storage/Disk/DiskImage/Formats/FAT12.cpp b/Storage/Disk/DiskImage/Formats/FAT12.cpp index 76c04bf10..574e61c96 100644 --- a/Storage/Disk/DiskImage/Formats/FAT12.cpp +++ b/Storage/Disk/DiskImage/Formats/FAT12.cpp @@ -53,5 +53,5 @@ int FAT12::get_head_count() { } long FAT12::get_file_offset_for_position(Track::Address address) { - return (address.position.as_int()*head_count_ + address.head) * sector_size_ * sector_count_; + return (address.position.as_int() * head_count_ + address.head) * sector_size_ * sector_count_; } diff --git a/Storage/Disk/DiskImage/Formats/ST.cpp b/Storage/Disk/DiskImage/Formats/ST.cpp deleted file mode 100644 index 7c4a05194..000000000 --- a/Storage/Disk/DiskImage/Formats/ST.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// -// ST.cpp -// Clock Signal -// -// Created by Thomas Harte on 12/11/2019. -// Copyright © 2019 Thomas Harte. All rights reserved. -// - -#include "ST.hpp" - -namespace { - constexpr int sectors_per_track = 10; - constexpr int sector_size = 2; -} - -using namespace Storage::Disk; - -ST::ST(const std::string &file_name) : MFMSectorDump(file_name) { - // Very loose validation: the file needs to be a whole number of tracks, - // and not more than 160 of them. - const auto stats = file_.stats(); - if(stats.st_size % (512*10)) throw Error::InvalidFormat; - if(stats.st_size > 512*10*160) throw Error::InvalidFormat; - - // Head count: 2 if there are more than 80 tracks. Otherwise 1. - head_count_ = (stats.st_size >= 512 * 10 * 80) ? 2 : 1; - track_count_ = std::max(80, int(stats.st_size / (512 * 10 * head_count_))); - - set_geometry(sectors_per_track, sector_size, 1, true); -} - -HeadPosition ST::get_maximum_head_position() { - return HeadPosition(track_count_); -} - -int ST::get_head_count() { - return head_count_; -} - -long ST::get_file_offset_for_position(Track::Address address) { - return (address.position.as_int() * head_count_ + address.head) * 512 * sectors_per_track; -} diff --git a/Storage/Disk/DiskImage/Formats/ST.hpp b/Storage/Disk/DiskImage/Formats/ST.hpp deleted file mode 100644 index de1218264..000000000 --- a/Storage/Disk/DiskImage/Formats/ST.hpp +++ /dev/null @@ -1,43 +0,0 @@ -// -// ST.hpp -// Clock Signal -// -// Created by Thomas Harte on 12/11/2019. -// Copyright © 2019 Thomas Harte. All rights reserved. -// - -#ifndef ST_hpp -#define ST_hpp - -#include "MFMSectorDump.hpp" - -namespace Storage { -namespace Disk { - -/*! - Provides a @c Disk containing an ST disk image: a decoded sector dump of an Atari ST disk. -*/ -class ST: public MFMSectorDump { - public: - /*! - Construct an @c ST containing content from the file with name @c file_name. - - @throws Storage::FileHolder::Error::CantOpen if this file can't be opened. - @throws Error::InvalidFormat if the file doesn't appear to contain a .ST format image. - */ - ST(const std::string &file_name); - - HeadPosition get_maximum_head_position() final; - int get_head_count() final; - - private: - long get_file_offset_for_position(Track::Address address) final; - - int head_count_; - int track_count_; -}; - -} -} - -#endif /* ST_hpp */