mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-31 11:17:01 -07:00
Convert the Amiga encoder and decoder to the new system.
This commit is contained in:
@@ -12,10 +12,13 @@
|
|||||||
class Sector;
|
class Sector;
|
||||||
class Fluxmap;
|
class Fluxmap;
|
||||||
class SectorSet;
|
class SectorSet;
|
||||||
|
class AmigaInputProto;
|
||||||
|
class AmigaOutputProto;
|
||||||
|
|
||||||
class AmigaDecoder : public AbstractDecoder
|
class AmigaDecoder : public AbstractDecoder
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
AmigaDecoder(const AmigaInputProto&) {}
|
||||||
virtual ~AmigaDecoder() {}
|
virtual ~AmigaDecoder() {}
|
||||||
|
|
||||||
RecordType advanceToNextRecord();
|
RecordType advanceToNextRecord();
|
||||||
@@ -27,13 +30,16 @@ public:
|
|||||||
class AmigaEncoder : public AbstractEncoder
|
class AmigaEncoder : public AbstractEncoder
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
AmigaEncoder(const AmigaOutputProto& config):
|
||||||
|
_config(config) {}
|
||||||
virtual ~AmigaEncoder() {}
|
virtual ~AmigaEncoder() {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::unique_ptr<Fluxmap> encode(int physicalTrack, int physicalSide, const SectorSet& allSectors);
|
std::unique_ptr<Fluxmap> encode(int physicalTrack, int physicalSide, const SectorSet& allSectors);
|
||||||
};
|
|
||||||
|
|
||||||
extern FlagGroup amigaEncoderFlags;
|
private:
|
||||||
|
const AmigaOutputProto& _config;
|
||||||
|
};
|
||||||
|
|
||||||
extern uint32_t amigaChecksum(const Bytes& bytes);
|
extern uint32_t amigaChecksum(const Bytes& bytes);
|
||||||
extern Bytes amigaInterleave(const Bytes& input);
|
extern Bytes amigaInterleave(const Bytes& input);
|
||||||
|
|||||||
13
arch/amiga/amiga.proto
Normal file
13
arch/amiga/amiga.proto
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
syntax = "proto2";
|
||||||
|
|
||||||
|
import "lib/common.proto";
|
||||||
|
|
||||||
|
message AmigaInputProto {}
|
||||||
|
|
||||||
|
message AmigaOutputProto {
|
||||||
|
optional double clock_rate_us = 1
|
||||||
|
[default=2.00, (help)="Encoded data clock rate."];
|
||||||
|
optional double post_index_gap_ms = 2
|
||||||
|
[default=0.5, (help)="Post-index gap before first sector header."];
|
||||||
|
}
|
||||||
|
|
||||||
@@ -4,6 +4,7 @@
|
|||||||
#include "decoders/decoders.h"
|
#include "decoders/decoders.h"
|
||||||
#include "encoders/encoders.h"
|
#include "encoders/encoders.h"
|
||||||
#include "arch/aeslanier/aeslanier.h"
|
#include "arch/aeslanier/aeslanier.h"
|
||||||
|
#include "arch/amiga/amiga.h"
|
||||||
#include "arch/brother/brother.h"
|
#include "arch/brother/brother.h"
|
||||||
#include "arch/ibm/ibm.h"
|
#include "arch/ibm/ibm.h"
|
||||||
#include "decoders/fluxmapreader.h"
|
#include "decoders/fluxmapreader.h"
|
||||||
@@ -23,6 +24,9 @@ std::unique_ptr<AbstractDecoder> AbstractDecoder::create(const DecoderProto& con
|
|||||||
case DecoderProto::kAeslanier:
|
case DecoderProto::kAeslanier:
|
||||||
return std::unique_ptr<AbstractDecoder>(new AesLanierDecoder(config.aeslanier()));
|
return std::unique_ptr<AbstractDecoder>(new AesLanierDecoder(config.aeslanier()));
|
||||||
|
|
||||||
|
case DecoderProto::kAmiga:
|
||||||
|
return std::unique_ptr<AbstractDecoder>(new AmigaDecoder(config.amiga()));
|
||||||
|
|
||||||
case DecoderProto::kBrother:
|
case DecoderProto::kBrother:
|
||||||
return std::unique_ptr<AbstractDecoder>(new BrotherDecoder(config.brother()));
|
return std::unique_ptr<AbstractDecoder>(new BrotherDecoder(config.brother()));
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
syntax = "proto2";
|
syntax = "proto2";
|
||||||
|
|
||||||
|
import "arch/aeslanier/aeslanier.proto";
|
||||||
|
import "arch/amiga/amiga.proto";
|
||||||
import "arch/brother/brother.proto";
|
import "arch/brother/brother.proto";
|
||||||
import "arch/ibm/ibm.proto";
|
import "arch/ibm/ibm.proto";
|
||||||
import "arch/aeslanier/aeslanier.proto";
|
|
||||||
|
|
||||||
message DecoderProto {
|
message DecoderProto {
|
||||||
optional double pulse_debounce_threshold = 1 [default = 0.30];
|
optional double pulse_debounce_threshold = 1 [default = 0.30];
|
||||||
@@ -14,6 +15,7 @@ message DecoderProto {
|
|||||||
IBMInputProto ibm = 5;
|
IBMInputProto ibm = 5;
|
||||||
BrotherInputProto brother = 6;
|
BrotherInputProto brother = 6;
|
||||||
AesLanierInputProto aeslanier = 7;
|
AesLanierInputProto aeslanier = 7;
|
||||||
|
AmigaInputProto amiga = 8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#include "fluxmap.h"
|
#include "fluxmap.h"
|
||||||
#include "decoders/decoders.h"
|
#include "decoders/decoders.h"
|
||||||
#include "encoders/encoders.h"
|
#include "encoders/encoders.h"
|
||||||
|
#include "arch/amiga/amiga.h"
|
||||||
#include "arch/brother/brother.h"
|
#include "arch/brother/brother.h"
|
||||||
#include "arch/ibm/ibm.h"
|
#include "arch/ibm/ibm.h"
|
||||||
#include "lib/encoders/encoders.pb.h"
|
#include "lib/encoders/encoders.pb.h"
|
||||||
@@ -11,6 +12,9 @@ std::unique_ptr<AbstractEncoder> AbstractEncoder::create(const EncoderProto& con
|
|||||||
{
|
{
|
||||||
switch (config.format_case())
|
switch (config.format_case())
|
||||||
{
|
{
|
||||||
|
case EncoderProto::kAmiga:
|
||||||
|
return std::unique_ptr<AbstractEncoder>(new AmigaEncoder(config.amiga()));
|
||||||
|
|
||||||
case EncoderProto::kIbm:
|
case EncoderProto::kIbm:
|
||||||
return std::unique_ptr<AbstractEncoder>(new IbmEncoder(config.ibm()));
|
return std::unique_ptr<AbstractEncoder>(new IbmEncoder(config.ibm()));
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
syntax = "proto2";
|
syntax = "proto2";
|
||||||
|
|
||||||
|
import "arch/amiga/amiga.proto";
|
||||||
import "arch/brother/brother.proto";
|
import "arch/brother/brother.proto";
|
||||||
import "arch/ibm/ibm.proto";
|
import "arch/ibm/ibm.proto";
|
||||||
//import "lib/common.proto";
|
//import "lib/common.proto";
|
||||||
@@ -8,5 +9,6 @@ message EncoderProto {
|
|||||||
oneof format {
|
oneof format {
|
||||||
IBMOutputProto ibm = 3;
|
IBMOutputProto ibm = 3;
|
||||||
BrotherOutputProto brother = 4;
|
BrotherOutputProto brother = 4;
|
||||||
|
AmigaOutputProto amiga = 5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
14
mkninja.sh
14
mkninja.sh
@@ -106,16 +106,19 @@ buildproto() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
local cfiles
|
local cfiles
|
||||||
|
local hfiles
|
||||||
cfiles=
|
cfiles=
|
||||||
|
hfiles=
|
||||||
for src in "$@"; do
|
for src in "$@"; do
|
||||||
local cfile
|
local cfile
|
||||||
local hfile
|
local hfile
|
||||||
cfile="$OBJDIR/proto/${src%%.proto}.pb.cc"
|
cfile="$OBJDIR/proto/${src%%.proto}.pb.cc"
|
||||||
hfile="$OBJDIR/proto/${src%%.proto}.pb.h"
|
hfile="$OBJDIR/proto/${src%%.proto}.pb.h"
|
||||||
cfiles="$cfiles $cfile $hfile"
|
cfiles="$cfiles $cfile"
|
||||||
|
hfiles="$hfiles $hfile"
|
||||||
done
|
done
|
||||||
|
|
||||||
echo build $cfiles $def : proto $@
|
echo build $cfiles $hfiles $def : proto $@
|
||||||
echo " flags=$flags --cpp_out=$OBJDIR/proto"
|
echo " flags=$flags --cpp_out=$OBJDIR/proto"
|
||||||
echo " def=$def"
|
echo " def=$def"
|
||||||
|
|
||||||
@@ -246,6 +249,7 @@ buildlibrary libfmt.a \
|
|||||||
dep/fmt/posix.cc \
|
dep/fmt/posix.cc \
|
||||||
|
|
||||||
buildproto libproto.a \
|
buildproto libproto.a \
|
||||||
|
arch/amiga/amiga.proto \
|
||||||
arch/aeslanier/aeslanier.proto \
|
arch/aeslanier/aeslanier.proto \
|
||||||
arch/brother/brother.proto \
|
arch/brother/brother.proto \
|
||||||
arch/ibm/ibm.proto \
|
arch/ibm/ibm.proto \
|
||||||
@@ -325,6 +329,7 @@ buildlibrary libbackend.a \
|
|||||||
lib/writer.cc \
|
lib/writer.cc \
|
||||||
|
|
||||||
READABLES="\
|
READABLES="\
|
||||||
|
amiga \
|
||||||
aeslanier \
|
aeslanier \
|
||||||
acornadfs \
|
acornadfs \
|
||||||
acorndfs \
|
acorndfs \
|
||||||
@@ -333,6 +338,7 @@ READABLES="\
|
|||||||
"
|
"
|
||||||
|
|
||||||
WRITABLES="\
|
WRITABLES="\
|
||||||
|
amiga \
|
||||||
brother240 \
|
brother240 \
|
||||||
ibm1440 \
|
ibm1440 \
|
||||||
"
|
"
|
||||||
@@ -376,11 +382,9 @@ buildlibrary libfrontend.a \
|
|||||||
src/fe-writeflux.cc \
|
src/fe-writeflux.cc \
|
||||||
src/fluxengine.cc \
|
src/fluxengine.cc \
|
||||||
|
|
||||||
# src/fe-readamiga.cc \
|
|
||||||
# src/fe-readampro.cc \
|
# src/fe-readampro.cc \
|
||||||
# src/fe-readapple2.cc \
|
# src/fe-readapple2.cc \
|
||||||
# src/fe-readatarist.cc \
|
# src/fe-readatarist.cc \
|
||||||
# src/fe-readbrother.cc \
|
|
||||||
# src/fe-readc64.cc \
|
# src/fe-readc64.cc \
|
||||||
# src/fe-readf85.cc \
|
# src/fe-readf85.cc \
|
||||||
# src/fe-readfb100.cc \
|
# src/fe-readfb100.cc \
|
||||||
@@ -391,8 +395,6 @@ buildlibrary libfrontend.a \
|
|||||||
# src/fe-readtids990.cc \
|
# src/fe-readtids990.cc \
|
||||||
# src/fe-readvictor9k.cc \
|
# src/fe-readvictor9k.cc \
|
||||||
# src/fe-readzilogmcz.cc \
|
# src/fe-readzilogmcz.cc \
|
||||||
# src/fe-writeamiga.cc \
|
|
||||||
# src/fe-writebrother.cc \
|
|
||||||
# src/fe-writeibm.cc \
|
# src/fe-writeibm.cc \
|
||||||
# src/fe-writemac.cc \
|
# src/fe-writemac.cc \
|
||||||
# src/fe-writetids990.cc \
|
# src/fe-writetids990.cc \
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
#include "globals.h"
|
|
||||||
#include "flags.h"
|
|
||||||
#include "reader.h"
|
|
||||||
#include "fluxmap.h"
|
|
||||||
#include "decoders/decoders.h"
|
|
||||||
#include "amiga/amiga.h"
|
|
||||||
#include "sector.h"
|
|
||||||
#include "sectorset.h"
|
|
||||||
#include "record.h"
|
|
||||||
#include "fmt/format.h"
|
|
||||||
#include <fstream>
|
|
||||||
|
|
||||||
static FlagGroup flags { &readerFlags };
|
|
||||||
|
|
||||||
int mainReadAmiga(int argc, const char* argv[])
|
|
||||||
{
|
|
||||||
setReaderDefaultSource(":t=0-79:s=0-1");
|
|
||||||
setReaderDefaultOutput("amiga.adf:c=80:h=2:s=11:b=512");
|
|
||||||
setReaderRevolutions(2);
|
|
||||||
flags.parseFlags(argc, argv);
|
|
||||||
|
|
||||||
AmigaDecoder decoder;
|
|
||||||
readDiskCommand(decoder);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
#include "globals.h"
|
|
||||||
#include "flags.h"
|
|
||||||
#include "decoders/decoders.h"
|
|
||||||
#include "amiga/amiga.h"
|
|
||||||
#include "writer.h"
|
|
||||||
#include "fmt/format.h"
|
|
||||||
#include <fstream>
|
|
||||||
|
|
||||||
static FlagGroup flags { &writerFlags, &amigaEncoderFlags };
|
|
||||||
|
|
||||||
int mainWriteAmiga(int argc, const char* argv[])
|
|
||||||
{
|
|
||||||
setWriterDefaultInput(":c=80:h=2:s=11:b=512");
|
|
||||||
setWriterDefaultDest(":d=0:t=0-79:s=0-1");
|
|
||||||
flags.parseFlags(argc, argv);
|
|
||||||
|
|
||||||
AmigaEncoder encoder;
|
|
||||||
writeDiskCommand(encoder);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
36
src/readables/amiga.textpb
Normal file
36
src/readables/amiga.textpb
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
input {
|
||||||
|
disk {
|
||||||
|
drive {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
output {
|
||||||
|
file {
|
||||||
|
filename: "amiga.adf"
|
||||||
|
img {
|
||||||
|
tracks: 80
|
||||||
|
sides: 2
|
||||||
|
format {
|
||||||
|
sector_size: 512
|
||||||
|
sectors: 11
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
decoder {
|
||||||
|
amiga {}
|
||||||
|
}
|
||||||
|
|
||||||
|
cylinders {
|
||||||
|
start: 0
|
||||||
|
end: 79
|
||||||
|
}
|
||||||
|
|
||||||
|
heads {
|
||||||
|
start: 0
|
||||||
|
end: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
33
src/writables/amiga.textpb
Normal file
33
src/writables/amiga.textpb
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
input {
|
||||||
|
file {
|
||||||
|
filename: "amiga.adf"
|
||||||
|
img {
|
||||||
|
format {
|
||||||
|
sectors: 11
|
||||||
|
sector_size: 512
|
||||||
|
}
|
||||||
|
tracks: 80
|
||||||
|
sides: 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
output {
|
||||||
|
disk {}
|
||||||
|
}
|
||||||
|
|
||||||
|
encoder {
|
||||||
|
amiga {}
|
||||||
|
}
|
||||||
|
|
||||||
|
cylinders {
|
||||||
|
start: 0
|
||||||
|
end: 79
|
||||||
|
}
|
||||||
|
|
||||||
|
heads {
|
||||||
|
start: 0
|
||||||
|
end: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user