30h FL$PARS parse a filename
Input

D = Where to put parsed output
X = Addresse of file name to be parsed (leading byte count)
UTW_S0 = default device

Output - none -
Description

Checks that the file name at X is legal, and converts it to a standard form at D.

The input filename at X is a leading byte count string of the form [<device>]:<name> where <device> is 'A'..'D' (optional), and <name> is between one and eight characters long.

Filenames may contain any of the characters 'a'..'z', 'A'..'Z', '0'..'9' and the last character may also be a '$' or '%'. The first character must be 'A' . 'Z' or 'a' .. 'z'. They may be between one and eight characters in length, excluding the device and the colon, but including any final '$' or '%'.

A device code - 0 for device A: to 3 for D: - is placed before the name in the output. If no device was given in the input filename, the byte at UTW_S0 which can be 0..3 is taken to be the device code. The output string is in upper case and padded with spaces to be eight characters long.

The error "BAD FILE NAME", or "BAD DEVICE NAME" will be returned if the file name at X or the high byte of UTW_S0 is illegal.

Example
Input filename UTW_S0 Result
"C:ABC" don't care <03>"ABC     "
"ABC" 0 <00>"ABC     "
"ABC" 1 <01>"ABC     "

code for the last example:

INPUT_FILENAME:
        ASCIC   "ABC"
PARSED_OUTPUT:
        DS      9

        LDX     #INPUT_FILENAME
        LDD     #PARSED_OUTPUT
        OS      FL$PARS
        BCS     BAD_NAME
Errors 236 - bad file name
243 - bad device name