mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-31 11:17:01 -07:00
More Smaky improvements.
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
#include <string.h>
|
||||
#include <algorithm>
|
||||
|
||||
static const FluxPattern SECTOR_PATTERN(20, 0x92aaa);
|
||||
static const FluxPattern SECTOR_PATTERN(28, 0x4892aaa);
|
||||
|
||||
class SmakyDecoder : public Decoder
|
||||
{
|
||||
@@ -20,10 +20,12 @@ public:
|
||||
SmakyDecoder(const DecoderProto& config):
|
||||
Decoder(config),
|
||||
_config(config.smaky())
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
void adjustForIndex(const Fluxmap::Position& previous, const Fluxmap::Position& now)
|
||||
void adjustForIndex(
|
||||
const Fluxmap::Position& previous, const Fluxmap::Position& now)
|
||||
{
|
||||
if ((now.ns() - previous.ns()) < 8e6)
|
||||
{
|
||||
@@ -109,15 +111,17 @@ public:
|
||||
|
||||
void decodeSectorRecord() override
|
||||
{
|
||||
readRawBits(21);
|
||||
readRawBits(29);
|
||||
const auto& rawbits = readRawBits(SMAKY_RECORD_SIZE * 16);
|
||||
if (rawbits.size() < SMAKY_SECTOR_SIZE)
|
||||
return;
|
||||
const auto& rawbytes = toBytes(rawbits).slice(0, SMAKY_RECORD_SIZE*16);
|
||||
const auto& rawbytes =
|
||||
toBytes(rawbits).slice(0, SMAKY_RECORD_SIZE * 16);
|
||||
|
||||
/* The Smaky bytes are stored backwards! Backwards! */
|
||||
|
||||
const auto& bytes = decodeFmMfm(rawbits).slice(0, SMAKY_RECORD_SIZE).reverseBits();
|
||||
const auto& bytes =
|
||||
decodeFmMfm(rawbits).slice(0, SMAKY_RECORD_SIZE).reverseBits();
|
||||
ByteReader br(bytes);
|
||||
|
||||
uint8_t track = br.read_8();
|
||||
@@ -133,7 +137,8 @@ public:
|
||||
_sector->logicalSector = _sectorId;
|
||||
|
||||
_sector->data = data;
|
||||
_sector->status = (wantedChecksum == gotChecksum) ? Sector::OK : Sector::BAD_CHECKSUM;
|
||||
_sector->status =
|
||||
(wantedChecksum == gotChecksum) ? Sector::OK : Sector::BAD_CHECKSUM;
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -148,5 +153,3 @@ std::unique_ptr<Decoder> createSmakyDecoder(const DecoderProto& config)
|
||||
{
|
||||
return std::unique_ptr<Decoder>(new SmakyDecoder(config));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -152,6 +152,7 @@ void Decoder::pushRecord(
|
||||
_trackdata->records.push_back(record);
|
||||
_sector->records.push_back(record);
|
||||
|
||||
record->position = start.bytes;
|
||||
record->startTime = start.ns();
|
||||
record->endTime = end.ns();
|
||||
record->clock = _sector->clock;
|
||||
|
||||
@@ -13,6 +13,7 @@ struct Record
|
||||
nanoseconds_t clock = 0;
|
||||
nanoseconds_t startTime = 0;
|
||||
nanoseconds_t endTime = 0;
|
||||
uint32_t position = 0;
|
||||
Bytes rawData;
|
||||
};
|
||||
|
||||
@@ -38,4 +39,3 @@ struct DiskFlux
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user