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.) */
| 47 | * header (track, sector, 10 OS-specific bytes.) |
| 48 | */ |
| 49 | uint8_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 | |
| 64 | static uint8_t b(uint32_t field, uint8_t pos) |
| 65 | { |
no test coverage detected