diff --git a/build/Makefile b/build/Makefile index c8215c7..9afa5e3 100644 --- a/build/Makefile +++ b/build/Makefile @@ -13,6 +13,10 @@ a.rim: $(AS) -f rim -o a.rim $(SYS)/sop.s $(SYS)/s[1-8].s $(AS) -f list -o a.lst $(SYS)/sop.s $(SYS)/s[1-8].s +coldboot: + $(AS) -f rim -o a.rim $(SYS)/sop.s $(SYS)/s[1-9].s + $(AS) -f list -o a.lst $(SYS)/sop.s $(SYS)/s[1-9].s + image.fs: $(MKFS) --debug --format simh proto diff --git a/src/sys/s4.s b/src/sys/s4.s index 5d37eec..e34ddc6 100644 --- a/src/sys/s4.s +++ b/src/sys/s4.s @@ -3,11 +3,11 @@ " allocate a free disk block for a file (data or indirect) alloc: 0 - -1 - tad s.nfblks + -1 " Decrement the # free block numbers in the cache + tad s.nfblks " kept at s.fblks. Jump to 1f if no free blocks left. spa jmp 1f - dac s.nfblks + dac s.nfblks " Update the count of free block numbers tad fblksp jms laci dac 9f+t @@ -16,7 +16,7 @@ alloc: 0 jms dskwr dzm .savblk lac 9f+t - jmp alloc i + jmp alloc i " Return from routine 1: lac s.nxfblk sna @@ -30,7 +30,7 @@ alloc: 0 dac s.nfblks jmp alloc+1 - " free a disk block + " free the disk block whose number is in AC free: 0 lmq lac s.nfblks @@ -53,7 +53,7 @@ free: 0 dzm .savblk lac d1 dac s.nfblks - jmp free i + jmp free i " Return from the routine t = t+1 " load AC indirect (without using indirect!) diff --git a/src/sys/s9.s b/src/sys/s9.s index 044350a..930a967 100644 --- a/src/sys/s9.s +++ b/src/sys/s9.s @@ -5,27 +5,28 @@ " zero i-list - dzm ii - jms copyz; dskbuf; 64 + dzm ii " Set ii to zero + jms copyz; dskbuf; 64 " Zero the 64-word dskbuf 1: - lac ii + lac ii " Zero blocks 0 to 709 jms dskio; 07000 - isz ii + isz ii " Move up to next block number -710 tad ii sza - jmp 1b + jmp 1b " Loop back until we reach block 710 + " i.e. we don't write block 710 " free rest of disk 1: - lac ii + lac ii " Free blocks 710 up to 6399 jms free isz ii -6400 tad ii sza - jmp 1b + jmp 1b " Loop back until we reach block 6400 " read in tapes diff --git a/tools/sdump b/tools/sdump index 5e8c66c..43908f7 100755 --- a/tools/sdump +++ b/tools/sdump @@ -6,6 +6,7 @@ # use strict; use warnings; +use Fcntl qw(:flock SEEK_SET); ### read a word from a file in SimH format ### return -1 on EOF @@ -14,10 +15,10 @@ sub read_word { # 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)); + return (($b1 & 0xff) | + (($b2 & 0xff) << 8 ) | + (($b3 & 0xff) << 16) | + (($b3 & 0xff) << 24)); } ### Main program @@ -27,6 +28,11 @@ 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 +use constant BYTESPERWORD => 4; # We encode each word into 4 bytes + +# Skip the first surface +seek($IN, NUMBLOCKS*WORDSPERBLK*BYTESPERWORD, SEEK_SET) || + die("Cannot seek: $!\n"); foreach my $blocknum ( 0 .. NUMBLOCKS*2 - 1 ) { printf("Block %d (%06o)\n", $blocknum, $blocknum );