2017-09-25 00:07:56 +00:00
|
|
|
//
|
|
|
|
// Constants.hpp
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 24/09/2017.
|
2018-05-13 19:19:52 +00:00
|
|
|
// Copyright 2017 Thomas Harte. All rights reserved.
|
2017-09-25 00:07:56 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef Constants_h
|
|
|
|
#define Constants_h
|
|
|
|
|
2017-09-28 01:30:09 +00:00
|
|
|
#include "../../../Storage.hpp"
|
|
|
|
|
2023-05-10 21:02:18 +00:00
|
|
|
namespace Storage::Encodings::MFM {
|
2017-09-25 00:07:56 +00:00
|
|
|
|
2023-12-11 03:17:23 +00:00
|
|
|
enum class Density {
|
|
|
|
Single, Double, High
|
|
|
|
};
|
|
|
|
|
|
|
|
constexpr bool is_mfm(Density density) {
|
|
|
|
return density != Density::Single;
|
|
|
|
}
|
|
|
|
|
2017-09-25 00:07:56 +00:00
|
|
|
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);
|
2017-09-28 01:30:09 +00:00
|
|
|
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) {
|
|
|
|
case Density::Single: return FMBitLength;
|
|
|
|
case Density::Double: return MFMBitLength;
|
|
|
|
case Density::High: return HDMFMBitLength;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-09-25 00:07:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* Constants_h */
|