mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-24 11:11:02 -07:00
Merge pull request #823 from davidgiven/cleanup
Do some cleanup since the last changes.
This commit is contained in:
@@ -1,15 +0,0 @@
|
||||
40track_drive
|
||||
====
|
||||
## Adjust configuration for a 40-track drive
|
||||
<!-- This file is automatically generated. Do not edit. -->
|
||||
|
||||
This is an extension profile; adding this to the command line will configure
|
||||
FluxEngine to read from 40-track, 48tpi 5.25" drives. You have to tell it because there is
|
||||
no way to detect this automatically.
|
||||
|
||||
For example:
|
||||
|
||||
```
|
||||
fluxengine read ibm --180 40track_drive
|
||||
```
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
apple2_drive
|
||||
====
|
||||
## Adjust configuration for a 40-track Apple II drive
|
||||
<!-- This file is automatically generated. Do not edit. -->
|
||||
|
||||
This is an extension profile; adding this to the command line will configure
|
||||
FluxEngine to adjust the pinout and track spacing to work with an Apple II
|
||||
drive. This only works on Greaseweazle hardware and requires a custom
|
||||
connector.
|
||||
|
||||
For example:
|
||||
|
||||
```
|
||||
fluxengine read apple2 --160 apple2_drive
|
||||
```
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
shugart_drive
|
||||
====
|
||||
## Adjust configuration for a Shugart drive
|
||||
<!-- This file is automatically generated. Do not edit. -->
|
||||
|
||||
This is an extension profile; adding this to the command line will configure
|
||||
FluxEngine to adjust the pinout to work with a Shugart drive. This only works
|
||||
on Greaseweazle hardware.
|
||||
|
||||
For example:
|
||||
|
||||
```
|
||||
fluxengine read ibm --720 shugart_drive
|
||||
```
|
||||
|
||||
@@ -36,10 +36,10 @@ Forty track formats on a forty track drive
|
||||
------------------------------------------
|
||||
|
||||
If you actually have a forty track drive, you need to tell FluxEngine. This is
|
||||
done by adding the special profile `40track_drive`:
|
||||
done by adding `--drivetype=40`:
|
||||
|
||||
```
|
||||
fluxengine write ibm --360 40track_drive -i image.img -d drive:0
|
||||
fluxengine write -c ibm --360 --drivetype=40 -i image.img -d drive:0
|
||||
```
|
||||
|
||||
It should then Just Work. This is supported by both FluxEngine and Greaseweazle
|
||||
@@ -47,24 +47,6 @@ hardware.
|
||||
|
||||
Obviously you can't write an eighty-track format using a forty-track drive!
|
||||
|
||||
Apple II drives
|
||||
---------------
|
||||
|
||||
The Apple II had special drives which supported microstepping: when commanded
|
||||
to move the head, then instead of moving in single-track steps as is done in
|
||||
most other drives, the Apple II drive would move in quarter-track steps. This
|
||||
allowed much less precise head alignment, as small errors could be corrected in
|
||||
software. (The Brother word processor drives were similar.) The bus interface
|
||||
is different from normal PC drives.
|
||||
|
||||
The FluxEngine client supports these with the `apple2_drive` profile:
|
||||
|
||||
```
|
||||
fluxengine write apple2 apple2_drive -i image.img -d drive:0
|
||||
```
|
||||
|
||||
This is supported only by Greaseweazle hardware.
|
||||
|
||||
Shugart drives
|
||||
--------------
|
||||
|
||||
@@ -77,14 +59,32 @@ the drives must be jumpered to configure them. This was mostly used by older
|
||||
3.5" drives, such as those on the Atari ST. [the How It Works
|
||||
page](technical.md) for the pinout.
|
||||
|
||||
The FluxEngine client supports these with the `shugart_drive` profile:
|
||||
The FluxEngine client supports these with `--bus=shugart`:
|
||||
|
||||
```
|
||||
fluxengine write atarist720 shugart_drive -i image.img -d drive:0
|
||||
fluxengine write -c atarist720 --bus=shugart -i image.img -d drive:0
|
||||
```
|
||||
|
||||
(If you have a 40-track Shugart drive, use _both_ `shugart_drive` and
|
||||
`40track_drive`.)
|
||||
(If you have a 40-track Shugart drive, use _both_ `--bus=shugart` and
|
||||
`--drivetype=40`.)
|
||||
|
||||
This is supported only by Greaseweazle hardware.
|
||||
|
||||
Apple II drives
|
||||
---------------
|
||||
|
||||
The Apple II had special drives which supported microstepping: when commanded
|
||||
to move the head, then instead of moving in single-track steps as is done in
|
||||
most other drives, the Apple II drive would move in quarter-track steps. This
|
||||
allowed much less precise head alignment, as small errors could be corrected in
|
||||
software. (The Brother word processor drives were similar.) The bus interface
|
||||
is different from normal PC drives.
|
||||
|
||||
The FluxEngine client supports these with `--drivetype=160 --bus=appleii`.
|
||||
|
||||
```
|
||||
fluxengine write -c apple2 --drivetype=160 --bus=appleii -i image.img -d drive:0
|
||||
```
|
||||
|
||||
This is supported only by Greaseweazle hardware.
|
||||
|
||||
|
||||
30
doc/using.md
30
doc/using.md
@@ -108,13 +108,13 @@ encoder {
|
||||
}
|
||||
}
|
||||
}
|
||||
$ fluxengine write ibm --1440 config.textpb -i image.img
|
||||
$ fluxengine write -c ibm --1440 -c config.textpb -i image.img
|
||||
```
|
||||
|
||||
...or you can specify them on the command line:
|
||||
|
||||
```
|
||||
$ fluxengine write ibm --1440 -i image.img --encoder.ibm.trackdata.emit_iam=false
|
||||
$ fluxengine write -c ibm --1440 -i image.img --encoder.ibm.trackdata.emit_iam=false
|
||||
```
|
||||
|
||||
Both the above invocations are equivalent. The text files use [Google's
|
||||
@@ -128,7 +128,7 @@ files as you wish; they are all merged left to right. You can see all these
|
||||
settings by doing:
|
||||
|
||||
```
|
||||
$ fluxengine write ibm --1440 --config
|
||||
$ fluxengine write -c ibm --1440 --show-config
|
||||
```
|
||||
|
||||
The `--config` option will cause the current configuration to be dumped to the
|
||||
@@ -159,27 +159,13 @@ more common tools.
|
||||
disk). `<profile>` is a reference to an internal output configuration file
|
||||
describing the format.
|
||||
|
||||
- `fluxengine rawread -s <flux source> -d <flux destination>`
|
||||
|
||||
Reads flux (possibly from a disk) and writes it to a flux file without doing
|
||||
any decoding. You can specify a profile if you want to read a subset of the
|
||||
disk.
|
||||
|
||||
- `fluxengine rawwrite -s <flux source> -d <flux destination>`
|
||||
|
||||
Reads flux from a file and writes it (possibly to a disk) without doing any
|
||||
encoding. You can specify a profile if you want to write a subset of the
|
||||
disk.
|
||||
|
||||
- `fluxengine merge -s <fluxfile> -s <fluxfile...> -d <fluxfile`
|
||||
|
||||
Merges data from multiple flux files together. This is useful if you have
|
||||
several reads from an unreliable disk where each read has a different set
|
||||
of good sectors. By merging the flux files, you get to combine all the
|
||||
data. Don't use this on reads of different disks, for obvious results! Note
|
||||
that this works on flux files, not on flux sources.
|
||||
|
||||
- `fluxengine inspect -s <flux source> -c <cylinder> -h <head> -B`
|
||||
- `fluxengine inspect -s <flux source> -t <track> -h <head> -B`
|
||||
|
||||
Reads flux (possibly from a disk) and does various analyses of it to try and
|
||||
detect the clock rate, display raw flux information, examine the underlying
|
||||
@@ -198,14 +184,8 @@ more common tools.
|
||||
|
||||
There are other tools; try `fluxengine --help`.
|
||||
|
||||
**Important note on `rawread` and `rawwrite`:** You can't use these tools to
|
||||
**Important note on `rawwrite`:** You can't use theis tool to
|
||||
copy disks, in most circumstances. See [the FAQ](faq.md) for more information.
|
||||
Also, `rawread` is not guaranteed to read correctly. Floppy disks are
|
||||
fundamentally unreliable, and random bit errors may occur at any time; these
|
||||
can only be detected by performing a decode and verifying the checksums on the
|
||||
sectors. To perform a correct read, it's recommended to do `fluxengine read`
|
||||
with the `--copy-flux-to` option, to perform a decode to a filesystem image
|
||||
while also writing to a flux file.
|
||||
|
||||
### Flux sources and destinations
|
||||
|
||||
|
||||
@@ -741,38 +741,3 @@ void readDiskCommand(
|
||||
*diskflux->image, globalConfig()->decoder().write_csv_to());
|
||||
writer.writeImage(*diskflux->image);
|
||||
}
|
||||
|
||||
void rawReadDiskCommand(FluxSource& fluxsource, FluxSink& fluxsink)
|
||||
{
|
||||
log(BeginOperationLogMessage{"Performing raw read of disk"});
|
||||
|
||||
if (fluxsource.isHardware() || fluxsink.isHardware())
|
||||
measureDiskRotation();
|
||||
auto physicalLocations = Layout::computePhysicalLocations();
|
||||
unsigned index = 0;
|
||||
for (const auto& physicalLocation : physicalLocations)
|
||||
{
|
||||
log(OperationProgressLogMessage{
|
||||
index * 100 / (int)physicalLocations.size()});
|
||||
index++;
|
||||
|
||||
testForEmergencyStop();
|
||||
auto trackInfo = Layout::getLayoutOfTrackPhysical(
|
||||
physicalLocation.cylinder, physicalLocation.head);
|
||||
auto fluxSourceIterator = fluxsource.readFlux(
|
||||
trackInfo->physicalTrack, trackInfo->physicalSide);
|
||||
|
||||
log(BeginReadOperationLogMessage{
|
||||
trackInfo->physicalTrack, trackInfo->physicalSide});
|
||||
auto fluxmap = fluxSourceIterator->next();
|
||||
log(EndReadOperationLogMessage());
|
||||
log("{0} ms in {1} bytes",
|
||||
(int)(fluxmap->duration() / 1e6),
|
||||
fluxmap->bytes());
|
||||
|
||||
fluxsink.writeFlux(
|
||||
trackInfo->physicalTrack, trackInfo->physicalSide, *fluxmap);
|
||||
}
|
||||
|
||||
log(EndOperationLogMessage{"Raw read complete"});
|
||||
}
|
||||
|
||||
@@ -111,6 +111,5 @@ extern std::shared_ptr<const DiskFlux> readDiskCommand(
|
||||
FluxSource& fluxsource, Decoder& decoder);
|
||||
extern void readDiskCommand(
|
||||
FluxSource& source, Decoder& decoder, ImageWriter& writer);
|
||||
extern void rawReadDiskCommand(FluxSource& source, FluxSink& sink);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -19,11 +19,9 @@ cxxprogram(
|
||||
"./fe-getfileinfo.cc",
|
||||
"./fe-inspect.cc",
|
||||
"./fe-ls.cc",
|
||||
"./fe-merge.cc",
|
||||
"./fe-mkdir.cc",
|
||||
"./fe-mv.cc",
|
||||
"./fe-putfile.cc",
|
||||
"./fe-rawread.cc",
|
||||
"./fe-rawwrite.cc",
|
||||
"./fe-read.cc",
|
||||
"./fe-rm.cc",
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
#include "lib/core/globals.h"
|
||||
#include "lib/config/flags.h"
|
||||
#include "lib/data/fluxmap.h"
|
||||
#include "lib/data/sector.h"
|
||||
#include "lib/config/proto.h"
|
||||
#include "lib/data/flux.h"
|
||||
#include "lib/external/fl2.h"
|
||||
#include "lib/external/fl2.pb.h"
|
||||
#include "src/fluxengine.h"
|
||||
#include <fstream>
|
||||
|
||||
static FlagGroup flags;
|
||||
|
||||
static std::vector<std::string> inputFluxFiles;
|
||||
|
||||
static StringFlag sourceFlux({"-s", "--source"},
|
||||
"flux file to read from (repeatable)",
|
||||
"",
|
||||
[](const auto& value)
|
||||
{
|
||||
inputFluxFiles.push_back(value);
|
||||
});
|
||||
|
||||
static StringFlag destFlux(
|
||||
{"-d", "--dest"}, "destination flux file to write to", "");
|
||||
|
||||
int mainMerge(int argc, const char* argv[])
|
||||
{
|
||||
flags.parseFlags(argc, argv);
|
||||
|
||||
if (inputFluxFiles.empty())
|
||||
error("you must specify at least one input flux file (with -s)");
|
||||
if (destFlux.get() == "")
|
||||
error("you must specify an output flux file (with -d)");
|
||||
|
||||
std::map<std::pair<int, int>, TrackFluxProto> data;
|
||||
for (const auto& s : inputFluxFiles)
|
||||
{
|
||||
fmt::print("Reading {}...\n", s);
|
||||
FluxFileProto f = loadFl2File(s);
|
||||
|
||||
for (auto& trackflux : f.track())
|
||||
{
|
||||
auto key = std::make_pair(trackflux.track(), trackflux.head());
|
||||
auto i = data.find(key);
|
||||
if (i == data.end())
|
||||
data[key] = trackflux;
|
||||
else
|
||||
{
|
||||
for (auto flux : trackflux.flux())
|
||||
i->second.add_flux(flux);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FluxFileProto proto;
|
||||
for (auto& i : data)
|
||||
*proto.add_track() = i.second;
|
||||
|
||||
fmt::print("Writing {}...\n", destFlux.get());
|
||||
saveFl2File(destFlux.get(), proto);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
#include "lib/core/globals.h"
|
||||
#include "lib/config/config.h"
|
||||
#include "lib/config/flags.h"
|
||||
#include "lib/algorithms/readerwriter.h"
|
||||
#include "lib/data/fluxmap.h"
|
||||
#include "lib/decoders/decoders.h"
|
||||
#include "lib/data/sector.h"
|
||||
#include "lib/config/proto.h"
|
||||
#include "lib/fluxsink/fluxsink.h"
|
||||
#include "lib/fluxsource/fluxsource.h"
|
||||
#include "lib/imagewriter/imagewriter.h"
|
||||
#include "fluxengine.h"
|
||||
#include <google/protobuf/text_format.h>
|
||||
#include <fstream>
|
||||
|
||||
static FlagGroup flags;
|
||||
|
||||
static StringFlag sourceFlux({"-s", "--source"},
|
||||
"flux file to read from",
|
||||
"",
|
||||
[](const auto& value)
|
||||
{
|
||||
globalConfig().setFluxSource(value);
|
||||
});
|
||||
|
||||
static StringFlag destFlux({"-d", "--dest"},
|
||||
"destination flux file to write to",
|
||||
"",
|
||||
[](const auto& value)
|
||||
{
|
||||
globalConfig().setFluxSink(value);
|
||||
});
|
||||
|
||||
int mainRawRead(int argc, const char* argv[])
|
||||
{
|
||||
globalConfig().overrides()->set_tracks("0-79");
|
||||
|
||||
if (argc == 1)
|
||||
showProfiles("rawread", formats);
|
||||
globalConfig().overrides()->mutable_flux_source()->set_type(FLUXTYPE_DRIVE);
|
||||
flags.parseFlagsWithConfigFiles(argc, argv, formats);
|
||||
|
||||
if (globalConfig()->flux_sink().type() == FLUXTYPE_DRIVE)
|
||||
error("you can't use rawread to write to hardware");
|
||||
|
||||
auto fluxSource = FluxSource::create(globalConfig());
|
||||
auto fluxSink = FluxSink::create(globalConfig());
|
||||
|
||||
rawReadDiskCommand(*fluxSource, *fluxSink);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -16,11 +16,9 @@ extern command_cb mainGetFile;
|
||||
extern command_cb mainGetFileInfo;
|
||||
extern command_cb mainInspect;
|
||||
extern command_cb mainLs;
|
||||
extern command_cb mainMerge;
|
||||
extern command_cb mainMkDir;
|
||||
extern command_cb mainMv;
|
||||
extern command_cb mainPutFile;
|
||||
extern command_cb mainRawRead;
|
||||
extern command_cb mainRawWrite;
|
||||
extern command_cb mainRead;
|
||||
extern command_cb mainRm;
|
||||
@@ -51,10 +49,8 @@ static std::vector<Command> commands =
|
||||
{ "write", mainWrite, "Writes a sector image to a disk.", },
|
||||
{ "fluxfile", mainFluxfile, "Flux file manipulation operations.", },
|
||||
{ "format", mainFormat, "Format a disk and make a file system on it.", },
|
||||
{ "rawread", mainRawRead, "Reads raw flux from a disk. Warning: you can't use this to copy disks.", },
|
||||
{ "rawwrite", mainRawWrite, "Writes a flux file to a disk. Warning: you can't use this to copy disks.", },
|
||||
{ "convert", mainConvert, "Converts a flux file from one format to another.", },
|
||||
{ "merge", mainMerge, "Merge together multiple flux files.", },
|
||||
{ "getdiskinfo", mainGetDiskInfo, "Read volume metadata off a disk (or image).", },
|
||||
{ "ls", mainLs, "Show files on disk (or image).", },
|
||||
{ "mv", mainMv, "Rename a file on a disk (or image).", },
|
||||
|
||||
Reference in New Issue
Block a user