1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 23:52:26 +00:00

Apple's GCR header varies between the Mac and the Apple II.

This commit is contained in:
Thomas Harte 2019-06-15 16:32:56 -04:00
parent 877b46d2c1
commit a17e47fa43
3 changed files with 8 additions and 8 deletions

View File

@ -79,7 +79,7 @@ std::shared_ptr<Track> AppleDSK::get_track_at_position(Track::Address address) {
// Write the sectors.
for(uint8_t c = 0; c < 16; ++c) {
segment += Encodings::AppleGCR::header(is_prodos_ ? 0x01 : 0xfe, track, c); // Volume number is 0xfe for DOS 3.3, 0x01 for Pro-DOS.
segment += Encodings::AppleGCR::AppleII::header(is_prodos_ ? 0x01 : 0xfe, track, c); // Volume number is 0xfe for DOS 3.3, 0x01 for Pro-DOS.
segment += Encodings::AppleGCR::six_and_two_sync(7); // Gap 2: 7 sync words.
segment += Encodings::AppleGCR::AppleII::six_and_two_data(&track_data[logical_sector_for_physical_sector(c) * 256]);
segment += Encodings::AppleGCR::six_and_two_sync(20); // Gap 3: 20 sync words.

View File

@ -64,7 +64,7 @@ Storage::Disk::PCMSegment AppleGCR::five_and_three_sync(int length) {
return sync(length, 9);
}
Storage::Disk::PCMSegment AppleGCR::header(uint8_t volume, uint8_t track, uint8_t sector) {
Storage::Disk::PCMSegment AppleGCR::AppleII::header(uint8_t volume, uint8_t track, uint8_t sector) {
const uint8_t checksum = volume ^ track ^ sector;
// Apple headers are encoded using an FM-esque scheme rather than 6 and 2, or 5 and 3.

View File

@ -23,12 +23,6 @@ const uint8_t data_prologue[3] = {0xd5, 0xaa, 0xad};
/// Describes the epilogue that ends both data sections and headers.
const uint8_t epilogue[3] = {0xde, 0xaa, 0xeb};
/*!
Produces the Apple-standard four-and-four per-sector header. This is the same
for both the 13- and 16-sector formats, and is 112 bits long.
*/
Storage::Disk::PCMSegment header(uint8_t volume, uint8_t track, uint8_t sector);
namespace AppleII {
/*!
@ -38,6 +32,12 @@ namespace AppleII {
*/
Storage::Disk::PCMSegment six_and_two_data(const uint8_t *source);
/*!
Produces the Apple II-standard four-and-four per-sector header. This is the same
for both the 13- and 16-sector formats, and is 112 bits long.
*/
Storage::Disk::PCMSegment header(uint8_t volume, uint8_t track, uint8_t sector);
}
namespace Macintosh {