Merge pull request #264 from davidgiven/salfter-local

Overhaul profiles and merge in salfter's IBM formats
This commit is contained in:
David Given
2021-05-24 12:24:21 +02:00
committed by GitHub
50 changed files with 277 additions and 15 deletions

View File

@@ -16,11 +16,6 @@ sectors, unlike the Macintosh. Like the Macintosh, there's a crazy encoding
scheme applied to the data before it goes down on disk to speed up
checksumming.
Macintosh disks come in two varieties: the newer 1440kB ones, which are
perfectly ordinary PC disks you should use `fluxengine read ibm` to read, and
the older 800kB disks (and 400kB for the single sides ones). They have 80
tracks and up to 12 sectors per track.
In addition, a lot of the behaviour of the drive was handled in software.
This means that Apple II disks can do all kinds of weird things, including
having spiral tracks! Copy protection for the Apple II was even madder than

View File

@@ -17,6 +17,10 @@ Just do:
vary depending on the format. This is an alias for `fluxengine read ibm` with
preconfigured parameters.
Note that the profile by default assumes a double-sided disk; if you're reading
a single-sided disk, add `--heads 0` to prevent FluxEngine from looking at the
other side and getting confused by any data it sees there.
Writing disks
-------------
@@ -45,7 +49,8 @@ The syntax is:
- `atarist820`: a 820kB 3.5" disk, with 82 cylinders, 2 sides, and 10 sectors
per track.
See [the IBM format documentation](disk-ibm.md) for more information.
See [the IBM format documentation](disk-ibm.md) for more information. Note that
only some PC 3.5" floppy disk drives are capable of seeking to the 82nd track.
Useful references

View File

