diff --git a/Makefile b/Makefile index ec4822e1..e335841f 100644 --- a/Makefile +++ b/Makefile @@ -111,6 +111,7 @@ PROTOS = \ arch/micropolis/micropolis.proto \ arch/mx/mx.proto \ arch/northstar/northstar.proto \ + arch/rolandd20/rolandd20.proto \ arch/smaky6/smaky6.proto \ arch/tids990/tids990.proto \ arch/victor9k/victor9k.proto \ diff --git a/arch/build.mk b/arch/build.mk index 4c4da2b2..89ee8348 100644 --- a/arch/build.mk +++ b/arch/build.mk @@ -24,6 +24,7 @@ LIBARCH_SRCS = \ arch/mx/decoder.cc \ arch/northstar/decoder.cc \ arch/northstar/encoder.cc \ + arch/rolandd20/decoder.cc \ arch/smaky6/decoder.cc \ arch/tids990/decoder.cc \ arch/tids990/encoder.cc \ diff --git a/arch/rolandd20/decoder.cc b/arch/rolandd20/decoder.cc new file mode 100644 index 00000000..f80521e3 --- /dev/null +++ b/arch/rolandd20/decoder.cc @@ -0,0 +1,49 @@ +#include "lib/globals.h" +#include "lib/decoders/decoders.h" +#include "lib/crc.h" +#include "lib/fluxmap.h" +#include "lib/decoders/fluxmapreader.h" +#include "lib/sector.h" +#include "lib/bytes.h" +#include "rolandd20.h" +#include + +/* Sector header record: + * + * BF FF FF FF FF FF FE AB + * + * f f f f f e a b + * 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 + * 1111111111111111111111111111111111111111111111011101110111011111 + * f f f f f f f f f f f d d d d f + */ + +static const FluxPattern SECTOR_PATTERN(64, 0xfffffffffffddddfLL); + +class RolandD20Decoder : public Decoder +{ +public: + RolandD20Decoder(const DecoderProto& config): + Decoder(config) + {} + + nanoseconds_t advanceToNextRecord() override + { + return seekToPattern(SECTOR_PATTERN); + } + + void decodeSectorRecord() override + { + auto rawbits = readRawBits(128); + const auto& bytes = decodeFmMfm(rawbits); + hexdump(std::cout, bytes); + } +}; + +std::unique_ptr createRolandD20Decoder(const DecoderProto& config) +{ + return std::unique_ptr(new RolandD20Decoder(config)); +} + + + diff --git a/arch/rolandd20/rolandd20.h b/arch/rolandd20/rolandd20.h new file mode 100644 index 00000000..7075d035 --- /dev/null +++ b/arch/rolandd20/rolandd20.h @@ -0,0 +1,4 @@ +#pragma once + +extern std::unique_ptr createRolandD20Decoder(const DecoderProto& config); + diff --git a/arch/rolandd20/rolandd20.proto b/arch/rolandd20/rolandd20.proto new file mode 100644 index 00000000..6ff0ef83 --- /dev/null +++ b/arch/rolandd20/rolandd20.proto @@ -0,0 +1,5 @@ +syntax = "proto2"; + +message RolandD20DecoderProto {} + + diff --git a/build.lua b/build.lua index fcdca364..697d0edd 100644 --- a/build.lua +++ b/build.lua @@ -55,6 +55,7 @@ proto_cc_library { "./arch/micropolis/micropolis.proto", "./arch/mx/mx.proto", "./arch/northstar/northstar.proto", + "./arch/rolandd20/rolandd20.proto", "./arch/tids990/tids990.proto", "./arch/victor9k/victor9k.proto", "./arch/zilogmcz/zilogmcz.proto", @@ -93,6 +94,7 @@ clibrary { "./arch/mx/decoder.cc", "./arch/northstar/decoder.cc", "./arch/northstar/encoder.cc", + "./arch/rolandd20/rolandd20.cc", "./arch/tids990/decoder.cc", "./arch/tids990/encoder.cc", "./arch/victor9k/decoder.cc", diff --git a/lib/decoders/decoders.cc b/lib/decoders/decoders.cc index bca7b123..2064521d 100644 --- a/lib/decoders/decoders.cc +++ b/lib/decoders/decoders.cc @@ -16,6 +16,7 @@ #include "arch/micropolis/micropolis.h" #include "arch/mx/mx.h" #include "arch/northstar/northstar.h" +#include "arch/rolandd20/rolandd20.h" #include "arch/smaky6/smaky6.h" #include "arch/tids990/tids990.h" #include "arch/victor9k/victor9k.h" @@ -49,6 +50,7 @@ std::unique_ptr Decoder::create(const DecoderProto& config) {DecoderProto::kMicropolis, createMicropolisDecoder }, {DecoderProto::kMx, createMxDecoder }, {DecoderProto::kNorthstar, createNorthstarDecoder }, + {DecoderProto::kRolandd20, createRolandD20Decoder }, {DecoderProto::kSmaky6, createSmaky6Decoder }, {DecoderProto::kTids990, createTids990Decoder }, {DecoderProto::kVictor9K, createVictor9kDecoder }, diff --git a/lib/decoders/decoders.proto b/lib/decoders/decoders.proto index 1a74e8f4..d861b4eb 100644 --- a/lib/decoders/decoders.proto +++ b/lib/decoders/decoders.proto @@ -13,6 +13,7 @@ import "arch/macintosh/macintosh.proto"; import "arch/micropolis/micropolis.proto"; import "arch/mx/mx.proto"; import "arch/northstar/northstar.proto"; +import "arch/rolandd20/rolandd20.proto"; import "arch/smaky6/smaky6.proto"; import "arch/tids990/tids990.proto"; import "arch/victor9k/victor9k.proto"; @@ -20,7 +21,7 @@ import "arch/zilogmcz/zilogmcz.proto"; import "lib/fluxsink/fluxsink.proto"; import "lib/common.proto"; -//NEXT: 31 +//NEXT: 32 message DecoderProto { optional double pulse_debounce_threshold = 1 [default = 0.30, (help) = "ignore pulses with intervals shorter than this, in fractions of a clock"]; @@ -47,6 +48,7 @@ message DecoderProto { MicropolisDecoderProto micropolis = 14; MxDecoderProto mx = 15; NorthstarDecoderProto northstar = 24; + RolandD20DecoderProto rolandd20 = 31; Smaky6DecoderProto smaky6 = 30; Tids990DecoderProto tids990 = 16; Victor9kDecoderProto victor9k = 17; diff --git a/src/formats/build.mk b/src/formats/build.mk index 92a6be07..211dcc94 100644 --- a/src/formats/build.mk +++ b/src/formats/build.mk @@ -64,6 +64,7 @@ FORMATS = \ northstar350 \ northstar87 \ psos800 \ + rolandd20 \ rx50 \ shugart_drive \ smaky6 \ diff --git a/src/formats/rolandd20.textpb b/src/formats/rolandd20.textpb new file mode 100644 index 00000000..df7deb13 --- /dev/null +++ b/src/formats/rolandd20.textpb @@ -0,0 +1,24 @@ +comment: 'Roland D20' + +image_writer { + filename: "rolandd20.img" + type: IMG +} + +layout { + tracks: 80 + sides: 2 + layoutdata { + sector_size: 512 + physical { + start_sector: 1 + count: 10 + } + } +} + +decoder { + rolandd20 {} +} + +