Convert the C64 decoder to the new configuration scheme. Also convert all the

imagewriters.
This commit is contained in:
David Given
2021-05-15 00:25:32 +02:00
parent ac34a43d9b
commit f7c31281e0
11 changed files with 88 additions and 48 deletions

View File

@@ -7,10 +7,12 @@
class Sector;
class Fluxmap;
class Commodore64InputProto;
class Commodore64Decoder : public AbstractDecoder
{
public:
Commodore64Decoder(const Commodore64InputProto&) {}
virtual ~Commodore64Decoder() {}
RecordType advanceToNextRecord();

4
arch/c64/c64.proto Normal file
View File

@@ -0,0 +1,4 @@
syntax = "proto2";
message Commodore64InputProto {}

View File

@@ -2,18 +2,12 @@ syntax = "proto2";
import "lib/decoders/decoders.proto";
import "lib/encoders/encoders.proto";
import "lib/imagereader/img.proto";
import "lib/imagereader/imagereader.proto";
import "lib/imagewriter/imagewriter.proto";
import "lib/fluxsource/fluxsource.proto";
import "lib/usb/usb.proto";
import "lib/common.proto";
message InputFileProto {
optional string filename = 1;
oneof format {
ImgInputOutputProto img = 2;
}
}
message InputDiskProto {
oneof source {
string fluxfile = 1;
@@ -22,13 +16,6 @@ message InputDiskProto {
}
}
message OutputFileProto {
optional string filename = 1;
oneof format {
ImgInputOutputProto img = 2;
}
}
message OutputDiskProto {
oneof dest {
string fluxfile = 1;

View File

@@ -6,6 +6,7 @@
#include "arch/aeslanier/aeslanier.h"
#include "arch/amiga/amiga.h"
#include "arch/brother/brother.h"
#include "arch/c64/c64.h"
#include "arch/ibm/ibm.h"
#include "decoders/fluxmapreader.h"
#include "record.h"
@@ -30,6 +31,9 @@ std::unique_ptr<AbstractDecoder> AbstractDecoder::create(const DecoderProto& con
case DecoderProto::kBrother:
return std::unique_ptr<AbstractDecoder>(new BrotherDecoder(config.brother()));
case DecoderProto::kC64:
return std::unique_ptr<AbstractDecoder>(new Commodore64Decoder(config.c64()));
case DecoderProto::kIbm:
return std::unique_ptr<AbstractDecoder>(new IbmDecoder(config.ibm()));

View File

@@ -3,6 +3,7 @@ syntax = "proto2";
import "arch/aeslanier/aeslanier.proto";
import "arch/amiga/amiga.proto";
import "arch/brother/brother.proto";
import "arch/c64/c64.proto";
import "arch/ibm/ibm.proto";
message DecoderProto {
@@ -16,6 +17,7 @@ message DecoderProto {
BrotherInputProto brother = 6;
AesLanierInputProto aeslanier = 7;
AmigaInputProto amiga = 8;
Commodore64InputProto c64 = 9;
}
}

View File

@@ -14,3 +14,10 @@ message ImgInputOutputProto {
optional int32 sides = 6 [default=2];
}
message InputFileProto {
optional string filename = 1;
oneof format {
ImgInputOutputProto img = 2;
}
}

View File

@@ -25,10 +25,22 @@ std::map<std::string, ImageWriter::Constructor> ImageWriter::formats =
std::unique_ptr<ImageWriter> ImageWriter::create(const OutputFileProto& config)
{
if (config.has_img())
return ImageWriter::createImgImageWriter(config);
else
Error() << "bad output image config";
switch (config.format_case())
{
case OutputFileProto::kImg:
return ImageWriter::createImgImageWriter(config);
case OutputFileProto::kD64:
return ImageWriter::createD64ImageWriter(config);
case OutputFileProto::kLdbs:
return ImageWriter::createLDBSImageWriter(config);
case OutputFileProto::kDiskcopy:
return ImageWriter::createDiskCopyImageWriter(config);
}
Error() << "bad output image config";
return std::unique_ptr<ImageWriter>();
}
//void ImageWriter::verifyImageSpec(const ImageSpec& spec)

View File

@@ -0,0 +1,18 @@
syntax = "proto2";
import "lib/imagereader/imagereader.proto";
message D64OutputProto {}
message LDBSOutputProto {}
message DiskCopyOutputProto {}
message OutputFileProto {
optional string filename = 1;
oneof format {
ImgInputOutputProto img = 2;
D64OutputProto d64 = 3;
LDBSOutputProto ldbs = 4;
DiskCopyOutputProto diskcopy = 5;
}
}

View File

@@ -252,13 +252,15 @@ buildproto libproto.a \
arch/amiga/amiga.proto \
arch/aeslanier/aeslanier.proto \
arch/brother/brother.proto \
arch/c64/c64.proto \
arch/ibm/ibm.proto \
lib/common.proto \
lib/config.proto \
lib/decoders/decoders.proto \
lib/encoders/encoders.proto \
lib/fluxsource/fluxsource.proto \
lib/imagereader/img.proto \
lib/imagereader/imagereader.proto \
lib/imagewriter/imagewriter.proto \
lib/usb/usb.proto \
buildlibrary libbackend.a \
@@ -334,6 +336,7 @@ READABLES="\
acornadfs \
acorndfs \
brother \
c64 \
ibm \
"
@@ -386,7 +389,6 @@ buildlibrary libfrontend.a \
# src/fe-readampro.cc \
# src/fe-readapple2.cc \
# src/fe-readatarist.cc \
# src/fe-readc64.cc \
# src/fe-readf85.cc \
# src/fe-readfb100.cc \
# src/fe-readibm.cc \

View File

@@ -1,27 +0,0 @@
#include "globals.h"
#include "flags.h"
#include "reader.h"
#include "fluxmap.h"
#include "decoders/decoders.h"
#include "c64/c64.h"
#include "sector.h"
#include "sectorset.h"
#include "record.h"
#include "fmt/format.h"
#include <fstream>
static FlagGroup flags { &readerFlags };
int mainReadC64(int argc, const char* argv[])
{
setReaderDefaultSource(":t=0-79x2:s=0");
setReaderDefaultOutput("c64.d64");
setReaderRevolutions(2);
flags.parseFlags(argc, argv);
Commodore64Decoder decoder;
readDiskCommand(decoder);
return 0;
}

29
src/readables/c64.textpb Normal file
View File

@@ -0,0 +1,29 @@
input {
disk {
drive {}
}
}
output {
file {
filename: "c64.d64"
d64 {}
}
}
decoder {
c64 {}
}
cylinders {
start: 0
end: 79
step: 2
}
heads {
start: 0
end: 0
}