⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 misc.a86

📁 与MS-DOS兼容的DOS操作系统
💻 A86
📖 第 1 页 / 共 4 页
字号:
;    File              : $MISC.A86$
;
;    Description       :
;
;    Original Author   : DIGITAL RESEARCH
;
;    Last Edited By    : $CALDERA$
;
;-----------------------------------------------------------------------;
;    Copyright Work of Caldera, Inc. All Rights Reserved.
;      
;    THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL,
;    PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC.
;    ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES
;    WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF
;    THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO
;    HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE
;    AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE
;    AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED,
;    COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED,
;    CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST,
;    TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF
;    CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT
;    AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND
;    CIVIL LIABILITY.
;-----------------------------------------------------------------------;
;
;    *** Current Edit History ***
;    *** End of Current Edit History ***
;    $Log$
;    MISC.A86 1.29 94/11/30 14:40:17
;    fixed error return for function 6602
;    MISC.A86 1.28 94/07/13 15:31:04 
;    Pass name to share on Int21/5D02 (close file by name)
;    MISC.A86 1.27 93/11/29 14:18:16
;    Fix bug in get extended country info if not current country
;    MISC.A86 1.25 93/11/19 17:00:14
;    If 21/38 get country info fails for current codepage, try any codepage
;    MISC.A86 1.24 93/11/16 15:57:08
;    int 21/5D06 clears CY flag 
;    MISC.A86 1.23 93/10/21 19:31:16
;    Move Int 21/5D03+5D04 support (close all files by machine/psp) into share
;    MISC.A86 1.22 93/10/18 17:41:45
;    fix for >255 open files (PNW Server)
;    MISC.A86 1.21 93/09/03 20:28:57
;    Add intl/dbcs support for int 21/6523 (query yes/no char)
;    MISC.A86 1.20 93/07/26 20:42:13
;    Seperate int21/3306 
;    MISC.A86 1.12 93/03/05 18:12:33
;    Fix DS corruption for NLSFUNC calls
;    ENDLOG
;

VALID_SIG	equ	0EDC1h

	include	pcmode.equ
	include	i:msdos.equ
	include i:mserror.equ
	include i:psp.def
	include	i:driver.equ
	include	i:char.def
	include	i:country.def
	include	i:doshndl.def
	include	i:redir.equ
	include	i:fdos.equ

NLSFUNC	equ	TRUE

;
GLOBAL_DATA	DSEG	WORD
	extrn	default_country:byte
	extrn	Ucasetbl:word
	extrn	FileUcasetbl:word
	extrn	FileCharstbl:word
	extrn	Collatingtbl:word
	extrn	DBCS_tbl:word
	extrn	NoYesChars:byte
	extrn	info1_len:abs
	extrn	info2_len:abs
	extrn	info4_len:abs
	extrn	info5_len:abs
	extrn	info6_len:abs
	extrn	info7_len:abs
	extrn	dos_version:word
	extrn	country_filename:byte


PCM_CODE	CSEG	BYTE
	extrn	dbcs_lead:near
	extrn	device_write:near	; Write to a Character Device
	extrn	device_read:near	; Read from a Character Device
	extrn	dos_entry:near
	extrn	error_exit:near
	extrn	error_ret:near
	extrn	func5F_common:near
	extrn	get_dseg:near
	extrn	valid_drive:near
	extrn	ifn2dhndl:near
	extrn	int21_func:near
	extrn	invalid_function:near
	extrn	patch_version:word
	extrn	reload_registers:near
	extrn	reload_ES:near
	extrn	return_AX_CLC:near
	extrn	return_BX:near
	extrn	return_CX:near
	extrn	return_DX:near
	extrn	toupper:near
	extrn	xlat_xlat:word

;
;	*****************************
;	***    DOS Function 34    ***
;	***   Get The Indos Flag  ***
;	*****************************
	Public	func34
func34:
	mov	bx,offset indos_flag
;	jmp	return_DSBX_as_ESBX	; return ES:BX -> indos flag

	Public	return_DSBX_as_ESBX

return_DSBX_as_ESBX:
;-------------------
; On Entry:
;	DS:BX to be returned to caller in ES:BX
; On Exit:
;	ES/DI trashed
;
	les	di,ss:int21regs_ptr
	mov	es:reg_ES[di],ds
	mov	es:reg_BX[di],bx
	ret


;
;	*****************************
;	***    DOS Function 52    ***
;	***   Get Internal Data   ***
;	*****************************
;
;
	Public	func52
func52:
	mov	bx,offset func52_data
	jmps	return_DSBX_as_ESBX	; return ES:BX -> internal data

;
;	*****************************
;	***    DOS Function 5D    ***
;	***    Private DOS Func   ***
;	*****************************
;
;
	Public	func5D
