From ebe1d532205951f3e5a1ed246b5432a922fe5608 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Fri, 1 Dec 2023 22:44:13 -0500 Subject: [PATCH] Expand range of recognised formats. --- Storage/Disk/DiskImage/Formats/PCBooter.cpp | 21 +++++++++++++++++---- Storage/Disk/DiskImage/Formats/PCBooter.hpp | 1 + 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Storage/Disk/DiskImage/Formats/PCBooter.cpp b/Storage/Disk/DiskImage/Formats/PCBooter.cpp index 167755cf1..617ec16c8 100644 --- a/Storage/Disk/DiskImage/Formats/PCBooter.cpp +++ b/Storage/Disk/DiskImage/Formats/PCBooter.cpp @@ -22,15 +22,28 @@ PCBooter::PCBooter(const std::string &file_name) : switch(file_size) { default: throw Error::InvalidFormat; - // Check for a single-sided, single-density 40-track image. + case 512 * 8 * 40: + head_count_ = 1; + track_count_ = 40; + sector_count_ = 8; + break; + case 512 * 9 * 40: head_count_ = 1; track_count_ = 40; - set_geometry(9, 2, 1, true); + sector_count_ = 9; + break; + + case 512 * 9 * 40 * 2: + head_count_ = 2; + track_count_ = 40; + sector_count_ = 9; break; } - // TODO: check that an appropriate INT or similar is here? + set_geometry(sector_count_, 2, 1, true); + + // TODO: check that an appropriate INT or similar is in the boot sector? // Should probably factor out the "does this look like a PC boot sector?" test, // as it can also be used to disambiguate FAT12 disks. } @@ -44,5 +57,5 @@ int PCBooter::get_head_count() { } long PCBooter::get_file_offset_for_position(Track::Address address) { - return (address.position.as_int() * head_count_ + address.head) * 512 * 9; + return (address.position.as_int() * head_count_ + address.head) * 512 * sector_count_; } diff --git a/Storage/Disk/DiskImage/Formats/PCBooter.hpp b/Storage/Disk/DiskImage/Formats/PCBooter.hpp index cefdc730c..1ca5a0e9c 100644 --- a/Storage/Disk/DiskImage/Formats/PCBooter.hpp +++ b/Storage/Disk/DiskImage/Formats/PCBooter.hpp @@ -30,6 +30,7 @@ class PCBooter: public MFMSectorDump { int head_count_; int track_count_; + int sector_count_; }; }