Chapter Fifteen

FILE NAME
DECODE
ROUTINE


The FNDCODE routine is used to transform the user supplied file name into a form that is usable in FMS for wild card searching of the directory. The primary and extension parts of the user file name are padded with blanks and question marks as required. The following examples show the types of transform performed by FNDCODE:
 
      User File Name Transformed File Name
      D:*.*  ???????????
      D1:GLOP.* GLOP   ???
      D1:GLOP.BAS GLOP   BAS
      D2:*.ASM ????????ASM
      D:GL?P.S* GL?P   S??
      D1:G* G???????

FNDCODE
Address $E9E 
Entry Registers  
A = Don't Care.
X = IOCB and FCB number times 16.
Y = Don't Care.
Exit Registers    
A Unknown.
X = IOCB and FCB number times 16.
Y = Unknown.

Functions:

1) The user file name buffer is searched for the colon (:) delimiter. If the delimiter is not found within 256 characters then exit to ERRFN routine (file name error).
2) The FMS file name buffer, FNAME, is cleared to blanks.
3) The EXTSW byte is set to zero. When EXTSW is zero, the primary file name field is being processed. When EXTSW is minus, then the extension file name field is being processed.
4) The next character in the user file name buffer is examined.
5) If the character is an asterisk (*), then the field is padded with question mark characters to the end of the field.
6) If the character is a period and the extension field is being processed, then exit via the RTS instruction.
7) If the character is a period and the primary field is being processed, then switch to the extension field processing.
8) If the character is a question mark, then put it into the FNAME via FDSCHAR.
9) If the character is alphanumeric (A through Z, or 0 through 9), then put it into FNAME via FDSCHAR.
10) If the character is none of the above, then assume that end of the filename has been found and exit via the RTS instruction.
11) If a character was stored, then continue at step four.
FDSCHAR
1) If the character counter register, X, indicates that the primary field is full, then exit without storing the character.
2) If the character counter register, X, indicates that the extension field name is full, then exit without storing the character.
3) Store the character into FNAME indexed by the X register.
4) Increment the X register.
5) Return to caller via the RTS instruction.

Return to Table of Contents | Previous Chapter | Next Chapter