OSFIND&FFCE

When calling the OSFIND routine from machine code you will need to use the absolute address &40CE. However, when CALLing this routine from BBC BASIC it is recommended that you use the BBC Micro-compatible address &FFCE.

Introduction

This routine opens or closes a file. The Z80 register A contains the function code.

Code Description BBC BASIC Equivalent
A=0 Close a file CLOSE
A=&4x Open a file for input OPENIN
A=&8x Open a file for output OPENOUT
A=&Cx Open a file for update OPENUP

Close a File

To close a file call OSFIND with A set to 0 and H containing the handle of the file you wish to close. If H is 0 all opened file handles are closed.

Open a File

On entry HL points to a CR-terminated filename and the upper four bits of A specify the file access mode. On exit A will contain the file handle, or 0 on error.