Programs can retrieve the conversion tables associated with a specified country and code page by using the following functions:
Get Uppercase Table (Interrupt 21h Function 6502h)
Get Filename Uppercase Table (Interrupt 21h Function 6504h)
Get Filename-Character Table (Interrupt 21h Function 6505h)
Get Collate-Sequence Table (Interrupt 21h Function 6506h)
The conversion tables contain the information a program needs to convert lowercase characters to uppercase, to sort characters or strings, and to determine which characters can be used in filenames. These functions return the 32-bit addresses (segment:offset) of the conversion tables in memory owned by MS-DOS. Programs should copy the tables to their own memory if they intend to alter them.
Programs use the uppercase table to convert lowercase text characters to uppercase; they use the filename uppercase table to convert lowercase filename characters to uppercase. Each table begins with a 16-bit value that specifies the size, in bytes, of the character-value array in the table. This value is followed by the array of uppercase-character values. Programs convert a lowercase character to its uppercase equivalent by using the value of the lowercase character as an index to the array. Since the uppercase and filename uppercase tables apply only to extended ASCII characters (that is, characters with values greater than 127), the program must subtract 128 from the lowercase character value to create the index.
Programs use the collate-sequence table to sort characters and strings. The table begins with a 16-bit value that specifies the size, in bytes, of the character-weight array in the table. This value is followed by the array of 1-byte character weights. Programs sort two characters by using the character values as indexes to the character-weight array and comparing the resulting values. The character with the lower weight appears first in a sorted list.
Programs use the filename-character table to determine which characters are permitted in filenames. The beginning of the filename-character table corresponds to a FILECHARTABLE structure, which has the following form: valid characters>
FILECHARTABLE STRUC
fctLength dw ? ;table length, in bytes, excluding this field
db ?
fctFirst db ? ;lowest permissible character value
fctLast db ? ;highest permissible character value
db ?
ftcExcludeFirst db ? ;first in range of excluded characters
ftcExcludeLast db ? ;last in range of excluded characters
db ?
fctIllegals db ? ;number of illegal characters in array
;start of array of illegal characters
FILECHARTABLE ENDS
For a full description of the FILECHARTABLE structure, see Section 6.7, “Structures.”
The filename-character table is followed by an array of illegal characters. Because the illegal characters differ for each country, the number of characters in a given array is specified by the fctIllegals field.