mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-31 11:17:01 -07:00
Remove the obsolete northstar image writer and update the profiles.
This commit is contained in:
@@ -32,9 +32,12 @@ fluxengine read northstar
|
||||
To read a single-sided North Star floppy, run:
|
||||
|
||||
```
|
||||
fluxengine read northstar -heads 0
|
||||
fluxengine read <format> -heads 0
|
||||
```
|
||||
|
||||
...where `<format>` is `northstar87`, `northstar175` or `northstar350`
|
||||
depending on the format you want to read.
|
||||
|
||||
You should end up with a `northstar.nsi` with a file size dependent on the floppy
|
||||
disk type:
|
||||
|
||||
|
||||
@@ -23,9 +23,6 @@ std::unique_ptr<ImageWriter> ImageWriter::create(const ImageWriterProto& config)
|
||||
#if 0
|
||||
case ImageWriterProto::kDiskcopy:
|
||||
return ImageWriter::createDiskCopyImageWriter(config);
|
||||
|
||||
case ImageWriterProto::kNsi:
|
||||
return ImageWriter::createNsiImageWriter(config);
|
||||
#endif
|
||||
|
||||
default:
|
||||
@@ -45,7 +42,7 @@ void ImageWriter::updateConfigForFilename(ImageWriterProto* proto, const std::st
|
||||
{".img", [&]() { proto->mutable_img(); }},
|
||||
{".ldbs", [&]() { proto->mutable_ldbs(); }},
|
||||
{".st", [&]() { proto->mutable_img(); }},
|
||||
{".nsi", [&]() { proto->mutable_nsi(); }},
|
||||
{".nsi", [&]() { proto->mutable_img(); }},
|
||||
};
|
||||
|
||||
for (const auto& it : formats)
|
||||
|
||||
@@ -5,7 +5,6 @@ import "lib/common.proto";
|
||||
|
||||
message LDBSOutputProto {}
|
||||
message DiskCopyOutputProto {}
|
||||
message NsiOutputProto {}
|
||||
|
||||
message ImageWriterProto {
|
||||
optional string filename = 1 [(help) = "filename of output sector image"];
|
||||
@@ -13,7 +12,6 @@ message ImageWriterProto {
|
||||
ImgInputOutputProto img = 2;
|
||||
LDBSOutputProto ldbs = 4;
|
||||
DiskCopyOutputProto diskcopy = 5;
|
||||
NsiOutputProto nsi = 6;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
#include "globals.h"
|
||||
#include "flags.h"
|
||||
#include "sector.h"
|
||||
#include "sectorset.h"
|
||||
#include "imagewriter/imagewriter.h"
|
||||
#include "fmt/format.h"
|
||||
#include "decoders/decoders.h"
|
||||
#include "arch/northstar/northstar.h"
|
||||
#include "lib/imagewriter/imagewriter.pb.h"
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
class NsiImageWriter : public ImageWriter
|
||||
{
|
||||
public:
|
||||
NsiImageWriter(const ImageWriterProto& config):
|
||||
ImageWriter(config)
|
||||
{}
|
||||
|
||||
void writeImage(const SectorSet& sectors)
|
||||
{
|
||||
unsigned autoTracks;
|
||||
unsigned autoSides;
|
||||
unsigned autoSectors;
|
||||
unsigned autoBytes;
|
||||
sectors.calculateSize(autoTracks, autoSides, autoSectors, autoBytes);
|
||||
|
||||
size_t trackSize = autoSectors * autoBytes;
|
||||
|
||||
std::cout << fmt::format("Writing {} cylinders, {} heads, {} sectors, {} ({} bytes/sector), {} kB total",
|
||||
autoTracks, autoSides,
|
||||
autoSectors, autoBytes == 256 ? "SD" : "DD", autoBytes,
|
||||
autoTracks * trackSize / 1024)
|
||||
<< std::endl;
|
||||
|
||||
std::ofstream outputFile(_config.filename(), std::ios::out | std::ios::binary);
|
||||
if (!outputFile.is_open())
|
||||
Error() << "cannot open output file";
|
||||
|
||||
unsigned sectorFileOffset;
|
||||
for (int track = 0; track < autoTracks * autoSides; track++)
|
||||
{
|
||||
int head = (track < autoTracks) ? 0 : 1;
|
||||
for (int sectorId = 0; sectorId < autoSectors; sectorId++)
|
||||
{
|
||||
const auto& sector = sectors.get(track % autoTracks, head, sectorId);
|
||||
if (sector)
|
||||
{
|
||||
if (head == 0) { /* Side 0 is from track 0-34 */
|
||||
sectorFileOffset = track * trackSize + sectorId * autoBytes;
|
||||
}
|
||||
else { /* Side 1 is from track 70-35 */
|
||||
sectorFileOffset = (autoBytes * autoSectors * autoTracks) + /* Skip over side 0 */
|
||||
((autoTracks - 1) - (track % autoTracks)) * (autoBytes * autoSectors) +
|
||||
(sectorId * autoBytes); /* Sector offset from beginning of track. */
|
||||
}
|
||||
outputFile.seekp(sectorFileOffset, std::ios::beg);
|
||||
sector->data.slice(0, autoBytes).writeTo(outputFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void putBlock(size_t offset, size_t length, const Bytes& data)
|
||||
{ throw "unimplemented"; }
|
||||
};
|
||||
|
||||
std::unique_ptr<ImageWriter> ImageWriter::createNsiImageWriter(
|
||||
const ImageWriterProto& config)
|
||||
{
|
||||
return std::unique_ptr<ImageWriter>(new NsiImageWriter(config));
|
||||
}
|
||||
@@ -351,7 +351,6 @@ buildlibrary libbackend.a \
|
||||
lib/imagewriter/imagewriter.cc \
|
||||
lib/imagewriter/imgimagewriter.cc \
|
||||
lib/imagewriter/ldbsimagewriter.cc \
|
||||
lib/imagewriter/nsiimagewriter.cc \
|
||||
lib/ldbs.cc \
|
||||
lib/proto.cc \
|
||||
lib/reader.cc \
|
||||
@@ -384,7 +383,9 @@ READABLES="\
|
||||
macintosh \
|
||||
micropolis \
|
||||
mx \
|
||||
northstar \
|
||||
northstar87 \
|
||||
northstar175 \
|
||||
northstar350 \
|
||||
tids990 \
|
||||
victor9k \
|
||||
zilogmcz \
|
||||
|
||||
43
src/readables/northstar175.textpb
Normal file
43
src/readables/northstar175.textpb
Normal file
@@ -0,0 +1,43 @@
|
||||
comment: 'Northstar 175kB 5.25" 35-track single-sided double-density hard-sectored'
|
||||
|
||||
input {
|
||||
flux {
|
||||
drive {
|
||||
hard_sector_count: 10
|
||||
sync_with_index: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
output {
|
||||
image {
|
||||
filename: "northstar.nsi"
|
||||
img {}
|
||||
}
|
||||
}
|
||||
|
||||
decoder {
|
||||
northstar {}
|
||||
}
|
||||
|
||||
geometry {
|
||||
cylinders: 35
|
||||
heads: 1
|
||||
block_ordering: ORDER_NSI
|
||||
trackdata {
|
||||
sectors: 10
|
||||
sector_size: 512
|
||||
}
|
||||
}
|
||||
|
||||
cylinders {
|
||||
start: 0
|
||||
end: 39
|
||||
}
|
||||
|
||||
heads {
|
||||
start: 0
|
||||
end: 0
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
comment: 'Northstar 87kB/175kB/350kB 5.25" 35-track 10-sector hard sectored'
|
||||
comment: 'Northstar 350kB 5.25" 35-track double-sided double-density hard-sectored'
|
||||
|
||||
input {
|
||||
flux {
|
||||
@@ -12,7 +12,7 @@ input {
|
||||
output {
|
||||
image {
|
||||
filename: "northstar.nsi"
|
||||
nsi {}
|
||||
img {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,9 +20,19 @@ decoder {
|
||||
northstar {}
|
||||
}
|
||||
|
||||
geometry {
|
||||
cylinders: 35
|
||||
heads: 2
|
||||
block_ordering: ORDER_NSI
|
||||
trackdata {
|
||||
sectors: 10
|
||||
sector_size: 512
|
||||
}
|
||||
}
|
||||
|
||||
cylinders {
|
||||
start: 0
|
||||
end: 34
|
||||
end: 39
|
||||
}
|
||||
|
||||
heads {
|
||||
42
src/readables/northstar87.textpb
Normal file
42
src/readables/northstar87.textpb
Normal file
@@ -0,0 +1,42 @@
|
||||
comment: 'Northstar 87.5kB 5.25" 35-track single-sided single-density hard-sectored'
|
||||
|
||||
input {
|
||||
flux {
|
||||
drive {
|
||||
hard_sector_count: 10
|
||||
sync_with_index: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
output {
|
||||
image {
|
||||
filename: "northstar.nsi"
|
||||
img {}
|
||||
}
|
||||
}
|
||||
|
||||
decoder {
|
||||
northstar {}
|
||||
}
|
||||
|
||||
geometry {
|
||||
cylinders: 35
|
||||
heads: 1
|
||||
block_ordering: ORDER_NSI
|
||||
trackdata {
|
||||
sectors: 10
|
||||
sector_size: 256
|
||||
}
|
||||
}
|
||||
|
||||
cylinders {
|
||||
start: 0
|
||||
end: 39
|
||||
}
|
||||
|
||||
heads {
|
||||
start: 0
|
||||
end: 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user