| 111 | } |
| 112 | |
| 113 | void decodeSectorRecord() override |
| 114 | { |
| 115 | readRawBits(33); |
| 116 | const auto& rawbits = readRawBits(SMAKY6_RECORD_SIZE * 16); |
| 117 | if (rawbits.size() < SMAKY6_SECTOR_SIZE) |
| 118 | return; |
| 119 | const auto& rawbytes = |
| 120 | toBytes(rawbits).slice(0, SMAKY6_RECORD_SIZE * 16); |
| 121 | |
| 122 | /* The Smaky bytes are stored backwards! Backwards! */ |
| 123 | |
| 124 | const auto& bytes = |
| 125 | decodeFmMfm(rawbits).slice(0, SMAKY6_RECORD_SIZE).reverseBits(); |
| 126 | ByteReader br(bytes); |
| 127 | |
| 128 | uint8_t track = br.read_8(); |
| 129 | Bytes data = br.read(SMAKY6_SECTOR_SIZE); |
| 130 | uint8_t wantedChecksum = br.read_8(); |
| 131 | uint8_t gotChecksum = sumBytes(data) & 0xff; |
| 132 | |
| 133 | if (track != _ltl->logicalCylinder) |
| 134 | return; |
| 135 | |
| 136 | _sector->logicalCylinder = _ltl->physicalCylinder; |
| 137 | _sector->logicalHead = _ltl->logicalHead; |
| 138 | _sector->logicalSector = _sectorId; |
| 139 | |
| 140 | _sector->data = data; |
| 141 | _sector->status = |
| 142 | (wantedChecksum == gotChecksum) ? Sector::OK : Sector::BAD_CHECKSUM; |
| 143 | } |
| 144 | |
| 145 | private: |
| 146 | const Smaky6DecoderProto& _config; |
nothing calls this directly
no test coverage detected