mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-31 11:17:01 -07:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8863bda0d0 | ||
|
|
df83b558bf | ||
|
|
30fe75f9bf |
@@ -29,6 +29,7 @@ IncludeBlocks: Preserve
|
||||
IndentCaseLabels: 'true'
|
||||
IndentWidth: '4'
|
||||
IndentWrappedFunctionNames: 'false'
|
||||
IndentPPDirectives: BeforeHash
|
||||
KeepEmptyLinesAtTheStartOfBlocks: 'true'
|
||||
NamespaceIndentation: All
|
||||
PointerAlignment: Left
|
||||
|
||||
@@ -19,4 +19,13 @@ message Apple2EncoderProto
|
||||
|
||||
optional uint32 side_one_track_offset = 3
|
||||
[ default = 0, (help) = "offset to apply to track numbers on side 1" ];
|
||||
|
||||
optional uint32 post_index_gap_bytes = 4
|
||||
[ default = 32, (help) = "the number of resync bytes to write after the index mark" ];
|
||||
|
||||
optional uint32 post_address_gap_bytes = 5
|
||||
[ default = 6, (help) = "the number of resync bytes to write after the address gap" ];
|
||||
|
||||
optional uint32 post_data_gap_bytes = 6
|
||||
[ default = 8, (help) = "the number of resync bytes to write after each sector" ];
|
||||
}
|
||||
|
||||
@@ -79,18 +79,14 @@ private:
|
||||
auto write_bit = [&](bool val)
|
||||
{
|
||||
if (cursor <= bits.size())
|
||||
{
|
||||
bits[cursor] = val;
|
||||
}
|
||||
cursor++;
|
||||
};
|
||||
|
||||
auto write_bits = [&](uint32_t bits, int width)
|
||||
{
|
||||
for (int i = width; i--;)
|
||||
{
|
||||
write_bit(bits & (1u << i));
|
||||
}
|
||||
};
|
||||
|
||||
auto write_gcr44 = [&](uint8_t value)
|
||||
@@ -104,15 +100,13 @@ private:
|
||||
};
|
||||
|
||||
// The special "FF40" sequence is used to synchronize the receiving
|
||||
// shift register. It's written as "1111 1111 00"; FF indicates the
|
||||
// 8 consecutive 1-bits, while "40" indicates the total number of
|
||||
// shift register. It's written as "0 1111 1111 0"; FF indicates the
|
||||
// 8 consecutive 1-bits, while "40" indicaes the total number of
|
||||
// microseconds.
|
||||
auto write_ff40 = [&](int n = 1)
|
||||
{
|
||||
for (; n--;)
|
||||
{
|
||||
write_bits(0xff << 2, 10);
|
||||
}
|
||||
write_bits(0xff << 1, 10);
|
||||
};
|
||||
|
||||
// There is data to encode to disk.
|
||||
@@ -127,7 +121,9 @@ private:
|
||||
//
|
||||
// In standard formatting, the first logical sector apparently gets
|
||||
// extra padding.
|
||||
write_ff40(sector.logicalSector == 0 ? 32 : 8);
|
||||
write_ff40(sector.logicalSector == 0
|
||||
? _config.post_index_gap_bytes()
|
||||
: _config.post_data_gap_bytes());
|
||||
|
||||
int track = sector.logicalTrack;
|
||||
if (sector.logicalSide == 1)
|
||||
@@ -144,7 +140,7 @@ private:
|
||||
|
||||
// Write data syncing leader: FF40 + APPLE2_DATA_RECORD + sector
|
||||
// data + sum + DE AA EB (+ mystery bits cut off of the scan?)
|
||||
write_ff40(8);
|
||||
write_ff40(_config.post_address_gap_bytes());
|
||||
write_bits(APPLE2_DATA_RECORD, 24);
|
||||
|
||||
// Convert the sector data to GCR, append the checksum, and write it
|
||||
|
||||
Reference in New Issue
Block a user