1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-23 20:29:42 +00:00

Introduces filetype wiring for DO and PO files.

Also corrects sector numbering logic to ensure there is a sector 15.
This commit is contained in:
Thomas Harte 2018-04-29 16:34:10 -04:00
parent 5cd15147eb
commit a9d4fe0b41
3 changed files with 18 additions and 2 deletions

View File

@ -94,6 +94,7 @@ static Media GetMediaAndPlatforms(const std::string &file_name, TargetPlatform::
Format("csw", result.tapes, Tape::CSW, TargetPlatform::AllTape) // CSW
Format("d64", result.disks, Disk::DiskImageHolder<Storage::Disk::D64>, TargetPlatform::Commodore) // D64
Format("dmk", result.disks, Disk::DiskImageHolder<Storage::Disk::DMK>, TargetPlatform::MSX) // DMK
Format("do", result.disks, Disk::DiskImageHolder<Storage::Disk::AppleDSK>, TargetPlatform::AppleII) // DO
Format("dsd", result.disks, Disk::DiskImageHolder<Storage::Disk::SSD>, TargetPlatform::Acorn) // DSD
Format("dsk", result.disks, Disk::DiskImageHolder<Storage::Disk::CPCDSK>, TargetPlatform::AmstradCPC) // DSK (Amstrad CPC)
Format("dsk", result.disks, Disk::DiskImageHolder<Storage::Disk::AppleDSK>, TargetPlatform::AppleII) // DSK (Apple)
@ -108,6 +109,7 @@ static Media GetMediaAndPlatforms(const std::string &file_name, TargetPlatform::
Format("nib", result.disks, Disk::DiskImageHolder<Storage::Disk::NIB>, TargetPlatform::AppleII) // NIB
Format("o", result.tapes, Tape::ZX80O81P, TargetPlatform::ZX8081) // O
Format("p", result.tapes, Tape::ZX80O81P, TargetPlatform::ZX8081) // P
Format("po", result.disks, Disk::DiskImageHolder<Storage::Disk::AppleDSK>, TargetPlatform::AppleII) // PO
Format("p81", result.tapes, Tape::ZX80O81P, TargetPlatform::ZX8081) // P81
// PRG

View File

@ -398,6 +398,8 @@
<array>
<string>nib</string>
<string>woz</string>
<string>do</string>
<string>po</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>floppy525</string>
@ -408,7 +410,6 @@
<key>LSItemContentTypes</key>
<array>
<string>public.item</string>
<string>nl.xs4all.gp.virtualii.nibdisk</string>
</array>
<key>LSTypeIsPackage</key>
<integer>0</integer>

View File

@ -24,6 +24,18 @@ AppleDSK::AppleDSK(const std::string &file_name) :
sectors_per_track_ = static_cast<int>(file_.stats().st_size / (number_of_tracks*bytes_per_sector));
if(sectors_per_track_ != 13 && sectors_per_track_ != 16) throw Error::InvalidFormat;
// Check whether this is a Pro DOS disk by inspecting the filename.
if(sectors_per_track_ == 16) {
size_t string_index = file_name.size()-1;
while(file_name[string_index] != '.') {
if(file_name[string_index] == 'p') {
is_prodos_ = true;
break;
}
--string_index;
}
}
}
int AppleDSK::get_head_position_count() {
@ -51,7 +63,8 @@ std::shared_ptr<Track> AppleDSK::get_track_at_position(Track::Address address) {
// DOS and Pro DOS interleave sectors on disk, and they're represented in a disk
// image in physical order rather than logical. So that skew needs to be applied here.
sector_number_ = (sector_number_ + (is_prodos_ ? 8 : 7)) % 15;
sector_number_ += is_prodos_ ? 8 : 7;
if(sector_number_ > 0xf) sector_number_ %= 15;
}
// Pad if necessary.