Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Assembly Language - <b>function 0fh (15) open file, using fcbs</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Function 0Fh (15)        Open File, Using FCBs

    Open an existing file using a File Control Block (FCB).

       On entry:      AH         0Fh
                      DS:DX      Pointer to an unopened FCB

       Returns:       AL         00h       If file successfully opened
                                 FFh       If file not found

  --------------------------------------------------------------------------

  The FCB is initialized as follows:

    Offset  Length  Field           Initialized to       Initialized by

      00h     1     Drive code      Drive specified           User
      01h     8     Filename        Filename                  User
      09h     3     Extension       Filename extension        User
      0Ch     2     Current Block   00h                       DOS
      0Eh     2     Record Size     80h                       DOS; see below
      10h     4     File Size       Value in file directory   DOS
      14h     2     Date            Value in file directory   DOS
      16h     2     Time            Value in file directory   DOS
      18h     8     Reserved
      20h     1     Current Record  See notes below           User
      21h     4     Random Record   See notes below           User
                    Number

    An extended File Control Block is used to access files with special
    attributes. An extended File Control Block has three additional
    fields, starting at offset -07h (minus 7), as follows:

    Offset  Length  Field             Initialized to     Initialized by

     -07h     1     Extended FCB ID   FFh                     User
     -06h     5     Reserved          Must be zeros           User
     -01h     1     Attribute Byte    File attribute          User


       Notes:         If the drive code was 0 (default drive), this
                      function changes it to the current default drive,
                      where A = 1, B = 2, etc.

                      The record-size field is set by DOS to 80h (128)
                      bytes. If you want to use a different value, change
                      the field after the file has been opened and before
                      you perform any disk operation. If the record size
                      is less than 64 bytes, all four bytes of this field
                      are used; otherwise only the lower three bytes are
                      used.

                      The current record field is used for sequential
                      read/write operations, and must be set before
                      performing any sequential read/writes. Set the
                      current record field to the record number that you
                      wish to access within the current block. The current
                      record field can take on any value between 0 and
                      127.

                      The random record number field must be set before
                      any random read/write operations can be performed.
                      Set this field to the record number relative to the
                      beginning of the file that you wish to access.

                      File Control Blocks are a holdover from DOS 1. It is
                      preferable to manipulate files using the newer DOS
                      services that deal with files via handles. (All file
                      functions above 2Eh use handles rather than FCBs.)


 See also:   Interrupt 20098     (Destroy Disk and Exit)
             Service 23512       (Memorial Service for Dead Disk)

See Also: FCB 3Dh 10h 29h

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