Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Programmers Reference 0.02b - <b>function 29h (41) parse filename</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Function 29h (41)        Parse Filename

    Parses a command-line text string and places it in the various fields
    of an FCB.

       On entry:      AH         29h
                      AL         Parsing flags (see below)
                      DS:SI      Pointer to the string to be parsed
                      ES:DI      Pointer to the FCB

       Returns:       AL         FFh      If function fails
                                 00h      If function succeeds, no wildcards
                                          encountered
                                 01h      If function succeeds, and wildcards
                                          are encountered

       Parsing flags:

            Bit       Means
             0        Scan past (ignore) leading separator characters
             1        Drive ID byte in FCB is modified only if drive is
                      specified in command line
             2        Filename in FCB is modified only if filename is
                      specified in command line
             3        Filename extension in FCB is modified only if filename
                      extension is specified in command line
            4-7       Ignored

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

    Function 29h parses a command line for a filespec with the form
    d:FILENAME.EXT. If a filename is found, an FCB is created; otherwise
    the function returns FFh in AL. The function enables a program to set
    up a default drive, filename, and extension, and to allow the user to
    override these defaults at will.

       Notes:         DS:SI points to the location of the filespec to be
                      parsed. ES:DI points to the location where the FCB
                      will be created. The low-order four bits of AL
                      specify parsing parameters, as follows:

                      If bit 0 is 1, the function scans past leading
                      separator characters (blank spaces, for example) to
                      find the filespec. If bit 0 is 0, the filespec is
                      expected to be in the first byte of the command
                      line.

                      If bit 1 is 1, the function sets the drive byte in
                      the FCB only if it is included in the filespec being
                      parsed. This allows the FCB to have its own default
                      drive (which the user may override), rather than
                      using the DOS default drive.

                      If bit 2 is 1, the function changes the filename in
                      the FCB only if a valid filename is found in the
                      filespec. This allows your program to set up a
                      default filename, which can be overridden by the
                      command input.

                      If bit 3 is 1, the filename extension in the FCB is
                      changed only if a valid filename extension is found
                      in the filespec.

                      If the function encounters a '*' wildcard character
                      in the filename or extension, it fills out the
                      remainder of the filename or extension with '?'
                      wildcard characters. Assuming the rest of the
                      parsing operation is successful, the function in
                      this case returns 01h in AL, alerting your program
                      of the need for find-first / find-next processing
                      (see Function 11h and Function 12h).

                      If the parse is unsuccessful, AL returns FFh, and
                      the second byte of the FCB (ES:DI+1) will be blank.

                      Function 29h cannot handle path names.

See Also: FCB

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