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

Method decodeSectorRecord

arch/macintosh/decoder.cc:140–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138 }
139
140 void decodeSectorRecord() override
141 {
142 if (readRaw24() != MAC_SECTOR_RECORD)
143 return;
144
145 /* Read header. */
146
147 auto header = toBytes(readRawBits(7 * 8)).slice(0, 7);
148
149 uint8_t encodedTrack = decode_data_gcr(header[0]);
150 if (encodedTrack != (_ltl->logicalCylinder & 0x3f))
151 return;
152
153 uint8_t encodedSector = decode_data_gcr(header[1]);
154 uint8_t encodedSide = decode_data_gcr(header[2]);
155 uint8_t formatByte = decode_data_gcr(header[3]);
156 uint8_t wantedsum = decode_data_gcr(header[4]);
157
158 if (encodedSector > 11)
159 return;
160
161 _sector->logicalCylinder = _ltl->logicalCylinder;
162 _sector->logicalHead = decode_side(encodedSide);
163 _sector->logicalSector = encodedSector;
164 uint8_t gotsum =
165 (encodedTrack ^ encodedSector ^ encodedSide ^ formatByte) & 0x3f;
166 if (wantedsum == gotsum)
167 _sector->status =
168 Sector::DATA_MISSING; /* unintuitive but correct */
169 }
170
171 void decodeDataRecord() override
172 {

Callers

nothing calls this directly

Calls 4

decode_sideFunction · 0.85
sliceMethod · 0.80
decode_data_gcrFunction · 0.70
toBytesFunction · 0.50

Tested by

no test coverage detected