func5D:
if DOS5
	cmp	al,7
	 jae	f5d_05
	mov	si,dx				; ES:SI -> callers structure
	mov	bx,es:word ptr 20[si]
	mov	ss:owning_psp,bx		; update PSP from there
	cmp	WindowsHandleCheck,26h
	 jne	f5D_05				; check if Windows is running
	mov	bx,es:word ptr 18[si]
	mov	ss:machine_id,bx		; no, update machine_id
f5D_05:
else
	push	ds
	push es ! pop ds			; restore users DS
	callf	ss:win386_remote_machine
	pop	ds
endif
	cbw					; zero AH for valid functions
	xchg	ax,bx				; sub function in BX
	
	cmp	bx,func5D_ftl			; Assume Illegal Subfunction
	 jb	f5D_10				; check that it is a valid
	mov	bx,func5D_ftl			;  subfunction
f5D_10:
	shl	bx,1
	push	func5D_ft[bx]			; save function address
	shr	bx,1
	xchg	ax,bx				; restore BX
	ret					; go to function
	
f5D_msnet:
	mov	ax,I2F_REDIR_5D			; magic number to redirect
	jmp	func5F_common			;  calls to extentions
;
;
;	The registers for some of the following sub-functions are passed
;	in the following structure.
;
RDC_AX		equ	es:word ptr 00[di]	; User AX
RDC_BX		equ	es:word ptr 02[di]	; User BX
RDC_CX		equ	es:word ptr 04[di]	; User CX
RDC_DX		equ	es:word ptr 06[di]	; User DX
RDC_SI		equ	es:word ptr 08[di]	; User SI
RDC_DI		equ	es:word ptr 10[di]	; User DI
RDC_DS		equ	es:word ptr 12[di]	; User DS
RDC_ES		equ	es:word ptr 14[di]	; User ES
RDC_RES		equ	es:word ptr 16[di]	; Remote Machine ID (High Word)
RDC_UID		equ	es:word ptr 18[di]	; Remote Machine ID (Low Word)
RDC_PID		equ	es:word ptr 20[di]	; Process ID
;
;	*****************************
;	***   DOS Function 5D00   ***
;	***   Remote DOS Call     ***
;	*****************************
;
;
f5D00:
	mov	remote_call,0ffh	; set remote op flag
	push	es
	les	di,int21regs_ptr	; stack image the copy registers
	pop	ds
	mov	cx,6
	rep	movsw			; Copy AX, BX, CX, DX, SI, DI
	inc di ! inc di			; Skip BP in the destination
	movsw ! movsw			; finally copy DS and ES
	push ss ! pop ds		; DS -> PCMDSEG
	call	reload_registers	; load up the new registers
	jmp	int21_func		;  then execute that function

;	*****************************
;	***   DOS Function 5D01   ***
;	***    Commit all files   ***
;	*****************************
;
f5D01:
;-----
; We are being asked to commit all files to disk
; By pretending to be FCB's we force use of IFN's, and we commit all possible
; files in the range 0-255, ignoring errors from unopened handles.
;
	mov	remote_call,DHM_FCB	; pretend to be FCB, forces use of IFN
	xor	bx,bx			; start with handle zero
f5D01_10:
	mov	ah,MS_X_COMMIT
	call	dos_entry		; commit this file
	inc	bx			; onto next candidate
	cmp	bx,0FFh			; runout yet ?
	 jb	f5D01_10		;
	ret


;	*****************************
;	***   DOS Function 5D02   ***
;	***   Close file by name  ***
;	*****************************
;
f5D02:
;-----
; Close file by name. We do a search first to find out about the file.
; As long as it's local we call share with the directory cluster/index
; to close it if it's open.
;
	mov	di,dx			; ES:DI -> register block
	mov	dx,RDC_DX
	mov	es,RDC_DS		; ES:DX -> filename to close
	push	dma_offset
	push	dma_segment
	mov	dma_offset,offset fcb_search_buf
	mov	dma_segment,ds
	mov	cx,DA_RO+DA_SYSTEM+DA_HIDDEN
	mov	ah,MS_X_FIRST		; look for this file
	call	dos_entry		;  to get dir entry info
	pop	dma_segment
	pop	dma_offset
	 jc	f5Dret
	mov	al,fcb_search_buf	; get drive #
	test	al,al			; reject networked drives
	 js	f5Dret
	dec	ax			; make drive zero based
	mov	cx,word ptr fcb_search_buf+0Dh
					; CX = directory count
	mov	dx,word ptr fcb_search_buf+0Eh
					; DX = parent directory cluster
	lea	bx,fcb_search_buf+1	; DS:BX -> name
	mov	di,S_CLOSE_IF_OPEN
