Hardware manual

The procedures that operate on disk streams are described in documentation for the "DiskStreams"
software package contained in an appendix to this manual. Below is a summary list of the functions (in
addition to the generic functions described above):
CreateDiskStream(filePtr, type [ksTypeReadWrite], itemSize [wordItem], Cleanup [Noop], errRtn
[SysErr], zone [sysZone], nil, disk [sysDisk]) = a disk stream, or
0 if an error is encountered while initializing the stream. filePtr
is the sort of object stored in a file directory. Legal types are
ksTypeReadOnly, ksTypeReadWrite, and ksTypeWriteOnly.
Legal item sizes are wordItem and charItem.
CleanupDiskStream(s) Flush any buffers to the disk.
ReadBlock(s, address, count) = actualCount. Read up to count words from the stream into
consecutive memory locations; return the actual number of
words read. (Non-intuitive things happen at the end of a file
with an odd number of bytes -- read the documentation
carefully)
WriteBlock(s, address, count) Write count words from consecutive memory locations onto the
stream.
LnPageSize(s) = log (base 2) of the page size, in words, of the files manipulated
by the stream.
PositionPage(s, page) Positions the file to byte 0 of the specified page (page 1 is the
first data page).
PositionPtr(s, byteNo) Positions the file to the specified byte of the current page.
FileLength(s, filePos []) = Length. Returns number of bytes in file; positions stream to
the last byte.
FilePos(s, filePos []) = Pos. Returns the current byte position in the file.
SetFilePos(s, filePos) or SetFilePos(s, HighOrder, LowOrder) Sets the position of the file to the
specified byte.
GetCurrentFa(s, fileAddress) Returns the current file address.
JumpToFa(s, fileAddress) Positions the file to the specified address (usually obtained from
GetCurrentFa).
GetCompleteFa(s, completeFileAddress) Returns a complete file address, including a
filePtr.
TruncateDiskStream(s) Truncates the file to the current position.
ReadLeaderPage(s, address) Reads the 256-word leader page of the file into consecutive
locations starting at address.
WriteLeaderPage(s, address) Writes 256 words onto the leader page of the file.
The operating system also contains a package for dealing with files at a lower level, the "Bfs" (Basic file
system) package.
Disk Errors: The system will repeat five times any disk operation which causes an error. On the last three
repetitions, it will do a restore operation on the disk first. If five repetitions do not result in an error-free
operation, a (hard) disk error occurs; it is reported by a call on Errors for the stream involved.
Alto Operating System May 5, 1980 6
For Xerox Internal Use Only -- December 15, 1980