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:
+9
-5
@@ -20,17 +20,21 @@ fileloop:
|
|||||||
lac ibufptr " Point bufptr at the base of the buffer
|
lac ibufptr " Point bufptr at the base of the buffer
|
||||||
dac bufptr
|
dac bufptr
|
||||||
|
|
||||||
|
" Each directory entry is eight words. We need to print out
|
||||||
|
" the filename which is in words 2 to 5.
|
||||||
printloop:
|
printloop:
|
||||||
|
|
||||||
|
isz bufptr " Move up to the filename
|
||||||
lac d1
|
lac d1
|
||||||
sys write; bufptr:0; 4 " Write a filename out to stdout
|
sys write; bufptr:0; 4 " Write a filename out to stdout
|
||||||
lac d1
|
lac d1
|
||||||
sys write; newline; 1 " followed by a newline
|
sys write; newline; 1 " followed by a newline
|
||||||
|
|
||||||
lac bufptr " Add 4 to the bufptr
|
lac bufptr " Add 7 to the bufptr
|
||||||
tad d4
|
tad d7
|
||||||
dac bufptr
|
dac bufptr
|
||||||
-4
|
-8
|
||||||
tad count " Decrement the count of words by 4
|
tad count " Decrement the count of words by 8
|
||||||
dac count
|
dac count
|
||||||
sza " Anything left in the buffer to print?
|
sza " Anything left in the buffer to print?
|
||||||
jmp printloop " Yes, stuff left to print
|
jmp printloop " Yes, stuff left to print
|
||||||
@@ -47,7 +51,7 @@ newline: 012000
|
|||||||
|
|
||||||
fd: 0
|
fd: 0
|
||||||
d1: 1 " stdout fd
|
d1: 1 " stdout fd
|
||||||
d4: 4
|
d7: 7
|
||||||
count: 0
|
count: 0
|
||||||
|
|
||||||
" Input buffer for read
|
" Input buffer for read
|
||||||
|
|||||||
+14
-3
@@ -666,15 +666,26 @@ sub opensomething {
|
|||||||
return($FH);
|
return($FH);
|
||||||
}
|
}
|
||||||
|
|
||||||
# It's a directory. For now, until we fully understand the code,
|
# It's a directory. The on-disk format for this was:
|
||||||
# I'm going to write space-padded filenames to a temporary
|
# d.i: .=.+1 " inode number
|
||||||
# directory, open and unlink it, and return the FH
|
# 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);
|
opendir(my $dh, $filename) || return(undef);
|
||||||
open( $FH, ">", $tempfile) || return(undef);
|
open( $FH, ">", $tempfile) || return(undef);
|
||||||
dprintf("Converting directory $filename\n");
|
dprintf("Converting directory $filename\n");
|
||||||
|
|
||||||
my @list= sort(readdir($dh));
|
my @list= sort(readdir($dh));
|
||||||
foreach my $name (@list) {
|
foreach my $name (@list) {
|
||||||
|
# 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 ) );
|
printf( $FH " %-8s ", substr( $name, 0, 8 ) );
|
||||||
}
|
}
|
||||||
closedir($dh);
|
closedir($dh);
|
||||||
|
|||||||
Reference in New Issue
Block a user