mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-31 11:17:01 -07:00
Change the readers to correctly set the physical track for each sector using
the mapper (where appropriate).
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include "image.h"
|
||||
#include "proto.h"
|
||||
#include "logger.h"
|
||||
#include "mapper.h"
|
||||
#include "lib/config.pb.h"
|
||||
#include "fmt/format.h"
|
||||
#include <algorithm>
|
||||
@@ -62,21 +63,23 @@ public:
|
||||
Logger() << "D88: overriding configured format";
|
||||
|
||||
auto ibm = config.mutable_encoder()->mutable_ibm();
|
||||
int physicalStep = 1;
|
||||
int clockRate = 500;
|
||||
if (mediaFlag == 0x20)
|
||||
{
|
||||
Logger() << "D88: high density mode";
|
||||
if (!config.drive().has_drive())
|
||||
config.mutable_drive()->set_high_density(true);
|
||||
if (!config.has_tpi())
|
||||
config.set_tpi(96);
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger() << "D88: single/double density mode";
|
||||
physicalStep = 2;
|
||||
clockRate = 300;
|
||||
if (!config.drive().has_drive())
|
||||
config.mutable_drive()->set_high_density(false);
|
||||
if (!config.has_tpi())
|
||||
config.set_tpi(48);
|
||||
}
|
||||
|
||||
std::unique_ptr<Image> image(new Image);
|
||||
@@ -146,7 +149,7 @@ public:
|
||||
trackSectorSize = sectorSize;
|
||||
// this is the first sector we've read, use it settings for
|
||||
// per-track data
|
||||
trackdata->set_track(track * physicalStep);
|
||||
trackdata->set_track(track);
|
||||
trackdata->set_head(head);
|
||||
trackdata->set_sector_size(sectorSize);
|
||||
trackdata->set_use_fm(fm);
|
||||
@@ -176,11 +179,10 @@ public:
|
||||
}
|
||||
Bytes data(sectorSize);
|
||||
inputFile.read((char*)data.begin(), data.size());
|
||||
const auto& sector =
|
||||
image->put(track * physicalStep, head, sectorId);
|
||||
const auto& sector = image->put(track, head, sectorId);
|
||||
sector->status = Sector::OK;
|
||||
sector->logicalTrack = track;
|
||||
sector->physicalTrack = track * physicalStep;
|
||||
sector->physicalTrack = Mapper::remapTrackLogicalToPhysical(track);
|
||||
sector->logicalSide = sector->physicalHead = head;
|
||||
sector->logicalSector = sectorId;
|
||||
sector->data = data;
|
||||
@@ -188,7 +190,7 @@ public:
|
||||
sectors->add_sector(sectorId);
|
||||
}
|
||||
|
||||
if (physicalStep == 2)
|
||||
if (mediaFlag != 0x20)
|
||||
{
|
||||
auto trackdata = ibm->add_trackdata();
|
||||
trackdata->set_clock_rate_khz(clockRate);
|
||||
|
||||
Reference in New Issue
Block a user