Add boilerplate for the TI DS990 decoder.

This commit is contained in:
David Given
2020-08-20 22:41:14 +02:00
parent cbcf457ce3
commit c375c948c0
5 changed files with 114 additions and 0 deletions

61
arch/tids990/decoder.cc Normal file
View File

@@ -0,0 +1,61 @@
#include "globals.h"
#include "decoders/decoders.h"
#include "tids990/tids990.h"
#include "crc.h"
#include "fluxmap.h"
#include "decoders/fluxmapreader.h"
#include "sector.h"
#include "record.h"
#include "track.h"
#include <string.h>
const int SECTOR_SIZE = 256;
const FluxPattern ID_PATTERN(32, 0xaaaaffaf);
AbstractDecoder::RecordType TiDs990Decoder::advanceToNextRecord()
{
return UNKNOWN_RECORD;
// if (_currentSector == -1)
// {
// /* First sector in the track: look for the sync marker. */
// const FluxMatcher* matcher = nullptr;
// _sector->clock = _clock = _fmr->seekToPattern(ID_PATTERN, matcher);
// readRawBits(32); /* skip the ID mark */
// _logicalTrack = decodeFmMfm(readRawBits(32)).slice(0, 32).reader().read_be16();
// }
// else if (_currentSector == 10)
// {
// /* That was the last sector on the disk. */
// return UNKNOWN_RECORD;
// }
// else
// {
// /* Otherwise we assume the clock from the first sector is still valid.
// * The decoder framwork will automatically stop when we hit the end of
// * the track. */
// _sector->clock = _clock;
// }
//
// _currentSector++;
// return SECTOR_RECORD;
}
void TiDs990Decoder::decodeSectorRecord()
{
// auto bits = readRawBits((SECTOR_SIZE+2)*16);
// auto bytes = decodeFmMfm(bits).slice(0, SECTOR_SIZE+2).swab();
//
// uint16_t gotChecksum = 0;
// ByteReader br(bytes);
// for (int i=0; i<(SECTOR_SIZE/2); i++)
// gotChecksum += br.read_le16();
// uint16_t wantChecksum = br.read_le16();
//
// _sector->logicalTrack = _logicalTrack;
// _sector->logicalSide = _track->physicalSide;
// _sector->logicalSector = _currentSector;
// _sector->data = bytes.slice(0, SECTOR_SIZE);
// _sector->status = (gotChecksum == wantChecksum) ? Sector::OK : Sector::BAD_CHECKSUM;
}

23
arch/tids990/tids990.h Normal file
View File

@@ -0,0 +1,23 @@
#ifndef TIDS990_H
#define TIDS990_H
#define TIDS990_RECORD_SIZE 0x516 /* bytes */
#define TIDS990_ID_SIZE 17
#define TIDS990_PAYLOAD_SIZE 0x500
class Sector;
class Fluxmap;
class Track;
class TiDs990Decoder : public AbstractDecoder
{
public:
virtual ~TiDs990Decoder() {}
RecordType advanceToNextRecord();
void decodeSectorRecord();
};
#endif

View File

@@ -172,6 +172,7 @@ buildlibrary libbackend.a \
arch/ibm/encoder.cc \
arch/macintosh/decoder.cc \
arch/mx/decoder.cc \
arch/tids990/decoder.cc \
arch/victor9k/decoder.cc \
arch/zilogmcz/decoder.cc \
lib/bytes.cc \
@@ -223,6 +224,7 @@ buildlibrary libfrontend.a \
src/fe-readibm.cc \
src/fe-readmac.cc \
src/fe-readmx.cc \
src/fe-readtids990.cc \
src/fe-readvictor9k.cc \
src/fe-readzilogmcz.cc \
src/fe-rpm.cc \

26
src/fe-readtids990.cc Normal file
View File

@@ -0,0 +1,26 @@
#include "globals.h"
#include "flags.h"
#include "reader.h"
#include "fluxmap.h"
#include "decoders/decoders.h"
#include "sector.h"
#include "sectorset.h"
#include "record.h"
#include "tids990/tids990.h"
#include "fmt/format.h"
static FlagGroup flags { &readerFlags };
int mainReadTiDs990(int argc, const char* argv[])
{
setReaderDefaultSource(":t=0-79:s=0");
setReaderDefaultOutput("dfs.img");
setReaderRevolutions(2);
flags.parseFlags(argc, argv);
TiDs990Decoder decoder;
readDiskCommand(decoder);
return 0;
}

View File

@@ -22,6 +22,7 @@ extern command_cb mainReadFB100;
extern command_cb mainReadIBM;
extern command_cb mainReadMac;
extern command_cb mainReadMx;
extern command_cb mainReadTiDs990;
extern command_cb mainReadVictor9K;
extern command_cb mainReadZilogMCZ;
extern command_cb mainRpm;
@@ -77,6 +78,7 @@ static std::vector<Command> readables =
{ "ibm", mainReadIBM, "Reads the ubiquitous IBM format disks.", },
{ "mac", mainReadMac, "Reads Apple Macintosh disks.", },
{ "mx", mainReadMx, "Reads MX disks.", },
{ "tids990", mainReadTiDs990, "Reads Texas Instruments DS990 disks.", },
{ "victor9k", mainReadVictor9K, "Reads Victor 9000 disks.", },
{ "zilogmcz", mainReadZilogMCZ, "Reads Zilog MCZ disks.", },
};