1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-11 15:49:38 +00:00
CLK/Storage/Disk/Encodings/MFM/Constants.hpp

57 lines
1.9 KiB
C++
Raw Normal View History

//
// Constants.hpp
// Clock Signal
//
// Created by Thomas Harte on 24/09/2017.
// Copyright 2017 Thomas Harte. All rights reserved.
//
#ifndef Constants_h
#define Constants_h
#include "../../../Storage.hpp"
2023-05-10 21:02:18 +00:00
namespace Storage::Encodings::MFM {
2023-12-11 03:17:23 +00:00
enum class Density {
Single, Double, High
};
constexpr bool is_mfm(Density density) {
return density != Density::Single;
}
const uint8_t IndexAddressByte = 0xfc;
const uint8_t IDAddressByte = 0xfe;
const uint8_t DataAddressByte = 0xfb;
const uint8_t DeletedDataAddressByte = 0xf8;
const uint16_t FMIndexAddressMark = 0xf77a; // data 0xfc, with clock 0xd7 => 1111 1100 with clock 1101 0111 => 1111 0111 0111 1010
const uint16_t FMIDAddressMark = 0xf57e; // data 0xfe, with clock 0xc7 => 1111 1110 with clock 1100 0111 => 1111 0101 0111 1110
const uint16_t FMDataAddressMark = 0xf56f; // data 0xfb, with clock 0xc7 => 1111 1011 with clock 1100 0111 => 1111 0101 0110 1111
const uint16_t FMDeletedDataAddressMark = 0xf56a; // data 0xf8, with clock 0xc7 => 1111 1000 with clock 1100 0111 => 1111 0101 0110 1010
const uint16_t MFMIndexSync = 0x5224; // data 0xc2, with a missing clock at 0x0080 => 0101 0010 1010 0100 without 1000 0000
const uint16_t MFMSync = 0x4489; // data 0xa1, with a missing clock at 0x0020 => 0100 0100 1010 1001 without 0010 0000
const uint16_t MFMPostSyncCRCValue = 0xcdb4; // the value the CRC generator should have after encountering three 0xa1s
const uint8_t MFMIndexSyncByteValue = 0xc2;
const uint8_t MFMSyncByteValue = 0xa1;
2023-12-11 03:17:23 +00:00
const Time HDMFMBitLength = Time(1, 200000);
const Time MFMBitLength = Time(1, 100000);
const Time FMBitLength = Time(1, 50000);
2023-12-11 03:17:23 +00:00
constexpr Time bit_length(Density density) {
switch(density) {
2023-12-27 15:58:13 +00:00
default:
2023-12-11 03:17:23 +00:00
case Density::Single: return FMBitLength;
case Density::Double: return MFMBitLength;
case Density::High: return HDMFMBitLength;
}
}
}
#endif /* Constants_h */