User`s guide
 BDOS FUNCTION 33: READ RANDOM
 Entry Parameters:
 Registers C: 21H
 DE: FCB Address
 Returned Value:
 Registers A: Error Code
 H: Physical Error
 The Read Random function is similar to the Read Sequential function except that
 the read operation takes place at a particular random record number, selected by the
 24-bit value constructed from the three byte, rO, rl, r2, field beginning at position
 33 of the FCB. Note that the sequence of 24 bits is stored with the least significant
 byte first, rO, the middle byte next, rl, and the high byte last, r2. The random record
 number can range from 0 to 262,143. This corresponds to a maximum value of 3 in
 byte r2.
 To read a file with Function 33, the calling program must first open the base
 extent, extent 0. This ensures that the FCB is properly initialized for subsequent
 random access operations. The base extent may or may not contain any allocated
 data. Function 33 reads the record specified by the random record field into the
 current DMA address. The function automatically sets the logical extent and current
 record values, but unlike the Read Sequential function, it does not advance the
 current record number. Thus, a subsequent Read Random call rereads the same
 record. After a random read operation, a file can be accessed sequentially, starting
 from the current randomly accessed position. However, the last randomly accessed
 record is reread or rewritten when switching from random to sequential mode.
 If the BDOS Multi-Sector Count is greater than one (see Function 44), the Read
 Random function reads multiple consecutive records into memory beginning at the
 current DMA. The rO, rl, and r2 field of the FCB is automatically incremented to
 read each record. However, the FCBs random record number is restored to the first
 record's value upon return to the calling program.
3-48
BDOS Function Calls  CP/M 3 Programmers Guide










