Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Ralf Brown's Interrupt List (Part 1,2) - int 21 - dos - open disk file http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
INT 21 - DOS - OPEN DISK FILE
        AH = 0Fh
        DS:DX -> FCB (see below)
Return: AL = 00h file found
             FFh file not found
Note:   (DOS 3+) file opened in compatibility mode
SeeAlso: AH=3Dh

Format of File Control Block:
Offset  Size    Description
 -7     BYTE    extended FCB if FFh
 -6   5 BYTEs   reserved
 -1     BYTE    file attribute if extended FCB
 00h    BYTE    drive number (0 = default, 1 = A, etc)
 01h  8 BYTEs   blank-padded file name
 09h  3 BYTEs   blank-padded file extension
 0Ch    WORD    current block number
 0Eh    WORD    logical record size
 10h    DWORD   file size
 14h    WORD    date of last write (see AX=5700h)
 16h    WORD    time of last write (see AX=5700h)
 18h  8 BYTEs   reserved (see below)
 20h    BYTE    record within current block
 21h    DWORD   random access record number (if record size is > 64 bytes, high
                byte is omitted)
Note:   to use an extended FCB, you must specify the address of the FFh flag at
          offset -7, rather than the address of the drive number field

Format of reserved field for DOS 1.x:
Offset  Size    Description
 18h    BYTE    bit 7: set if logical device
                bit 6: set if open???
                bits 5-0: disk number or logical device ID
 19h    WORD    absolute current cluster number
 1Bh    WORD    starting cluster number
 1Dh    WORD    relative current cluster number
 1Fh    BYTE    unused???

Format of reserved field for DOS 2.x:
Offset  Size    Description
 18h    BYTE    bit 7: set if logical device
                bit 6: set if open???
                bits 5-0: ???
 19h    WORD    starting cluster number
 1Bh    WORD    ???
 1Dh    BYTE    ???
 1Eh    BYTE    ???
 1Fh    BYTE    ???

Format of reserved field for DOS 3.x:
Offset  Size    Description
 18h    BYTE    number of system file table entry for file
 19h    BYTE    attributes
                bits 7,6: 00 = SHARE.EXE not loaded, disk file
                          01 = SHARE.EXE not loaded, character device
                          10 = SHARE.EXE loaded, remote file
                          11 = SHARE.EXE loaded, local file
                bits 5-0: low six bits of device attribute word
---SHARE.EXE loaded, local file---
 1Ah    WORD    starting cluster of file
 1Ch    WORD    offset within SHARE of sharing record (see AH=52h)
 1Eh    BYTE    file attribute
 1Fh    BYTE    ???
---SHARE.EXE loaded, remote file---
 1Ah    WORD    number of sector containing directory entry
 1Ch    WORD    relative cluster within file of last cluster accessed
 1Eh    BYTE    absolute cluster number of last cluster accessed
 1Fh    BYTE    ???
---SHARE.EXE not loaded---
 1Ah    BYTE    (low byte of device attribute word AND 0Ch) OR open mode
 1Bh    WORD    starting cluster of file
 1Dh    WORD    number of sector containing directory entry
 1Fh    BYTE    number of directory entry within sector
Note:   if FCB opened on character device, DWORD at 1Ah is set to the address
          of the device driver header, then the BYTE at 1Ah is overwritten.

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson