mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-31 11:17:01 -07:00
Merge pull request #465 from hharte/fix-northstar-decoder
northstar: Fix after decoder change.
This commit is contained in:
@@ -127,9 +127,9 @@ public:
|
|||||||
void decodeSectorRecord() override
|
void decodeSectorRecord() override
|
||||||
{
|
{
|
||||||
uint64_t id = toBytes(readRawBits(64)).reader().read_be64();
|
uint64_t id = toBytes(readRawBits(64)).reader().read_be64();
|
||||||
|
|
||||||
unsigned recordSize, payloadSize, headerSize;
|
unsigned recordSize, payloadSize, headerSize;
|
||||||
if (id == SECTOR_TYPE_MFM) {
|
|
||||||
|
if (id == MFM_ID) {
|
||||||
recordSize = NORTHSTAR_ENCODED_SECTOR_SIZE_DD;
|
recordSize = NORTHSTAR_ENCODED_SECTOR_SIZE_DD;
|
||||||
payloadSize = NORTHSTAR_PAYLOAD_SIZE_DD;
|
payloadSize = NORTHSTAR_PAYLOAD_SIZE_DD;
|
||||||
headerSize = NORTHSTAR_HEADER_SIZE_DD;
|
headerSize = NORTHSTAR_HEADER_SIZE_DD;
|
||||||
@@ -143,22 +143,18 @@ public:
|
|||||||
auto rawbits = readRawBits(recordSize * 16);
|
auto rawbits = readRawBits(recordSize * 16);
|
||||||
auto bytes = decodeFmMfm(rawbits).slice(0, recordSize);
|
auto bytes = decodeFmMfm(rawbits).slice(0, recordSize);
|
||||||
ByteReader br(bytes);
|
ByteReader br(bytes);
|
||||||
uint8_t sync_char;
|
|
||||||
|
|
||||||
_sector->logicalSide = _sector->physicalHead;
|
_sector->logicalSide = _sector->physicalHead;
|
||||||
_sector->logicalSector = _hardSectorId;
|
_sector->logicalSector = _hardSectorId;
|
||||||
_sector->logicalTrack = _sector->physicalCylinder;
|
_sector->logicalTrack = _sector->physicalCylinder;
|
||||||
|
|
||||||
sync_char = br.read_8(); /* Sync char: 0xFB */
|
if (headerSize == NORTHSTAR_HEADER_SIZE_DD) {
|
||||||
if (_sectorType == SECTOR_TYPE_MFM) {
|
br.read_8(); /* MFM second Sync char, usually 0xFB */
|
||||||
sync_char = br.read_8();/* MFM second Sync char, usually 0xFB */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_sector->data = br.read(payloadSize);
|
_sector->data = br.read(payloadSize);
|
||||||
|
|
||||||
uint8_t wantChecksum = br.read_8();
|
uint8_t wantChecksum = br.read_8();
|
||||||
uint8_t gotChecksum = northstarChecksum(bytes.slice(headerSize, payloadSize));
|
uint8_t gotChecksum = northstarChecksum(bytes.slice(headerSize - 1, payloadSize));
|
||||||
|
|
||||||
_sector->status = (wantChecksum == gotChecksum) ? Sector::OK : Sector::BAD_CHECKSUM;
|
_sector->status = (wantChecksum == gotChecksum) ? Sector::OK : Sector::BAD_CHECKSUM;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,7 +166,6 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
const NorthstarDecoderProto& _config;
|
const NorthstarDecoderProto& _config;
|
||||||
uint8_t _sectorType = SECTOR_TYPE_MFM;
|
|
||||||
uint8_t _hardSectorId;
|
uint8_t _hardSectorId;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -22,9 +22,6 @@
|
|||||||
#define NORTHSTAR_ENCODED_SECTOR_SIZE_SD (NORTHSTAR_HEADER_SIZE_SD + NORTHSTAR_PAYLOAD_SIZE_SD + NORTHSTAR_CHECKSUM_SIZE)
|
#define NORTHSTAR_ENCODED_SECTOR_SIZE_SD (NORTHSTAR_HEADER_SIZE_SD + NORTHSTAR_PAYLOAD_SIZE_SD + NORTHSTAR_CHECKSUM_SIZE)
|
||||||
#define NORTHSTAR_ENCODED_SECTOR_SIZE_DD (NORTHSTAR_HEADER_SIZE_DD + NORTHSTAR_PAYLOAD_SIZE_DD + NORTHSTAR_CHECKSUM_SIZE)
|
#define NORTHSTAR_ENCODED_SECTOR_SIZE_DD (NORTHSTAR_HEADER_SIZE_DD + NORTHSTAR_PAYLOAD_SIZE_DD + NORTHSTAR_CHECKSUM_SIZE)
|
||||||
|
|
||||||
#define SECTOR_TYPE_MFM (0)
|
|
||||||
#define SECTOR_TYPE_FM (1)
|
|
||||||
|
|
||||||
class AbstractDecoder;
|
class AbstractDecoder;
|
||||||
class AbstractEncoder;
|
class AbstractEncoder;
|
||||||
class EncoderProto;
|
class EncoderProto;
|
||||||
|
|||||||
Reference in New Issue
Block a user