Skip to content

Commit

Permalink
lbn2pbn: Mention the utility in the top-level README
Browse files Browse the repository at this point in the history
         Add track 0 option (-0) to leave it in place
  • Loading branch information
al20878 committed Nov 14, 2024
1 parent 6e3fbe3 commit dfe3623
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ Directory | Contents
---- | ----
asc | Convert ASCII file line endings
decsys | Convert decimal listing file to a DECtape file
dtos8cvt | Convert a PDP-8 DECtape image from OS/8 format to simulator format.
dtos8cvt | Convert a PDP-8 DECtape image from OS/8 format to simulator format
gt7cvt | Convert a gt7 magtape dump to a SIMH magtape
hpconvert | Convert an HP disc image between SIMH and HPDrive formats
indent | Convert simulator sources to 4-column tabs
lbn2pbn | Logical-to-physical converter for single-sided floppy disk images
littcvt | Remove density maker from litt format tapes
m8376 | Assembles 8 PROM files into a 32bit binary file
mt2tpc | Convert a simh simulated magtape to TPC format
Expand Down
17 changes: 13 additions & 4 deletions converters/lbn2pbn/lbn2pbn.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ static int sector_size = 0;

static int interleave = 0;
static int track_skew = 0;
static int track0 = 0;

static int round = 0;

Expand Down Expand Up @@ -98,7 +99,8 @@ static int lbn2pbn(int lbn)

/* PBN */
sector %= sectors;
track++;
if (!track0)
++track;
track %= tracks;

return track * sectors + sector;
Expand All @@ -111,14 +113,18 @@ __attribute__((noreturn))
static void usage(const char* prog)
{
fprintf(stderr, "%s -T tracks -S sectors -B sector_size"
" -i interleave -k track_skew [-r] infile outfile\n", prog);
" -i interleave -k track_skew [-0] [-r] infile outfile\n",
prog);

fprintf(stderr, "\nTypical parameters:\n"
"RX01: -T 77 -S 26 -B 128 -i 2 -k 6\n"
"RX02 (single density): -T 77 -S 26 -B 128 -i 2 -k 6\n"
"RX02 (double density): -T 77 -S 26 -B 256 -i 2 -k 6\n"
"RX50: -T 80 -S 10 -B 512 -i 2 -k 2\n"
"\nSupported sector sizes (in bytes): 128, 256, 512\n");
"\nSupported sector sizes (in bytes): 128, 256, 512\n\n");

fprintf(stderr, "-0 = To leave track 0 in place (else, wrapped around)\n"
"-r = To do an inverse (PBN to LBN) conversion\n");
exit(2);
}

Expand Down Expand Up @@ -146,7 +152,7 @@ int main(int argc, char* argv[])
int p, q;

p = optind;
while ((q = getopt(argc, argv, "T:S:B:i:k:r")) != EOF) {
while ((q = getopt(argc, argv, "T:S:B:i:k:0r")) != EOF) {
switch (q) {
case 'T':
tracks = atoi(optarg);
Expand All @@ -167,6 +173,9 @@ int main(int argc, char* argv[])
case 'k':
track_skew = atoi(optarg);
break;
case '0':
track0 = 1;
break;
case 'r':
if (!reverse) {
reverse = 1;
Expand Down

0 comments on commit dfe3623

Please sign in to comment.