OSFIND - Open or close files
BBC->FAQ->API->OSFIND Search

 6502  Z80  PDP11  80x86  31016  ARM On entry: On exit:
A A R0ALR1R0function  handle of opened file, or 0 if not opened, or function unsupported
XYHLR1BXR2R1filename to open preserved
Y H R1BXR2R1handle to close  preserved

Function  
&00  Close channel
&4x  Open for input
&8x  Open for output
&Cx  Open for update

The bottom bits of A control how the file is opened:

  • b5 - unused
  • b4 - proposed for: open file locked by other process
  • b3 - if set, returns an error if file not found, instead of zero handle.
  • b2 - if set, error is generated if attempt to open a directory.
  • b1-b0 - if 00, search for file with normal search path, eg File$Path system variable.
  • b1-b0 - if 01, search for file with path pointed to by R2.
  • b1-b0 - if 10, search for file with system variable pointed to by R2.
  • b1-b0 - if 11, search for file with with no search path.

    Note that is is possible to open a directory, but no input or output operations can be done.


    Calling from BBC BASIC

  • CLOSE#chn  
  • calls OSFIND &00
  • chn=OPENIN fn$  
  • calls OSFIND &40
  • chn=OPENOUT fn$ 
  • calls OSFIND &80
  • chn=OPENUP fn$  
  • calls OSFIND &C0

    Entry points

  • BBC BASIC Entry Address: 
  • &FFCE
  • 6502 Entry Address:  
  • &FFCE, vectors via &021C
  • Z80 Entry Address:  
  • &FFCE, vectors via &FFCF
  • 6809 Entry Address:  
  • &FFCE, vectors via &FFCF
  • 80x86 Entry Address:  
  • INT &40, vectors via 0000:0100
  • 32000 Entry Address:  
  • SVC &0B
  • PDP-11 Entry Address:  
  • EMT 12, vector &0C
  • ARM Entry Address:  
  • SWI "OS_Find", vector &0D


    This page last updated 11-Aug-2006