lds dx, InfoAddress ;ds:dx points to buffer to get country info
;or
;dx is 0FFFFh to set country code
cmp CountryCode, 0FEh
ja code2
mov al, byte ptr CountryCode ;country code if less than 254
jmp continue
code2:
mov bx, CountryCode ;country code if greater than 254
mov al, 0FFh
continue:
mov ah, 38h ;Get/Set Country Information
int 21h
jc error_handler ;carry set means error
Get/Set Country Information (Function 38h) either returns country information or sets the country code, depending on the contents of the DX register.
If the DX register contains any value other than 0FFFFh, this function returns a COUNTRYINFO structure containing country information that MS-DOS uses to control the keyboard and screen.
If the DX register contains 0FFFFh, this function sets the country code that MS-DOS uses to determine country information for the keyboard and screen.
InfoAddress
Specifies whether this function gets country information or sets the country code. If the parameter points to a COUNTRYINFO structure, the function copies country information to the structure. If the low 16 bits of the parameter is 0FFFFh, the function sets the country code.
The COUNTRYINFO structure has the following form:
COUNTRYINFO STRUC
ciDateFormat dw ? ;date format
ciCurrency db 5 dup (?) ;currency symbol (ASCIIZ)
ciThousands db 2 dup (?) ;thousands separator (ASCIIZ)
ciDecimal db 2 dup (?) ;decimal separator (ASCIIZ)
ciDateSep db 2 dup (?) ;date separator (ASCIIZ)
ciTimeSep db 2 dup (?) ;time separator (ASCIIZ)
ciBitField db ? ;currency format
ciCurrencyPlaces db ? ;places after decimal point
ciTimeFormat db ? ;12-hour or 24-hour format
ciCaseMap dd ? ;address of case-mapping routine
ciDataSep db 2 dup (?) ;data-list separator (ASCIIZ)
ciReserved db 10 dup (?) ;reserved
COUNTRYINFO ENDS
For a full description of the COUNTRYINFO structure, see Chapter 6, “National Language Support.”
CountryCode
Specifies the country code. This parameter can be one of the following values:
Value | Meaning |
001 | United States |
002 | Canadian-French |
003 | Latin America |
031 | Netherlands |
032 | Belgium |
033 | France |
034 | Spain |
036 | Hungary |
038 | Yugoslavia |
039 | Italy |
041 | Switzerland |
042 | Czechoslovakia |
044 | United Kingdom |
045 | Denmark |
046 | Sweden |
047 | Norway |
048 | Poland |
049 | Germany |
055 | Brazil |
061 | International English |
351 | Portugal |
358 | Finland |
Each country code is listed as a three-digit decimal number, the same as that used for that country's international telephone prefix.
To get country information for the current country, CountryCode must be zero.
If the function is successful, the carry flag is clear. Otherwise, the carry flag is set and the AX register contains an error value, which may be one of the following values:
Value | Name |
0001h | ERROR_INVALID_FUNCTION |
0002h | ERROR_FILE_NOT_FOUND |
When the country code is less than 254, the AL register contains the code. Otherwise, the BX register contains the country code and the AL register contains the value 0FFh.
If the DX register contains any value other than 0FFFFh, the function returns the country code in both the AL and BX registers. In this case, the AL register contains the low 8 bits of the country code.
Function 6501h Get Extended Country Information
Function 6601h Get Global Code Page
Function 6602h Set Global Code Page