User`s guide

BDOS FUNCTION 34: WRITE RANDOM
Entry Parameters:
Registers C: 22H
DE: FCB Address
Returned Value:
Registers A: Error Code
H: Physical Error
The Write Random function is analogous to the Read Random function, except
that data is written to the disk from the current DMA address. If the disk extent or
data block where the data is to be written is not already allocated, the BDOS auto-
matically performs the allocation before the write operation continues.
To write to a file using the Write Random function, the calling program must first
open the base extent, extent 0. This ensures that the FCB is properly initialized for
subsequent random access operations. If the file is empty, the calling program must
create the base extent with the Make File function before calling Function 34. The
base extent might or might not contain any allocated data, but it does record the file
in the directory, so that the file can be displayed by the DIR utility.
The Write Random function sets the logical extent and current record positions to
correspond with the random record being written, but does not change the random
record number. Thus, sequential read or write operations can follow a random write,
with the current record being reread or rewritten as the calling program switches
from random to sequential mode.
Function 34 makes an Update date and time stamp for the file if the following
conditions are satisfied: the referenced drive has a directory label that requests Update
date and time stamping if the file has not already been stamped for update by a
previous BDOS Make or Write call.
3-50
BDOS Function Calls CP/M 3 Programmers Guide