13. FILE_OPEN

*------------------------------------------------------------------------------
* NAME          FILE_OPEN
*------------------------------------------------------------------------------
* DEPENDENCY    None
* PURPOSE       To open a file like 'OPEN #3,filename'
* DESCRIPTION   Opens a file in mode 0 (old exclusive device) The filename is
*               passed in A0 (a pointer to the name). The current job assumes
*               ownership of the channel. May need a TRAP #4 before calling if
*               the filename is relative A6 when called. (SuperBasic).
* INPUTS :
*               A0.L = Pointer to filename
* OUTPUTS :
*               A0.L = Channel id.
*               D0 = Error code
*               Z flag set if no errors, unset otherwise.
*------------------------------------------------------------------------------
file_open       movem.l d1-d3,-(a7)     ; Those workers need saving
                moveq   #0,d3           ; Old exclusing device mode
fo_params       moveq   #IO_OPEN,d0     ; Trap code
                moveq   -1,d1           ; Current job owns the channel
                trap #2                 ; Open it
                movem.l (a7)+,d1-d3     ; Restore workers
                tst.l   d0              ; Make sure Z is set/unset
                rts