1
0
mirror of https://github.com/livingcomputermuseum/pdp7-unix.git synced 2026-02-10 10:20:38 +00:00

Based on the details of the directory structure that Phil found, I've

modified the a7out and the wktls.s program to reflect this.
This commit is contained in:
Warren Toomey
2016-03-03 16:35:05 +10:00
parent 336e0c1118
commit d33ce4c69f
2 changed files with 24 additions and 9 deletions

View File

@@ -20,17 +20,21 @@ fileloop:
lac ibufptr " Point bufptr at the base of the buffer
dac bufptr
" Each directory entry is eight words. We need to print out
" the filename which is in words 2 to 5.
printloop:
isz bufptr " Move up to the filename
lac d1
sys write; bufptr:0; 4 " Write a filename out to stdout
lac d1
sys write; newline; 1 " followed by a newline
lac bufptr " Add 4 to the bufptr
tad d4
lac bufptr " Add 7 to the bufptr
tad d7
dac bufptr
-4
tad count " Decrement the count of words by 4
-8
tad count " Decrement the count of words by 8
dac count
sza " Anything left in the buffer to print?
jmp printloop " Yes, stuff left to print
@@ -47,7 +51,7 @@ newline: 012000
fd: 0
d1: 1 " stdout fd
d4: 4
d7: 7
count: 0
" Input buffer for read

View File

@@ -666,16 +666,27 @@ sub opensomething {
return($FH);
}
# It's a directory. For now, until we fully understand the code,
# I'm going to write space-padded filenames to a temporary
# directory, open and unlink it, and return the FH
# It's a directory. The on-disk format for this was:
# d.i: .=.+1 " inode number
# d.name: .=.+4 " name (space padded)
# d.uniq: .=.+1 " unique number from directory inode
# followed by two unused words
# The code creates a temporary file and fills in the i-node numbers
# and space padded filenames from the directory. The file is closed
# opened read-only and unlinked, and the open filehandle is returned.
opendir(my $dh, $filename) || return(undef);
open( $FH, ">", $tempfile) || return(undef);
dprintf("Converting directory $filename\n");
my @list= sort(readdir($dh));
foreach my $name (@list) {
printf( $FH "%-8s", substr( $name, 0, 8 ) );
# Get the file's i-node number
my (undef,$inode)= stat($name);
# ARGH! For now we are still read/writing ASCII files, so there's
# no way to represent a proper 18-bit value. For now I'll pad
# with spaces to create the record
printf( $FH " %-8s ", substr( $name, 0, 8 ) );
}
closedir($dh);
close($FH);