Int 21H [3.3] Function 66H (102) Get or set code page

Obtains or selects the current code page.

Call with:

AH = 66H

AL = subfunction

01H = Get Code Page

02H = Select Code Page

BX = code page to select, if AL = 02H

Returns:

If function successful

Carry flag = clear

and, if called with AL = 01H

BX = active code page

DX = default code page

If function unsuccessful

Carry flag = set

AX = error code

Note:

When the Select Code Page subfunction is used, MS-DOS gets the new code page from the COUNTRY.SYS file. The device must be previously prepared for code page switching with the appropriate DEVICE= directive in the CONFIG.SYS file and NLSFUNC and MODE CP PREPARE commands (placed in the AUTOEXEC.BAT file, usually).

Example:

Force the active code page to be the same as the system's default code page, that is, restore the code page that was active when the system was first booted.

.

.

.

; get current and

; default code page

mov ax,6601h ; function number

int 21h ; transfer to MS-DOS

jc error ; jump if function failed

; set code page

mov bx,dx ; active = default

mov ax,6602h ; function number

int 21h ; transfer to MS-DOS

jc error ; jump if function failed

.

.

.