;	jmps	f5D_common
f5D_common:	
	callf	lock_tables		; protect SHARE with a critical section
	callf	share_stub[di]
	callf	unlock_tables		; safe again
f5Dret:
	ret

;	*****************************
;	***   DOS Function 5D03   ***
;	*** Close files by machine***
;	*****************************
;
;	*****************************
;	***   DOS Function 5D04   ***
;	*** Close by Machine/PSP  ***
;	*****************************
f5D03:
f5D04:
;-----
; Close all files for given PSP
;
	mov	di,S_CLOSE_FILES
	jmps	f5D_common


;	*****************************
;	***   DOS Function 5D05   ***
;	*****************************
;
f5D05:
; On Entry:
;	RDC.BX = Share File # to look to
;	RDC.CX = Share Record # to look for
; On Exit:
;	AX = DOSHNDL Attribute Word
;	BX = machine ID
;	CX = locked blocks count
;	ES:DI -> buffer containing full pathname
;
;
	callf	lock_tables		; protect SHARE with a critical section
	callf	share_stub+S_GET_LIST_ENTRY
	callf	unlock_tables		; safe again
	 jnc	f5Dret			; just return if it went OK
	jmp	error_ret		;  else return error code in AX


;	*****************************
;	***   DOS Function 5D06   ***
;	***   Get Internal Data   ***
;	*****************************
;
f5D06:
	mov	cx,offset swap_indos		; Calculate Size of Swap
	sub	cx,offset internal_data		; Swap INDOS Array
	call	return_CX			; CX = Swap Indos length
	mov	dx,offset swap_always		; Calculate Size of Swap
	sub	dx,offset internal_data		; Swap ALWAYS Array
	call	return_DX			; DX = Swap Always length
	mov	si,offset internal_data
	call	return_DSSI
	mov	ax,5D06h
	jmp	return_AX_CLC


;
;	*****************************
;	***   DOS Function 5D0A   ***
;	***Set Extended Error Info***
;	*****************************
;
f5D0A:
	mov	si,dx			; ES:SI -> parameter block
	lods	es:word ptr [si]
	mov	error_code,ax		; copy the appropriate fields
	lods	es:word ptr [si]
	mov	error_class,ah
	mov	error_action,al
	lods	es:word ptr [si]
	mov	error_locus,ah
	add	si,2*WORD		; skip to device
	lods	es:word ptr [si]
	mov	error_dev,ax
	lods	es:word ptr [si]
	mov	error_dev+2,ax
	xor	ax,ax			; return AL=0
	ret
;
;	*****************************
;	*** Get switch character  ***
;	*****************************
;
;
	Public	func37
func37:
	cmp al,1 ! jb f37_getswitch	; Get the current Switch Character
		   je f37_setswitch	; Set the Switch Character
	cmp al,3 ! je f37_s03		; Sub-Func 03 Return Unchanged
	mov dl,0ffh ! jb f37_return_DX	; Sub-Func 02 Return DL == 0FFh
	mov	al,0FFh			; else invalid sub-function
f37_s03:
	ret

f37_getswitch:
	mov	dl,switch_char
f37_return_DX:
	jmp	return_DX		; return current setting in DX

f37_setswitch:
	mov	switch_char,dl
	ret

;**************************************************
;**************************************************
;***						***
;***	  Miscellaneous Isolated Functions	***
;***						***
;**************************************************
;**************************************************
;
;	*****************************
;	***    DOS Function 30    ***
;	***   Get Version Number  ***
;	*****************************

	Public	func30
func30:
if DOS5
	mov	es,current_psp		; version is kept in the PSP
	mov	ax,PSP_VERSION
else
	mov	ax,dos_version		; version returned in AX
endif
ReturnVersionNumber:
	xor	bx,bx			; zero BX and CX
	xor	cx,cx
	call	return_BX
	call	return_CX
	jmp	return_AX_CLC

;
;	*****************************
;	***    DOS Function 33    ***
;	***  Get/Set Cntl-Break   ***
;	*****************************
	Public	func33

; WARNING - called on USER stack

func33:
	cmp	al,2			; range check subfunction
	 jbe	f33_10
	mov	dl,bootDrv		; assume we want boot drive
	cmp	al,5			; did we ?
	 je	f33_30
if DOS5
	cmp	al,6			; get true version ?
	 je	f33_60
endif
	mov	reg_AL[bp],0FFh		; return AL = FF
	ret				; Illegal function request
f33_10:
	and	dl,01h			; force a valid value
	cmp	al,1			; check for get or set
	 jae	f33_20
	mov	dl,break_flag		; it's a get, so use existing setting
f33_20:
	xchg	dl,break_flag		; replace current setting
	 je	f33_40
f33_30:
	mov	reg_DL[bp],dl		; return setting in DL
f33_40:
	ret

if DOS5
f33_60:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -