Chapter Six

FMS
EXIT

There are two types of FMS exits: the normal exit and the error exits. Both of these exit types end up calling the RETURN routine.

RETURN
Address $12D3
 
Entry Registers   
 A = Return Code
 X = Don't Care.
 Y = Don't Care
Exit Registers     
 A = Possible Get Byte' data byte.
 X = IOCB number times 16.
 Y = Return Code

Functions:

1) The X register is loaded with the current IOCB number times 16 from CURFCB.
2) The return code is placed in the IOCB status field (ICSTA).
3) The stack register is restored to point to the stack displacement at FMS entry from the value saved in ENTSTK.
4) The possible Get Data data byte is loaded into the A register.
5) The Y register is loaded with the return code.
6) The caller (CIO) is returned to via the RTS instruction.
GREAT And FGREAT
GREAT and FGREAT are the exit points used by FMS when the operation has terminated normally. FGREAT is located at $12EA and is used to free the sector buffer that has been allocated to the FCB. The FRESBUF routine is used to free the buffer. FGREAT exits directly to GREAT ($12F0). The GREAT exit point loads the normal return code ($01) into the A register and goes to RETURN.

Error Exits
The ERREOF exit is called when an end of file condition is found. ERREOF loads the end-of-file condition code ($88) in the A register and goes to RETURN.
     The ERRIO exit is called if an error occurs during an I/O operation (Figure 1, control flow 3). The error code from the DCB (control path K) is loaded into the A register as the FMS return code and control is passed to RETURN.
     All other errors exits are at the ERxxx labels starting at $12B5. The error code is developed by means of a series of 6502 INC instructions which increment the ERRNO (which was initialized to $9F at FMS entry). The final instruction at the end of the INC chain loads the final ERRNO value into the A register and control is passed directly to RETURN.


Return to Table of Contents | Previous Chapter | Next Chapter