mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-31 11:17:01 -07:00
More refactoring.
This commit is contained in:
@@ -26,8 +26,6 @@ struct IbmIdam
|
||||
class Sector;
|
||||
class Fluxmap;
|
||||
|
||||
extern std::vector<bool> decodeFluxmapToBits(const Fluxmap& fluxmap, nanoseconds_t clock_period);
|
||||
|
||||
extern std::vector<std::vector<uint8_t>> decodeBitsToRecordsMfm(const std::vector<bool>& bitmap);
|
||||
|
||||
extern std::vector<std::unique_ptr<Sector>> parseRecordsToSectorsIbm(const std::vector<std::vector<uint8_t>>& records);
|
||||
|
||||
@@ -56,9 +56,9 @@ nanoseconds_t Fluxmap::guessClock() const
|
||||
}
|
||||
|
||||
/* Decodes a fluxmap into a nice aligned array of bits. */
|
||||
std::vector<bool> decodeFluxmapToBits(const Fluxmap& fluxmap, nanoseconds_t clockPeriod)
|
||||
std::vector<bool> Fluxmap::decodeToBits(nanoseconds_t clockPeriod) const
|
||||
{
|
||||
int pulses = fluxmap.duration() / clockPeriod;
|
||||
int pulses = duration() / clockPeriod;
|
||||
nanoseconds_t lowerThreshold = clockPeriod * clockDecodeThreshold;
|
||||
|
||||
std::vector<bool> bitmap(pulses);
|
||||
@@ -69,9 +69,9 @@ std::vector<bool> decodeFluxmapToBits(const Fluxmap& fluxmap, nanoseconds_t cloc
|
||||
{
|
||||
while (timestamp < lowerThreshold)
|
||||
{
|
||||
if (cursor >= fluxmap.bytes())
|
||||
if (cursor >= bytes())
|
||||
goto abort;
|
||||
uint8_t interval = fluxmap[cursor++];
|
||||
uint8_t interval = (*this)[cursor++];
|
||||
timestamp += interval * NS_PER_TICK;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ public:
|
||||
Fluxmap& appendIntervals(const uint8_t* ptr, size_t len);
|
||||
|
||||
nanoseconds_t guessClock() const;
|
||||
std::vector<bool> decodeToBits(nanoseconds_t clock_period) const;
|
||||
|
||||
private:
|
||||
nanoseconds_t _duration = 0;
|
||||
|
||||
16
meson.build
16
meson.build
@@ -48,8 +48,18 @@ felib = shared_library('felib',
|
||||
)
|
||||
feinc = include_directories('lib')
|
||||
|
||||
sqllib = shared_library('sqllib', ['lib/sql.cc'], link_with: [felib], dependencies: [sqlite])
|
||||
readerlib = shared_library('readerlib', ['lib/reader.cc'], include_directories: [fmtinc], link_with: [felib, sqllib, fmtlib])
|
||||
sqllib = shared_library('sqllib',
|
||||
['lib/sql.cc'],
|
||||
link_with: [felib],
|
||||
dependencies: [sqlite])
|
||||
readerlib = shared_library('readerlib',
|
||||
['lib/reader.cc'],
|
||||
include_directories: [fmtinc],
|
||||
link_with: [felib, sqllib, fmtlib])
|
||||
writerlib = shared_library('writerlib',
|
||||
['lib/writer.cc'],
|
||||
include_directories: [fmtinc],
|
||||
link_with: [felib, sqllib, fmtlib])
|
||||
|
||||
decoderlib = shared_library('decoderlib',
|
||||
[
|
||||
@@ -77,6 +87,6 @@ executable('fe-seek', ['src/fe-seek.cc'], include_dire
|
||||
executable('fe-testbulktransport', ['src/fe-testbulktransport.cc'], include_directories: [feinc], link_with: [felib])
|
||||
executable('fe-readibm', ['src/fe-readibm.cc'], include_directories: [feinc, fmtinc, decoderinc], link_with: [felib, readerlib, decoderlib, fmtlib])
|
||||
executable('fe-readbrother', ['src/fe-readbrother.cc'], include_directories: [feinc, fmtinc, decoderinc, brotherinc], link_with: [felib, readerlib, decoderlib, brotherlib, fmtlib])
|
||||
executable('fe-writebrother', ['src/fe-writebrother.cc'], include_directories: [feinc, fmtinc, decoderinc, brotherinc], link_with: [felib, readerlib, decoderlib, brotherlib, fmtlib])
|
||||
executable('fe-writebrother', ['src/fe-writebrother.cc'], include_directories: [feinc, fmtinc, decoderinc, brotherinc], link_with: [felib, writerlib, decoderlib, brotherlib, fmtlib])
|
||||
executable('fe-inspect', ['src/fe-inspect.cc'], include_directories: [feinc, fmtinc, decoderinc], link_with: [felib, readerlib, decoderlib, fmtlib])
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ int main(int argc, const char* argv[])
|
||||
nanoseconds_t clockPeriod = fluxmap.guessClock();
|
||||
std::cout << fmt::format(" {:.1f} us clock; ", (double)clockPeriod/1000.0) << std::flush;
|
||||
|
||||
auto bitmap = decodeFluxmapToBits(fluxmap, clockPeriod*clockScaleFlag);
|
||||
auto bitmap = fluxmap.decodeToBits(clockPeriod*clockScaleFlag);
|
||||
std::cout << fmt::format("{} bytes encoded.", bitmap.size()/8) << std::endl;
|
||||
|
||||
if (dumpFluxFlag)
|
||||
|
||||
@@ -44,7 +44,7 @@ int main(int argc, const char* argv[])
|
||||
nanoseconds_t clockPeriod = fluxmap.guessClock();
|
||||
std::cout << fmt::format(" {:.1f} us clock; ", (double)clockPeriod/1000.0) << std::flush;
|
||||
|
||||
auto bitmap = decodeFluxmapToBits(fluxmap, clockPeriod);
|
||||
auto bitmap = fluxmap.decodeToBits(clockPeriod);
|
||||
std::cout << fmt::format("{} bytes encoded; ", bitmap.size()/8) << std::flush;
|
||||
|
||||
auto records = decodeBitsToRecordsBrother(bitmap);
|
||||
|
||||
@@ -32,7 +32,7 @@ int main(int argc, const char* argv[])
|
||||
std::cout << fmt::format(" {:.1f} us clock; ", (double)clockPeriod/1000.0) << std::flush;
|
||||
|
||||
/* For MFM, the bit clock is half the detected clock. */
|
||||
auto bitmap = decodeFluxmapToBits(fluxmap, clockPeriod/2);
|
||||
auto bitmap = fluxmap.decodeToBits(clockPeriod/2);
|
||||
std::cout << fmt::format("{} bytes encoded; ", bitmap.size()/8) << std::flush;
|
||||
|
||||
auto records = decodeBitsToRecordsMfm(bitmap);
|
||||
|
||||
@@ -23,6 +23,10 @@ int main(int argc, const char* argv[])
|
||||
Geometry geometry = {78, 1, 12, 256};
|
||||
readSectorsFromFile(allSectors, geometry, inputFilename);
|
||||
|
||||
for (int track=0; track<geometry.tracks; track++)
|
||||
{
|
||||
}
|
||||
|
||||
std::cerr << "Not implemented yet." << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user