From 97f29f046c5939dc9f5212c27f0b6ebea2c7aeb7 Mon Sep 17 00:00:00 2001 From: Warren Toomey Date: Fri, 11 Mar 2016 10:30:05 +1000 Subject: [PATCH] Moved proto and password to build/ --- tools/password | 2 -- tools/proto | 44 -------------------------------------------- tools/sdump | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 46 deletions(-) delete mode 100644 tools/password delete mode 100644 tools/proto create mode 100755 tools/sdump diff --git a/tools/password b/tools/password deleted file mode 100644 index 4ed5ecf..0000000 --- a/tools/password +++ /dev/null @@ -1,2 +0,0 @@ -ken:ken:ken:12 -dmr:dmr:dmr:14 diff --git a/tools/proto b/tools/proto deleted file mode 100644 index f93dd2c..0000000 --- a/tools/proto +++ /dev/null @@ -1,44 +0,0 @@ -# Prototype file for PDP-7 Unix filesystem layout -# -# Entries are one of: -# filename f[r-][w-][r-][r-] uid local_file_to_insert -# dirname d[r-][w-][r-][r-] uid [inumber] -# device i[r-][w-][r-][r-] uid inumber -# link l---- inumber -# -# The top directory's name is ignored -# Numeric values are in decimal -# Contents of each directory ends with a $ on a line by itself -# Format was inspired by 6th Edition mkfs -# -dd drw-- -1 2 - system drw-- -1 3 - init frwr- -1 ../bin/init - password frw-- -1 password - ttyin irwr- -1 6 - keyboard irwr- -1 7 - pptin irwr- -1 8 - ttyout irwr- -1 10 - display irwr- -1 11 - pptout irwr- -1 12 - sh frwr- -1 ../bin/sh - $ - - as frwr- -1 ../bin/as - cat frwr- -1 ../bin/cat - chmod frwr- -1 ../bin/chmod - chown frwr- -1 ../bin/chown - chrm frwr- -1 ../bin/chrm - cp frwr- -1 ../bin/cp - date frwr- -1 ../bin/date - ds frwr- -1 ../bin/ds - ln frwr- -1 ../bin/ln - ls frwr- -1 ../bin/ls - mv frwr- -1 ../bin/mv - stat frwr- -1 ../bin/stat - ken drwr- 10 - system l---- 3 - $ - dmr drwr- 12 - system l---- 3 - $ diff --git a/tools/sdump b/tools/sdump new file mode 100755 index 0000000..5e8c66c --- /dev/null +++ b/tools/sdump @@ -0,0 +1,46 @@ +#!/usr/bin/perl +# +# sdump: Dump the contents of a filesystem in SimH format +# +# (c) 2016 Warren Toomey, GPL3 +# +use strict; +use warnings; + +### read a word from a file in SimH format +### return -1 on EOF +sub read_word { + my $F = shift; + # Convert four bytes into one 18-bit word + return -1 if ( read( $F, my $four, 4 ) != 4 ); # Not enough bytes read + my ( $b1, $b2, $b3, $b4 ) = unpack( "CCCC", $four ); + return ((($b1 & 0xff) << 24 ) | + (($b2 & 0xff) << 16 ) | + (($b3 & 0xff) << 8) | + ($b4 & 0xff)); +} + +### Main program +die("Usage: $0 imagefile\n") if (@ARGV!=1); + +open(my $IN, "<", $ARGV[0]) || die("Couldn't open $ARGV[0]: $!\n"); + +use constant NUMBLOCKS => 8000; # Number of blocks on a surface +use constant WORDSPERBLK => 64; # 64 words per block + +foreach my $blocknum ( 0 .. NUMBLOCKS*2 - 1 ) { + printf("Block %d (%06o)\n", $blocknum, $blocknum ); + foreach my $line ( 0 .. 7 ) { + + # Print out the words in octal + foreach my $offset ( 0 .. 7 ) { + # Get a word + my $word= read_word($IN); + exit(0) if ($word==-1); + printf("%06o ", $word); + } + print("\n"); + } + print("\n"); +} +exit(0);