Chapter
1
I
System Calls
OpenFile
Open
File
Function
Call
OFH
Opens a File Control Block (FCB)
for
the named file, if
the file is found in the disk directory. The FCB is filled
in as follows:
0
If the drive code in the file specification is 0 (default
drive), it is changed to the number
of
the actual disk
used
(1
=
A,
2
=
B, etc.). This lets you change the
default drive without interfering with subsequent opera-
tions on this file.
The current block field (offset 0CH) is set
to
zero.
0
The record size (offset OEH) is set to the system de-
0
The file size (offset 10H), date
of
last write (offset
14H), and time
of
last write (offset 16H) are set from
the directory entry.
Before performing a sequential disk operation on the
file, you must set the current record field (offset 20H).
Before performing a random disk operation on the file,
you must set the relative record field (offset 21H). If
the default record size (128 bytes) is not correct, set it
to the correct length.
fault
of
128.
Entry Conditions:
AH
=
OFH
DS:DX
=
pointer
to
an unopened
FCB
for the
file
E
xi t Conditions
:
If
AL
=
00H, the directory entry was found.
If AL
=
FFH, the directory entry was not found.
Macro
Definition:
open
macro
fcb
mov
dx,off5et
fcb
mov
ah,OFH
int
21
H
endm
49