Skip to content

Commit

Permalink
Add support for 528-byte sectors. Adjust the post-index gap to (try?)…
Browse files Browse the repository at this point in the history
… and fit

all the data in one revolution. I think my write clock is a bit slow.
  • Loading branch information
davidgiven committed Dec 14, 2019
1 parent 7c66e1b commit d0ed5b3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion arch/amiga/encoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ static DoubleFlag clockRateUs(
static DoubleFlag postIndexGapMs(
{ "--post-index-gap" },
"Post-index gap before first sector header (milliseconds).",
5.0);
0.5);

static int charToInt(char c)
{
Expand Down Expand Up @@ -64,6 +64,9 @@ static void write_interleaved_bytes(std::vector<bool>& bits, unsigned& cursor, u

static void write_sector(std::vector<bool>& bits, unsigned& cursor, const Sector* sector)
{
if ((sector->data.size() != 512) && (sector->data.size() != 528))
Error() << "unsupported sector size --- you must pick 512 or 528";

write_bits(bits, cursor, AMIGA_SECTOR_RECORD, 6*8);

std::vector<bool> headerBits(20*16);
Expand All @@ -78,6 +81,8 @@ static void write_sector(std::vector<bool>& bits, unsigned& cursor, const Sector
};
write_interleaved_bytes(headerBits, headerCursor, header);
Bytes recoveryInfo(16);
if (sector->data.size() == 528)
recoveryInfo = sector->data.slice(512, 16);
write_interleaved_bytes(headerBits, headerCursor, recoveryInfo);

std::vector<bool> dataBits(512*16);
Expand Down

0 comments on commit d0ed5b3

Please sign in to comment.