NEC CP/M-86 System Reference Manual page 60

Advanced personal computer
Table of Contents

Advertisement

Basic Disk Operating System (BDOS) Functions
4-26
The Write Random function writes data to the disk from the current DMA address.
If the disk extent or data block which is the target of the write has not yet been
allocated, the allocation is performed before the write operation continues. As in
the Read Random function, the random record number is not changed as a result of
the write. The logical extent number and current record position of the file control
block are set to correspond to the random record which is being written. Sequential
read or write operations can follow a random write. However, the currently
addressed record is rewritten as the sequential operation begins. To get the effect of
a sequential write operation, advance the random record position following each
write. Reading or writing the last record of an extent in random mode does not
cause an automatic extent switch as it does in sequential mode.
To access a file using the Write Random function, the base extent (extent 0) must
first be opened. This ensures that the FCB is properly initialized for subsequent
random access operations. If the file is empty, a Make File function must be issued
for the base extent. Although the base extent mayor may not contain allocated
data, this ensures that the file is properly recorded in the directory and is visible in
DIR requests.
A Write Random call returns a value in register AL indicating an error, as listed in
Table 4-5, or the value 00 indicating the operation was successful.
COMPUTE FILE SIZE
ENTRY
CL: 23H
DX: FCB
Offset
FUNCTION 35
COMPUTE FILE
SIZE
RETURN
Random Record
Field Set
When computing the size of a file, the DX register addresses an FCB in random
mode format (bytes rO, rl, and r2 are present). The FCB contains an unambiguous
file name which is used in the directory scan. Upon return, the random record bytes
contain the virtual file size which is, in effect, the record address of the record
following the end of the file. If, following a call to function 35, the high record byte
r2 is 01, then the file contains the maximum record count 65536. Otherwise, bytes rO
and rl constitute a 16-bit value (rO is the least significant byte) which is the file size.

Advertisement

Table of Contents
loading

Table of Contents