1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-02 05:29:32 +00:00

Expand range of recognised formats.

This commit is contained in:
Thomas Harte 2023-12-01 22:44:13 -05:00
parent bc89cb7d06
commit ebe1d53220
2 changed files with 18 additions and 4 deletions

View File

@ -22,15 +22,28 @@ PCBooter::PCBooter(const std::string &file_name) :
switch(file_size) { switch(file_size) {
default: throw Error::InvalidFormat; 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: case 512 * 9 * 40:
head_count_ = 1; head_count_ = 1;
track_count_ = 40; 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; 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, // Should probably factor out the "does this look like a PC boot sector?" test,
// as it can also be used to disambiguate FAT12 disks. // 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) { 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_;
} }

View File

@ -30,6 +30,7 @@ class PCBooter: public MFMSectorDump {
int head_count_; int head_count_;
int track_count_; int track_count_;
int sector_count_;
}; };
} }