Z88 Developers' Notes
Contents   Contents of System Calls

GN_Esa, read & write to filename segments

RST 20H, DEFW $5E09

IN:

     A = manipulator command
          A7:  1 = write, 0 read
          A0:  1 = extension, 0 = name
     HL/DE = filename and buffer pointers

     A7 = 0 (reading): HL = filename, DE = buffer
     A7 = 1 (writing): HL = new segment, DE = buffer

     B = segment number (+/- 64)
     Positive indexes start at the device name (B=0). Negative indexes start
     at the filename (B=255,-1).

     C = Limit of buffer space to use (only relevant for writing). C should
     not be zero.

A7 = 0 (reading):

OUT, if call successful:

     Fc = 0
OUT, if call failed:
     Fc = 1
     A = error code:
          RC_IVF ($17), bad filename
Registers changed after return:
     ..BCDEHL/IXIY same
     AF....../.... different

A7 = 1 (writing):

OUT, if call successful:

     Fc = 0
     B = number of filename segments returned
     C = number of characters returned
     DE = indexes terminating null of filename
OUT, if call failed:
     Fc = 1

Registers changed after return:
     ......HL/IXIY same
     AFBCDE../.... different
Notes:
To write a segment a valid filename must be placed in the buffer pointed to by DE and the replacement segment is point to by HL. If the new segment is an extension then the first three characters are used.

Bugs:
     Unreliable with small filenames.
Related calls:

GN_Fcm, compress a filename
GN_Fex, expand a filename
GN_Opw, Open wildcard handler
GN_Pfs, parse filename segment
GN_Prs, parse filename
GN_Wcl, close wildcard handle
GN_Wfn, fetch next match for wildcard string (handle)
GN_Wsm, match filename segment to wildcard string