📄 misc.a86
字号:
pop cx ; Zero the rest of the data
sub cx,EXCI_STATLEN ; Skip if no space left in users
jbe f65_40 ; buffer otherwise STOSB
xor al,al ! rep stosb
jmps f65_40
;
; All function 65 sub-functions apart from 01 (Extended Country Info.)
; pass use this code to update the users parameter block.
;
f65_30:
mov cx,5
call return_CX
mov ax,si ! stosw ; fill in the DWORD ptr to the data
mov ax,ds ! stosw
f65_40:
push ss
pop ds
; call get_dseg ; back to PCMDSEG
mov ax,cur_cp ; ##jc## Is the Requested or Current
jmp return_AX_CLC ; Return the Code Page
; *****************************
; *** DOS Function 66 ***
; ***Get/Set Global CodePage***
; *****************************
;
Public func66
func66:
cbw
dec ax ! jz f66_10 ; AL = 1, Get the Current CodePage
dec ax ! jz f66_20 ; AL = 2, Set the Current CodePage
jmp invalid_function ; Illegal Sub-Function return an Error
f66_10: ; Get the Current Code Page Info
mov bx,cur_cp ; Current CodePage
call return_BX
mov dx,SYS_CP ; System CodePage
jmp return_DX
f66_20: ; Set the Current CodePage
mov dx,cur_country ; The Codepage has changed, so update
call f38_set_country ; Country Info and tables
jnc f66_30 ; Reset the Current CodePage if
mov ax,ED_FILE ; and return the error
jmp error_exit
f66_30:
mov bx,cur_cp ; select the new codepage
call f66_select_cp ; Prepare CodePage Devices
jnc f66_40 ; No Errors Skip Error Handler
mov ax,-65 ; Update Error Status do not generate
call error_ret ; a critical error but return
; "access denied" to the application
f66_40:
ret
f65_get_info:
; On Entry:
; AL = info type
; BX = codepage (zero means any)
; DX = country
; On Exit:
; CY set if error
; DS:SI -> buffer with info in it
;
; NB. Remember to to Xlat fixups !
;
cmp dx,cur_country ; is it default country ?
jne f65_p30 ; have we already got correct country ?
test bx,bx ; CP zero special case and we will
jz f65_p20 ; accept anything for this country
cmp bx,cur_cp ; otherwise is the codepage
jne f65_p30 ; in the default system ?
f65_p20:
cbw ; make info type a word
mov si,ax ; into index register
shl si,1 ; now a word offset
mov si,func65_dt[si] ; pick up offset of correct table
jmps f65_p90
f65_p30:
push ax
call f65_locate_and_read ; get info into a buffer at DS:SI
pop ax
jc f65_p_exit
f65_p90:
cmp al,1 ; was it country info ?
jne f65_p95 ; no, skip the fixup
mov CI_CASEOFF+EXCI_CI_DATAOFF[si],offset xlat_xlat
mov CI_CASESEG+EXCI_CI_DATAOFF[si],ss
f65_p95:
clc
f65_p_exit:
ret
;
; **********************************************************************
; *** Function 65 support - routines for seeking a country/codepage ***
; *** and loading the required information into the temp data area ***
; **********************************************************************
;
; **************************************************
; *** Open country.sys and search for the ***
; *** table of offsets for the given country/ ***
; *** codepage, read it in and exit. ***
; **************************************************
f65_locate_and_read:
; Locate and Read info AL for Country DX Codepage BX
if NLSFUNC
mov di,offset country_filename
; point at pathname to country.sys
xchg ax,cx ; get info into CL
mov ax,14feh ; then call magic backdoor
nlsfunc_int2f:
stc ; assume an error
int 2fh ; to do the hard work
ret
else
push ax
call f65x_find_info ; Will need to load up the info
pop ax
jc f65_lr_exit ; so do it if we can.
mov dx,offset f65xx_temp_area
mov cx,256 ; read 256 bytes into local buffer
push ax
call f65x_load_info ; Load required info
pop ax
jc f65_lr_exit
mov ah,MS_X_CLOSE ; All done so
mov bx,c_handle ; Close the file first
call dos_entry ; before leaving
; jc f65_lr_exit
mov si,offset f65xx_temp_area ; Tell subroutines where info is
f65_lr_exit:
ret
;
; Entry: dx=country code, bx=codepage
; Exit : carry set, and country.sys closed if failure
; country.sys open ready for more reads if success
;
f65x_find_info:
push es ; Save es
push ds
pop es ; Make es=ds
mov f65xx_country,dx
mov f65xx_codepage,bx
mov dx,offset country_filename
mov ax,(MS_X_OPEN*256)+0 ; Attempt to open country.sys
test dx,dx
stc
jz f65x_40
call dos_entry ; Handle should come back in ax
jc f65x_40
f65x_10:
mov c_handle,ax ; Save handle
mov dx,f65xx_country
cmp f65xx_code,dx ; do we already have the information?
jne f65x_30 ; No - get it from country.sys
f65x_20:
cmp f65xx_cp,bx ; Does codepage agree too?
je f65x_35 ; Yes so exit with no more ado
f65x_30:
mov dx,007Eh
xor cx,cx ; Seek within country.sys
mov bx,c_handle
mov ax,(MS_X_LSEEK*256)+0 ; seek from begining
call dos_entry
jc f65x_err
mov ah,MS_X_READ ; Now read the signature bytes and
mov bx,c_handle ; check them
mov cx,2
mov dx,offset f65xx_sig
call dos_entry
jc f65x_err
cmp f65xx_sig,VALID_SIG
jne f65x_err ; If signature bad exit
f65x_32:
mov ah,MS_X_READ ; Read from country.sys header until
mov bx,c_handle ; Country/codepage found or NULL
mov cx,f65xx_ptable_len
mov dx,offset f65xx_code
call dos_entry
jc f65x_err
cmp f65xx_code,0 ; Found NULL so reqd combination
je f65x_err ; was not found
mov dx,f65xx_code ; Get the country/codepage values
mov bx,f65xx_cp ; read from Country.SYS
cmp dx,f65xx_country ; Check against the requested
jne f65x_32 ; Country.
cmp f65xx_codepage,0 ; If a codepage match is not
jz f65x_35 ; then return success
cmp bx,f65xx_codepage ; Check against the requested
jne f65x_32 ; Codepage
f65x_35:
mov f65xx_country,dx ; Force the Search Country and
mov f65xx_codepage,bx ; CodePage to be Updated
f65x_40:
pop es ; combination found so exit
ret
f65x_err:
pop es
mov ah,MS_X_CLOSE ; On error close country.sys
mov bx,c_handle ; and set the carry flag before
call dos_entry ; leaving
stc
ret
;
; **************************************************
; *** Load the type of information requested ***
; *** For the country currently active in the ***
; *** offset table ***
; **************************************************
;
; Entry: al=type of info, dx=offset of buffer to read info into cx=no of bytes
; Exit : carry set, and country.sys closed if failure
;
f65x_load_info:
push es
push cx
push dx
push ds ; Make es=ds
pop es
dec al ; 1=Data , 2=uppercase, 4=fuppercase
sub bh,bh ; 5=filechars, 6=Collating table
mov bl,al ; 7=DBCS table
shl bx,1 ; Retrieve relevant offset
mov dx,f65xx_data[bx]
xor cx,cx ; Seek within country.sys
mov bx,c_handle
mov ax,(MS_X_LSEEK*256)+0 ; seek from begining
call dos_entry
pop dx ; Get buffer address back
pop cx ; and number of bytes to read
jc f65x_err
test ax,ax ; zero offset is a problem
jz f65x_err ; (probably DBCS with old COUNTRY.SYS)
mov ah,MS_X_READ ; Now read that info into our data area
mov bx,c_handle
call dos_entry ; Return when read is done
jc f65x_err
pop es
ret
endif
;
; This function scans the complete device list and prepares
; all devices which support codepage.
;
; On Entry:
; BX = codepage
; On Exit:
; AX = error code
DA_CODEPAGE equ DA_CHARDEV+DA_IOCTL+DA_GETSET
f66_select_cp:
if NLSFUNC
mov ax,14ffh ; then call magic backdoor
jmps nlsfunc_int2f ; to do the hard work
else
push ds
mov f66_cp,bx ; Save requested CodePage
mov preperr,0000 ; Initialize Prepare Error
push ds ! pop es
mov bx,offset dev_root ; Get the Root of the Device List
f66_p10: ; Skip the NUL Device and check
lds bx,ds:DH_NEXT[bx] ; each character device for CodePage
cmp bx,0FFFFh ! jz f66_p50 ; Support.
mov ax,ds:DH_ATTRIB[bx]
and ax,DA_CODEPAGE ; Check for a Character Device which
cmp ax,DA_CODEPAGE ; supports IOCTL strings and GETSET
jne f66_p10 ; otherwise skip the device
push bx
lea si,DH_NAME[bx] ; Found a matching device so
mov di,offset prepname ; open the device and select the
mov cx,8 ; requested codepage
f66_p20:
lodsb
cmp al,' ' ! jz f66_p30
stosb
loop f66_p20
f66_p30:
xor al,al ! stosb
mov ax,(MS_X_OPEN*256)+1 ; Open the device name for
mov dx,offset prepname ; Write Access
call dos_entry
jc f66_perr
mov bx,ax ; Save Device Handle in BX
mov si,es:f66_cp ; Get Requested CodePage in SI
mov dx,offset cp_packet ; Offset of CodePage Struct
mov cx,006Ah ; Get Unknown CodePage
mov ax,(MS_X_IOCTL*256)+0Ch ; Generic IOCTL function
call dos_entry ; Make function Call
jc f66_p32 ; Error so Select requested Code Page
cmp si,es:cp_cpid ! jz f66_p35 ; If this the currently selected
f66_p32: ; skip the select CodePage
mov es:cp_cpid,si
mov dx,offset cp_packet ; Offset of CodePage Struct
mov cx,004Ah ; Select Unkown CodePage
mov ax,(MS_X_IOCTL*256)+0Ch ; Generic IOCTL function
call dos_entry ; Make function Call
jnc f66_p35 ; No Error so skip the error
f66_p33:
mov es:preperr,ax ; save
f66_p35:
mov ah,MS_X_CLOSE ; Close the device and check
call dos_entry ; for more devices to be prepared
jmps f66_p40
f66_perr:
mov es:preperr,ax ; Save the error code and try the
f66_p40: ; next device in the chain
pop bx ; Restore the Device offset
jmps f66_p10 ; and continue
f66_p50: ; All device have been prepared
pop ds ; now return the last error code
mov ax,preperr ; in AX
or ax,ax
ret
endif
PCMODE_DSIZE DSEG PARA
extrn swap_indos:word
PCM_RODATA CSEG WORD
;
; Get Internal Data DOS function 5Dh
;
func5D_ft dw f5D00
dw f5D01 ; Commit All
dw f5D02 ; Close File By Name
dw f5D03 ; Close All Host Files
dw f5D04 ; Close Process Host Files
dw f5D05 ; Get Open File List
dw f5D06 ; Get DOS Data Area
dw f5D_msnet ; f5D07 ; Get Truncate Flag used
; with Redirected Dev I/O
dw f5D_msnet ; f5D08 ; Set Truncate Flag with
; with Redirected Dev I/O
dw f5D_msnet ; f5D09 ; Close All Spool Streams
dw f5D0A ; Set Extended Error Info
func5D_ftl equ (offset $ - offset func5D_ft)/2
dw invalid_function
;
; Data used by the Binary format Time and Date routines
;
totaldays dw 0,31,59,90,120,151,181,212,243,273,304,334,0ffffh
monthdays db 31,28,31,30,31,30,31,31,30,31,30,31
parse_separators db TAB,'.,+:;='
parse_terminators db '|"/\[]<>'
PCMODE_DATA DSEG WORD
extrn internal_data:word
extrn error_code:word
extrn error_class:byte
extrn error_action:byte
extrn error_locus:byte
extrn error_dev:word
extrn indos_flag:word
extrn bootDrv:byte
extrn current_psp:word
extrn break_flag:byte
extrn dma_offset:word
extrn dma_segment:word
extrn fcb_search_buf:byte
extrn func52_data:byte ; Internal Data Table Area
extrn int21regs_ptr:dword
extrn lock_tables:dword
extrn unlock_tables:dword
extrn share_stub:dword
extrn remote_call:word ; set to FF if remote machine operation
extrn swap_always:word
extrn switch_char:byte
extrn owning_psp:word
extrn machine_id:word
extrn country_data:byte
extrn cur_country:word
extrn cur_cp:word
extrn verify_flag:byte
extrn clk_device:dword ; Clock Device Driver Address
extrn biosDate:word
extrn daysSince1980:word
extrn yearsSince1980:word
extrn month:byte
extrn dayOfWeek:byte
extrn dayOfMonth:byte
extrn hour:byte
extrn minute:byte
extrn second:byte
extrn hundredth:byte
if DOS5
extrn WindowsHandleCheck:byte
else
extrn win386_remote_machine:dword
endif
SYS_CP equ 437 ; System CodePage
GLOBAL_DATA dseg word
f38_flag dw 0 ; Country Code Selected Successfully
if not NLSFUNC
extrn dev_root:dword
f66_cp rw 1 ; INT21/66 Local Variable
cp_packet dw 2 ; Packet Size
cp_cpid dw 0 ; Request CodePage
db 0,0 ; Packet Terminators
preperr rw 1 ; Prepare function Error Code
prepname rb 9 ; Reserved for ASCIIZ Device Name
;
; Area for country.sys current pointer table
; (these are all offsets into country.sys)
;
f65xx_code rw 1 ; Country code
f65xx_cp rw 1 ; Code page
rw 1 ; +1 reserved
f65xx_data rw 1 ; Data area
rw 1 ; Upper case table
rw 1 ; +1 reserved
rw 1 ; Filename upper case table
rw 1 ; Legal file characters
rw 1 ; Collating table
rw 1 ; Double byte character set lead byte table
f65xx_ptable_len equ offset $ - offset f65xx_code
f65xx_temp_area rb 256 ; Data area for extended country info
f65xx_codepage rw 1
f65xx_country rw 1
f65xx_sig rw 1 ; Signature
c_handle rw 1
endif ;not NLSFUNC
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -