OS_Frm, File read miscellaneous

Register parameters

RST 20H, DEFB $48
IN:  
     A = reason code
     FA_PTR ($01)   return sequential pointer (32bit integer)
     FA_EXT ($02)   return extent (size) of file (32bit integer)
     FA_EOF ($03)   end of file enquiry
     FA_BST ($04)   buffer status (internal OZ usage)

     DE = 0, return result in DEBC registers (D = MSB, C = LSB)
	 DE < $8000, return result in (DE)
    
     IX = file handle (previously obtained with GN_Opf)
     IX = $FFFF then system values are returned

OUT, if call successful:
     Fc = 0
     Fz = 1, end of file (FA_EOF)
     Fz = 0, not end of file (FA_EOF)

     DEBC = 32bit result (returned by FA_PTR, FA_EXT, FA_BST)
     (D = most significant byte, C = least significant byte)

OUT, if call failed:
     Fc = 1
     A = error code:
          RC_HAND ($08), bad handle

Registers changed after return:
     ......HL/IXIY same
     AFBCDE../.... different 

Notes

System information:

     If IX(in) = $FFFF then the following information is obtained:

     FA_PTR:
          DE = number of free handles
          BC = OZ version number (OZ version is embedded in C register as two hex nibbles - i.e. 44H for OZ V4.4 - however it's 03H for OZ 2.x & OZ 3.x, and 04H for OZ 4.0)

     FA_EXT:
          DEBC = estimate of free memory

     FA_EOF:
          Fz = 1, if Z88 is expanded, else Fz = 0

Buffer status 

FA_BST only works with serial comms handle in IX (else Fc=1 and A=RC_Hand). It returns:
D = Tx buffer used slots
E = Tx buffer free slots
H = Rx buffer used slots
L = Rx buffer used slots

This information can also be obtained by OS_Si/SI_Enq.

Bugs

DE must be in segment 0 or 1, otherwise the call is unreliable.

Related calls

GN_Cl, close file
GN_Del, delete a file from memory
GN_Opf, open file/resource (wildcard search)
GN_Ren, rename file
OS_Cl, internal close (OZ usage)
OS_Del, file delete (internal OZ usage)
OS_Fwm, file write miscellaneous
OS_Gb, get byte from file (or device)
OS_Gbt, get byte from file (or device) with timeout
OS_Mv, move bytes between stream and memory
OS_Op, internal open (OZ usage)
OS_Pb, write byte to file, device
OS_Pbt, write byte to file, device with timeout
OS_Ren, file rename (internal OZ usage)

web analytics