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

Function mzosChecksum

arch/micropolis/decoder.cc:49–62  ·  view source on GitHub ↗

Vector MZOS does not use the standard Micropolis checksum. * The checksum is initially 0. * For each data byte in the 256-byte payload, rotate left, * carrying bit 7 to bit 0. XOR with the current checksum. * * Unlike the Micropolis checksum, this does not cover the 12-byte * header (track, sector, 10 OS-specific bytes.) */

Source from the content-addressed store, hash-verified

47 * header (track, sector, 10 OS-specific bytes.)
48 */
49uint8_t mzosChecksum(const Bytes& bytes)
50{
51 ByteReader br(bytes);
52 uint8_t checksum = 0;
53 uint8_t databyte;
54
55 while (!br.eof())
56 {
57 databyte = br.read_8();
58 checksum ^= ((databyte << 1) | (databyte >> 7));
59 }
60
61 return checksum;
62}
63
64static uint8_t b(uint32_t field, uint8_t pos)
65{

Callers 1

decodeSectorRecordMethod · 0.85

Calls 2

read_8Method · 0.80
eofMethod · 0.45

Tested by

no test coverage detected