@@ -77,8 +77,9 @@ The syntax is:
fluxengine write <format> -i input.img <options>
The common PC formats are `ibm720` and `ibm1440`, but there are _many_ others,
and there's too many configuration options to usefully list. Try `fluxengine
write ibm1440 --config` to see a sample configuration.
and there's too many configuration options to usefully list. Use `fluxengine
write` to list all formats, and try `fluxengine write ibm1440 --config` to see
a sample configuration.
Mixed-format disks
------------------

View File

@@ -24,6 +24,8 @@ message OutputProto {
}
message ConfigProto {
optional string comment = 8;
optional InputProto input = 1;
optional OutputProto output = 2;
optional EncoderProto encoder = 3;

View File

@@ -14,6 +14,8 @@ message ImgInputOutputProto {
repeated TrackdataProto trackdata = 4 [(help) = "per-track format information (repeatable)"];
optional int32 tracks = 5 [default=80, (help) = "number of tracks in image"];
optional int32 sides = 6 [default=2, (help) = "number of sides in image"];
optional int32 physical_offset = 7 [default=0, (help) = "logical:physical track offset"];
optional int32 physical_step = 8 [default=1, (help) = "logical:physical track step"];
}
message DiskCopyInputProto {}

View File

@@ -39,7 +39,7 @@ public:
sector.reset(new Sector);
sector->status = Sector::OK;
sector->logicalTrack = track;
sector->physicalTrack = track;
sector->physicalTrack = track * _config.img().physical_step() + _config.img().physical_offset();
sector->logicalSide = sector->physicalSide = side;
sector->logicalSector = sectorId;
sector->data = data;

View File

@@ -390,6 +390,10 @@ WRITABLES="\
brother240 \
ibm1440 \
ibm720 \
ibm180_525 \
ibm360_525 \
ibm720_525 \
ibm1200_525 \
commodore1541 \
commodore1581 \
hplif770 \

View File

@@ -1,4 +1,6 @@
#include "globals.h"
#include "proto.h"
#include "fmt/format.h"
typedef int command_cb(int agrc, const char* argv[]);
@@ -88,7 +90,7 @@ static int mainAnalyse(int argc, const char* argv[])
static int mainTest(int argc, const char* argv[])
{ return mainExtended(testables, "test", argc, argv); }
static void help()
static void globalHelp()
{
std::cout << "fluxengine: syntax: fluxengine <command> [<flags>...]\n"
"Try one of these commands:\n";
@@ -106,7 +108,12 @@ void showProfiles(const std::string& command, const std::map<std::string, std::s
"Available profiles include:\n";
for (const auto& it : profiles)
std::cout << " " << it.first << '\n';
{
ConfigProto config;
if (!config.ParseFromString(it.second))
Error() << "couldn't load config proto";
std::cout << fmt::format(" {}: {}\n", it.first, config.comment());
}
std::cout << "Or use a text file containing your own configuration.\n";
exit(1);
@@ -115,11 +122,11 @@ void showProfiles(const std::string& command, const std::map<std::string, std::s
int main(int argc, const char* argv[])
{
if (argc == 1)
help();
globalHelp();
std::string command = argv[1];
if (command == "--help")
help();
globalHelp();
for (Command& c : commands)
{

View File

@@ -1,3 +1,5 @@
comment: 'Acorn ADFS L/D/E/F 640kB/800kB/1600kB 3.5" or 5.25" 80-track double-sided'
input {
flux {
drive {}

View File

@@ -1,3 +1,5 @@
comment: 'Acorn DFS 100kB/200kB 3.5" or 5.25" 40- or 80-track singled sided'
input {
flux {
drive {}

View File

@@ -1,3 +1,5 @@
comment: 'AES Lanier "No Problem" 616kB 5.25" 77-track single sided hard sectored'
input {
flux {
drive {}

View File

@@ -1,3 +1,5 @@
comment: 'Amiga 880kB 3.5" double sided'
input {
flux {
drive {}

View File

@@ -1,3 +1,5 @@
comment: 'Ampro 400kB/800kB 5.25" 40/80 track double sided'
input {
flux {
drive {}

View File

@@ -1,3 +1,5 @@
comment: 'Apple II 140kB DOS 3.3 5.25" 40 track single sided'
input {
flux {
drive {}
@@ -18,6 +20,7 @@ decoder {
cylinders {
start: 0
end: 79
step: 2
}
heads {

View File

@@ -1,3 +1,5 @@
comment: 'Atari ST any 3.5" double sided'
input {
flux {
drive {}

View File

@@ -1,3 +1,4 @@
comment: 'Brother 120kB/240kB 3.5" GCR'
input {
flux {
drive {}

View File

@@ -1,3 +1,5 @@
comment: 'Commodore 1541 170kB 5.25" GCR disks'
input {
flux {
drive {}

View File

@@ -1,3 +1,5 @@
comment: 'Commodore 1581 800kB 3.5" MFM disks'
input {
flux {
drive {}

View File

@@ -1,3 +1,5 @@
comment: 'VDS Eco1 1210kB 77-track mixed format double sided'
input {
flux {
drive {}
@@ -36,7 +38,7 @@ decoder {
cylinders {
start: 0
end: 81
end: 76
}
heads {

View File

@@ -1,3 +1,5 @@
comment: 'Durango F85 461kB 5.25" 77-track single sided'
input {
flux {
drive {}

View File

@@ -1,3 +1,5 @@
comment: 'Brother FB-100 100kB 3.5" 40-track single-sided'
input {
flux {
drive {}

View File

@@ -1,3 +1,5 @@
comment: 'PC 3.5"/5.25" any double sided format'
input {
flux {
drive {}

View File

@@ -1,3 +1,5 @@
comment: 'Macintosh 800kB 3.5" GCR double-sided'
input {
flux {
drive {}

View File

@@ -1,3 +1,5 @@
comment: 'Micropolis MetaFloppy 630kB 5.25" double-sided hard-sectored'
input {
flux {
drive {

View File

@@ -1,3 +1,5 @@
comment: 'DVK MX 110kB/220kB/440kB 5.25"'
input {
flux {
drive {}

View File

@@ -1,3 +1,5 @@
comment: 'Texas Instruments DS990 1126kB 8" double-sided'
input {
flux {
drive {}

View File

@@ -1,3 +1,5 @@
comment: 'Victor 9000 / Sirius One 1224kB GCR variable sector double-sided'
input {
flux {
drive {}

View File

@@ -1,3 +1,5 @@
comment: 'Zilog MCZ 320kB 8" 77-track single-sided hard-sectored'
input {
flux {
drive {}

View File

@@ -1,3 +1,5 @@
comment: 'Amiga 880kB 3.5" double sided'
input {
image {
filename: "amiga.adf"

View File

@@ -1,3 +1,5 @@
comment: 'Atari ST 360kB 3.5" 80-track 9-sector single sided'
input {
image {
filename: "atarist360.st"

View File

@@ -1,3 +1,5 @@
comment: 'Atari ST 370kB 3.5" 82-track 9-sector single sided'
input {
image {
filename: "atarist370.st"

View File

@@ -1,3 +1,5 @@
comment: 'Atari ST 400kB 3.5" 80-track 10-sector single sided'
input {
image {
filename: "atarist400.st"

View File

@@ -1,3 +1,5 @@
comment: 'Atari ST 410kB 3.5" 82-track 10-sector single sided'
input {
image {
filename: "atarist410.st"

View File

@@ -1,3 +1,5 @@
comment: 'Atari ST 720kB 3.5" 80-track 9-sector double sided'
input {
image {
filename: "atarist720.st"

View File

@@ -1,3 +1,5 @@
comment: 'Atari ST 740kB 3.5" 82-track 9-sector double sided'
input {
image {
filename: "atarist740.st"

View File

@@ -1,3 +1,5 @@
comment: 'Atari ST 800kB 3.5" 80-track 10-sector double sided'
input {
image {
filename: "atarist800.st"

View File

@@ -1,3 +1,5 @@
comment: 'Atari ST 820kB 3.5" 82-track 10-sector double sided'
input {
image {
filename: "atarist820.st"

View File

@@ -1,3 +1,5 @@
comment: 'Brother 120kB 3.5" 39-track GCR disks'
input {
image {
filename: "brother120.img"

View File

@@ -1,3 +1,5 @@
comment: 'Brother 240kB 3.5" 78-track GCR disks'
input {
image {
filename: "brother240.img"
@@ -24,7 +26,7 @@ encoder {
cylinders {
start: 0
end: 80
end: 77
}
heads {

View File

@@ -1,3 +1,5 @@
comment: 'Commodore 1541 170kB 5.25" GCR disks'
input {
image {
filename: "commodore1541.img"

View File

@@ -1,3 +1,5 @@
comment: 'Commodore 1581 800kB 3.5" MFM disks'
input {
image {
filename: "commodore1581.d81"

View File

@@ -1,3 +1,5 @@
comment: 'Hewlett-Packard LIF 770kB 3.5" disks'
input {
image {
filename: "hplif770.img"

View File

@@ -0,0 +1,42 @@
comment: 'PC 1200kB 5.25" 80-track 15-sector double-sided'
input {
image {
filename: "ibm1200_525.img"
img {
tracks: 80
sides: 2
trackdata {
sectors: 15
sector_size: 512
}
}
}
}
output {
flux {
drive {}
}
}
encoder {
ibm {
trackdata {
track_length_ms: 167
clock_rate_khz: 500
sector_skew: "0123456789abcde"
}
}
}
cylinders {
start: 0
end: 79
}
heads {
start: 0
end: 1
}

View File

@@ -1,3 +1,5 @@
comment: 'PC 1440kB 3.5" 80-track 18-sector double-sided'
input {
image {
filename: "ibm1440.img"

View File

@@ -0,0 +1,43 @@
comment: 'PC 180kB 5.25" 40-track 9-sector single-sided'
input {
image {
filename: "ibm180_525.img"
img {
tracks: 40
sides: 1
physical_step: 2
trackdata {
sectors: 9
sector_size: 512
}
}
}
}
output {
flux {
drive {}
}
}
encoder {
ibm {
trackdata {
track_length_ms: 167
clock_rate_khz: 300
sector_skew: "012345678"
}
}
}
cylinders {
start: 0
end: 79
}
heads {
start: 0
end: 0
}

View File

@@ -0,0 +1,43 @@
comment: 'PC 360kB 5.25" 40-track 9-sector double-sided'
input {
image {
filename: "ibm360_525.img"
img {
tracks: 40
sides: 2
physical_step: 2
trackdata {
sectors: 9
sector_size: 512
}
}
}
}
output {
flux {
drive {}
}
}
encoder {
ibm {
trackdata {
track_length_ms: 167
clock_rate_khz: 300
sector_skew: "012345678"
}
}
}
cylinders {
start: 0
end: 79
}
heads {
start: 0
end: 1
}

View File

@@ -1,3 +1,5 @@
comment: 'PC 720kB 3.5" 80-track 9-sector double-sided'
input {
image {
filename: "ibm720.img"

View File

@@ -0,0 +1,42 @@
comment: 'PC 720kB 5.25" 80-track 9-sector double-sided'
input {
image {
filename: "ibm720_525.img"
img {
tracks: 80
sides: 2
trackdata {
sectors: 9
sector_size: 512
}
}
}
}
output {
flux {
drive {}
}
}
encoder {
ibm {
trackdata {
track_length_ms: 167
clock_rate_khz: 300
sector_skew: "012345678"
}
}
}
cylinders {
start: 0
end: 79
}
heads {
start: 0
end: 1
}

View File

@@ -1,3 +1,5 @@
comment: 'Macintosh 800kB 3.5" GCR double-sided'
input {
image {
filename: "macintosh.diskcopy"

View File

@@ -1,3 +1,5 @@
comment: 'Texas Instruments DS990 1126kB 8" double-sided'
input {
image {
filename: "tids990.img"