MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / decodeSectorRecord

Method decodeSectorRecord

arch/smaky6/decoder.cc:113–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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
145private:
146 const Smaky6DecoderProto& _config;

Callers

nothing calls this directly

Calls 8

sumBytesFunction · 0.85
sliceMethod · 0.80
reverseBitsMethod · 0.80
read_8Method · 0.80
toBytesFunction · 0.50
decodeFmMfmFunction · 0.50
sizeMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected