From 6040a46b985448db3293d56122dc194f1e80d286 Mon Sep 17 00:00:00 2001 From: Lars Brinkhoff Date: Wed, 22 Jan 2025 12:52:43 +0100 Subject: [PATCH 1/3] MINI-DUMPER doesn't have a saveset timestamp. --- dumper.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dumper.c b/dumper.c index bd6df1b..e700cfe 100644 --- a/dumper.c +++ b/dumper.c @@ -440,8 +440,11 @@ read_tape_header (FILE *f, word_t word) //fprintf (stderr, "006: %012llo format\n", data[0]); read_asciz (name, &data[3]); - fprintf (stderr, "DUMPER tape #%d, %s, ", right (block[2]), name); - print_timestamp (stderr, data[2]); + fprintf (stderr, "DUMPER tape #%d, %s", right (block[2]), name); + if (format > 0) { + fputs (", ", stderr); + print_timestamp (stderr, data[2]); + } fputc ('\n', stderr); return word; From 2b48288a49b593cf7b4fa8f6c22bd9127c51f8b7 Mon Sep 17 00:00:00 2001 From: Lars Brinkhoff Date: Wed, 22 Jan 2025 10:07:45 +0100 Subject: [PATCH 2/3] MINI-DUMPER file metadata is in the trailer. --- dumper.c | 72 +++++++++++++++++++++++++++----------------------------- 1 file changed, 35 insertions(+), 37 deletions(-) diff --git a/dumper.c b/dumper.c index e700cfe..68f5e55 100644 --- a/dumper.c +++ b/dumper.c @@ -65,6 +65,7 @@ static int record_number; static int format; static int word_bytes; static word_t file_bytes; +static word_t file_octets; /* Format: @@ -450,57 +451,54 @@ read_tape_header (FILE *f, word_t word) return word; } +static void +print_info (FILE *f, word_t *fdb) +{ + int bits_per_byte, file_words; + + print_timestamp (f, fdb[5]); + fprintf (f, " %4d", right (fdb[011])); + file_bytes = fdb[012]; + bits_per_byte = (fdb[011] >> 24) & 077; + word_bytes = bits_per_byte ? 36 / bits_per_byte : 0; + file_words = file_bytes / word_bytes; + file_octets = 5 * file_words; + file_octets += ((file_bytes % word_bytes) * bits_per_byte + 7) / 8; + fprintf (f, " %lld(%d)\n", + file_bytes, bits_per_byte); +} + static void read_file (int offset) { - int bits_per_byte; char *p; if (offset != 0206) { + if (format == 0) + print_info (stderr, block + offset); + if (output != NULL) close_file (); - return; } + else + { + read_asciz (file_path, &data[0]); - read_asciz (file_path, &data[0]); - - p = strchr (file_path, ';'); - if (format == 0 && p != NULL) - p = strchr (p + 1, ';'); - if (p) - *p = 0; - - fprintf (stderr, " %-40s", file_path); - print_timestamp (stderr, block[offset + 5]); - fprintf (stderr, " %4d", right (block[offset + 011])); - file_bytes = block[offset + 012]; - bits_per_byte = (block[offset + 011] >> 24) & 077; - word_bytes = bits_per_byte ? 36 / bits_per_byte : 0; - fprintf (stderr, " %lld(%d)\n", - file_bytes, bits_per_byte); + p = strchr (file_path, ';'); + if (format == 0 && p != NULL) + p = strchr (p + 1, ';'); + if (p) + *p = 0; - if (extract) - open_file (); + fprintf (stderr, " %-40s", file_path); -#if 0 - fprintf (stderr, "006: %012llo file file_path\n", data[0]); - fprintf (stderr, "Timestamp, last write: "); - print_timestamp (stderr, block[offset + 5]); - fputc ('\n', stderr); - fprintf (stderr, "Timestamp, creation: "); - print_timestamp (stderr, block[offset + 013]); - fputc ('\n', stderr); - fprintf (stderr, "Timestamp, user write: "); - print_timestamp (stderr, block[offset + 014]); - fputc ('\n', stderr); - fprintf (stderr, "Timestamp, last nonwrite: "); - print_timestamp (stderr, block[offset + 015]); - fputc ('\n', stderr); + if (format > 0) + print_info (stderr, block + offset); - for (i = offset; i < offset + 030; i++) - fprintf (stderr, "%03o: %012llo\n", i, block[i]); -#endif + if (extract) + open_file (); + } } static void From 7544bfe95ced79c521a4ddceb69c053adb18a98f Mon Sep 17 00:00:00 2001 From: Lars Brinkhoff Date: Wed, 22 Jan 2025 10:27:50 +0100 Subject: [PATCH 3/3] Find saveset name for DUMPER formats 5-6. --- dumper.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/dumper.c b/dumper.c index 68f5e55..e014519 100644 --- a/dumper.c +++ b/dumper.c @@ -435,12 +435,21 @@ static word_t read_tape_header (FILE *f, word_t word) { char name[100]; + int bfmsg; word = read_record (f, word); //fprintf (stderr, "006: %012llo format\n", data[0]); - read_asciz (name, &data[3]); + if (format == 0) + bfmsg = 0; + else { + bfmsg = data[1]; + if (bfmsg == 0) + bfsmsg = format > 4 ? 10 : 3; + } + + read_asciz (name, &data[bfmsg]); fprintf (stderr, "DUMPER tape #%d, %s", right (block[2]), name); if (format > 0) { fputs (", ", stderr); @@ -722,7 +731,7 @@ write_tape (FILE *f) struct word_format *tmp = input_word_format; input_word_format = output_word_format; output_word_format = tmp; - int i, bfmsg = 0; + int i, bfmsg; if (f == NULL) f = stdout; @@ -734,13 +743,20 @@ write_tape (FILE *f) if (format == 0) { record_number = 2; + bfmsg = 0; } else { record_number = 1; data[bfmsg++] = format; - bfmsg++; + bfmsg++; // Filled in below. data[bfmsg++] = tops20_timestamp (time (NULL)); + if (format > 4) + { + // Unknown fields for now. + memset(data + bfmsg, 0, 13 * sizeof (word_t)); + bfmsg += 13; + } data[1] = bfmsg; } write_asciz ("Saveset name", data + bfmsg);