Micropolis raw 275 byte sectors

These are used by formats like VGI since the ECC varied per machine and
the 10 extra bytes of user data may contain useful information.
This commit is contained in:
Eric Anderson
2021-10-02 22:59:14 -07:00
parent a00137d742
commit ce5fcaf172
5 changed files with 82 additions and 3 deletions

View File

@@ -19,7 +19,15 @@ static void write_sector(std::vector<bool>& bits, unsigned& cursor, const std::s
fullSector->push_back(0);
Bytes sectorData;
if (sector->data.size() == MICROPOLIS_ENCODED_SECTOR_SIZE)
{
if (sector->data[0] != 0xFF)
Error() << "275 byte sector doesn't start with sync byte 0xFF. Corrupted sector";
uint8_t wantChecksum = sector->data[1+2+266];
uint8_t gotChecksum = micropolisChecksum(sector->data.slice(1, 2+266));
if (wantChecksum != gotChecksum)
std::cerr << "Warning: checksum incorrect. Sector: " << sector->logicalSector << std::endl;
sectorData = sector->data;
}
else
{
ByteWriter writer(sectorData);