Refactor the IBM readers so they just set flags and readibm.cc is doing all the
work.
This commit is contained in:
parent
a59b4f7be7
commit
46e987e393
6 changed files with 30 additions and 73 deletions
|
|
@ -1,29 +1,13 @@
|
|||
#include "globals.h"
|
||||
#include "flags.h"
|
||||
#include "reader.h"
|
||||
#include "fluxmap.h"
|
||||
#include "decoders/decoders.h"
|
||||
#include "sector.h"
|
||||
#include "sectorset.h"
|
||||
#include "record.h"
|
||||
#include "ibm/ibm.h"
|
||||
#include "fmt/format.h"
|
||||
|
||||
static FlagGroup flags { &readerFlags };
|
||||
|
||||
static IntFlag sectorIdBase(
|
||||
{ "--sector-id-base" },
|
||||
"Sector ID of the first sector.",
|
||||
0);
|
||||
#include "readibm.h"
|
||||
|
||||
int mainReadADFS(int argc, const char* argv[])
|
||||
{
|
||||
setReaderDefaultSource(":t=0-79:s=0-1");
|
||||
setReaderDefaultOutput("adfs.img");
|
||||
flags.parseFlags(argc, argv);
|
||||
|
||||
IbmDecoder decoder(sectorIdBase);
|
||||
readDiskCommand(decoder);
|
||||
return 0;
|
||||
sectorIdBase.setDefaultValue(0);
|
||||
return mainReadIBM(argc, argv);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,30 +1,15 @@
|
|||
#include "globals.h"
|
||||
#include "flags.h"
|
||||
#include "reader.h"
|
||||
#include "fluxmap.h"
|
||||
#include "decoders/decoders.h"
|
||||
#include "sector.h"
|
||||
#include "sectorset.h"
|
||||
#include "record.h"
|
||||
#include "ibm/ibm.h"
|
||||
#include "fmt/format.h"
|
||||
|
||||
static FlagGroup flags { &readerFlags };
|
||||
|
||||
static IntFlag sectorIdBase(
|
||||
{ "--sector-id-base" },
|
||||
"Sector ID of the first sector.",
|
||||
17);
|
||||
#include "readibm.h"
|
||||
|
||||
int mainReadAmpro(int argc, const char* argv[])
|
||||
{
|
||||
setReaderDefaultSource(":t=0-79:s=0");
|
||||
setReaderDefaultOutput("ampro.adf");
|
||||
setReaderRevolutions(2);
|
||||
flags.parseFlags(argc, argv);
|
||||
|
||||
IbmDecoder decoder(sectorIdBase);
|
||||
readDiskCommand(decoder);
|
||||
return 0;
|
||||
sectorIdBase.setDefaultValue(17);
|
||||
return mainReadIBM(argc, argv);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,24 +1,14 @@
|
|||
#include "globals.h"
|
||||
#include "flags.h"
|
||||
#include "reader.h"
|
||||
#include "fluxmap.h"
|
||||
#include "decoders/decoders.h"
|
||||
#include "sector.h"
|
||||
#include "sectorset.h"
|
||||
#include "record.h"
|
||||
#include "dataspec.h"
|
||||
#include "ibm/ibm.h"
|
||||
#include "fmt/format.h"
|
||||
|
||||
static FlagGroup flags { &readerFlags };
|
||||
#include "readibm.h"
|
||||
|
||||
int mainReadAtariST(int argc, const char* argv[])
|
||||
{
|
||||
setReaderDefaultSource(":t=0-79:s=0-1");
|
||||
setReaderDefaultOutput("atarist.st");
|
||||
flags.parseFlags(argc, argv);
|
||||
|
||||
IbmDecoder decoder(1);
|
||||
readDiskCommand(decoder);
|
||||
return 0;
|
||||
sectorIdBase.setDefaultValue(1);
|
||||
return mainReadIBM(argc, argv);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,30 +1,14 @@
|
|||
#include "globals.h"
|
||||
#include "flags.h"
|
||||
#include "reader.h"
|
||||
#include "fluxmap.h"
|
||||
#include "decoders/decoders.h"
|
||||
#include "sector.h"
|
||||
#include "sectorset.h"
|
||||
#include "record.h"
|
||||
#include "ibm/ibm.h"
|
||||
#include "fmt/format.h"
|
||||
|
||||
static FlagGroup flags { &readerFlags };
|
||||
|
||||
static IntFlag sectorIdBase(
|
||||
{ "--sector-id-base" },
|
||||
"Sector ID of the first sector.",
|
||||
0);
|
||||
#include "readibm.h"
|
||||
|
||||
int mainReadDFS(int argc, const char* argv[])
|
||||
{
|
||||
setReaderDefaultSource(":t=0-79:s=0");
|
||||
setReaderDefaultOutput("dfs.img");
|
||||
sectorIdBase.setDefaultValue(0);
|
||||
setReaderRevolutions(2);
|
||||
flags.parseFlags(argc, argv);
|
||||
|
||||
IbmDecoder decoder(sectorIdBase);
|
||||
readDiskCommand(decoder);
|
||||
return 0;
|
||||
return mainReadIBM(argc, argv);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,17 +12,17 @@
|
|||
|
||||
static FlagGroup flags { &readerFlags };
|
||||
|
||||
static IntFlag sectorIdBase(
|
||||
IntFlag sectorIdBase(
|
||||
{ "--ibm-sector-id-base" },
|
||||
"Sector ID of the first sector.",
|
||||
1);
|
||||
|
||||
static BoolFlag ignoreSideByte(
|
||||
BoolFlag ignoreSideByte(
|
||||
{ "--ibm-ignore-side-byte" },
|
||||
"Ignore the side byte in the sector ID, and use the physical side instead.",
|
||||
false);
|
||||
|
||||
static RangeFlag requiredSectors(
|
||||
RangeFlag requiredSectors(
|
||||
{ "--ibm-required-sectors" },
|
||||
"A comma seperated list or range of sectors which must be on each track.",
|
||||
"");
|
||||
|
|
|
|||
14
src/readibm.h
Normal file
14
src/readibm.h
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#ifndef READIBM_H
|
||||
#define READIBM_H
|
||||
|
||||
#include "flags.h"
|
||||
#include "dataspec.h"
|
||||
|
||||
extern IntFlag sectorIdBase;
|
||||
extern BoolFlag ignoreSideByte;
|
||||
extern RangeFlag requiredSectors;
|
||||
|
||||
extern int mainReadIBM(int argc, const char* argv[]);
|
||||
|
||||
#endif
|
||||
|
||||
Loading…
Reference in a new issue