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

📄 disk.a86

📁 一个dos操作系统DRDOS的源码
💻 A86
📖 第 1 页 / 共 3 页
字号:
;    File              : $DISK.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$
;    DISK.A86 1.26 94/12/01 10:05:21
;    added attribute support for open/move/unlink during server call
;    DISK.A86 1.24 93/11/16 13:46:21
;    Generate critical error on int21/36 (get free space)
;    DISK.A86 1.23 93/10/25 21:58:02
;    Tighten up error checks on int21/6C modes (DL bits 0-3 = 3 rejected)
;    DISK.A86 1.22 93/10/18 17:40:51
;    fix for >255 open files (PNW Server)
;    DISK.A86 1.21 93/09/03 20:28:02
;    Add "no critical errors" support (int 21/6C)
;    DISK.A86 1.20 93/08/04 15:15:15
;    Int21/6C allows DH=1 
;    DISK.A86 1.19 93/07/22 20:32:12 
;    don't check AL on int 21/6c
;    DISK.A86 1.18 93/07/22 19:28:02
;    correct bug in extended open/create
;    DISK.A86 1.15 93/06/23 04:05:38
;    more int21/6C - we still need no critical errors support
;    DISK.A86 1.14 93/06/23 03:00:27
;    fix bug in int21/6C
;    DISK.A86 1.13 93/05/07 15:09:29
;    Move delwatch free space adjust call inside the MXDisk
;    DISK.A86 1.12 93/03/16 22:33:49
;    UNDELETE support changes
;    DISK.A86 1.11 93/03/05 18:10:55
;    Add UNDELETE definition
;    ENDLOG
;
;	All FCB based PCMODE functions are translated to FDOS function
;	calls in this file.
;
; 22 May 87 Support the extended CHMOD function to get/set the
;           password mode.
; 28 May 87 Support the Update Handle Count Function
;  5 Nov 87 Remove MAJOR_VER reference from func0D
; 15 Mar 88 Return Attributes in CX and AX
;  3 May 88 Return correct disk size from functions 1B, 1C and 36
; 17 May 88 Add valid drive check routine used by FUNC29 and FUNC4B
; 30 Jun 88 Call FDOS to build DDSC for INT21/53
; 18 Aug 88 FUNC67 correctly fill new handle table with 0FFh
;           Sorcim ACCPAC Plus
; 27 Sep 88 Return error codes from Read and Write Random.
; 19 Feb 89 Allowing SHARE to be disabled with DR DOS
; 16 May 89 Include Random Record field on func23 (file size)
; 23 May 89 func3F (Read) now allows Ignore on errors (CopyIIpc)
; 11 Sep 89 MSNET Flush hook added
; 20 Sep 89 func3B "d:=" form fills in LDT (func4B support)
; 24 Oct 89 func32 (getdpb) sets top bit of drive on fdos_getdpb
;           to indicate free space count not required
; 27 Oct 89 mutilate the code to save space
; 24 Jan 90 valid_drive uses dos_entry, doesn't peek at HDS's
;  8 Feb 90 func_43 updated for new password support
; 27 Feb 90 func57 gives ED_FUNCTION if not get/set (HEADROOM bug)
;  7 Mar 90 Convert to register preserved function calls
; 14 Mar 90 Share func3D_mask bodge move to FDOS
; 28 Sep 90 Return sectors xfered on Int21/27 even if error (CALC.EXE>64k)
; 14 mar 91 add delwatch hook to func36 (disk free space)
; 14 jun 91 correct error codes from func3F during func4B
;  8 aug 91 func3B (chdir) now maintains LDT name for all cases
;  1 oct 91  Valdivar it
; 27 feb 92 func3E returns previous open count
;  3 mar 92 fill in default search attribute in Func3D for future
; 23 mar 92 func67 will now shrink #handles
;

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

FCB_LEN		equ	32
XFCB_LEN	equ	FCB_LEN+7


PCM_CODE	CSEG	BYTE
	extrn	dbcs_lead:near
	extrn	dos_entry:near
	extrn	fdos_nocrit:near
	extrn	fdos_crit:near, fdos_ax_crit:near
	extrn	fcbfdos_crit:near
	extrn	set_retry:near
	extrn	set_retry_RF:near
	extrn	error_exit:near
	extrn	error_ret:near
	extrn	fcberror_exit:near

	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

;	*****************************
;	***    DOS Function 0D    ***
;	***      Disk Reset       ***
;	*****************************
;
	Public	func0D
func0D:
	mov	FD_FUNC,FD_FLUSH
	call	fdos_nocrit		; flush buffers
	mov	ax,0FFFFh
	push	ax
	mov	ax,I2F_FLUSH
	int	2fh			; magic INT2F flush remote buffers
	pop	ax
	push ss ! pop ds
	ret

;	*****************************
;	***    DOS Function 0E    ***
;	***      Select Disk      ***
;	*****************************
;
	Public	func0E
func0E:
;
; Entry:
;	DL  ==	drive to set as default (0 == A:)
; Exit:
;	AL  ==  Number of Drives in System (from SYSDAT)
;
	mov	FD_FUNC,FD_SELECT
	xchg	ax,dx			; drive in AL
	cbw				; make that AX
	mov	FD_DRIVE,ax
	call	fdos_nocrit		; ask the FDOS to try to select it
	mov	al,last_drv		; Return the number of valid drives
	ret

;
;	Return with the ZERO flag set if the drive passed in AL is
;	valid. This function is used to set the initial AX value
;	when a program is loaded.
;
;	On Entry:-	AL	00 	 - Default Drive
;				01 to 26 - A: to Z:
;
;	On Exit:-	ZF	If AL referenced a valid drive
;
	Public	valid_drive
valid_drive:
	push	dx
	mov	dl,al			; get drive in DL
	dec	dl			; make drive zero based
	 js	valid_drive10		; if current drive always OK
	mov	ah,MS_DRV_GET
	call	dos_entry		; get current drive
	push	ax			; save for later
	mov	ah,MS_DRV_SET
	call	dos_entry		; try and select new drive
	mov	ah,MS_DRV_GET		;  if we can select it
	call	dos_entry		;  then it's valid
	sub	al,dl			; AL = 0 if drive valid
	pop	dx			; recover old drive
	push	ax			; save result
	mov	ah,MS_DRV_SET
	call	dos_entry		; reset to original drive
	pop	ax			; recover result
valid_drive10:
	pop	dx
	test	al,al			; set ZF if valid drive
	ret

eject
;	*****************************
;	***    DOS Function 0F    ***
;	***    Open File (FCB)    ***
;	*****************************
;
	Public	func0F
func0F:

;	*****************************
;	***    DOS Function 10    ***
;	***    Close File (FCB)   ***
;	*****************************
;
	Public	func10
func10:

;	*****************************
;	***    DOS Function 11    ***
;	***   Search First (FCB)  ***
;	*****************************
;
	Public	func11
func11:

;	*****************************
;	***    DOS Function 12    ***
;	***   Search Next (FCB)   ***
;	*****************************
;
	Public	func12
func12:

;	*****************************
;	***    DOS Function 13    ***
;	***   Delete File (FCB)   ***
;	*****************************
;
	Public	func13
func13:

;	*****************************
;	***    DOS Function 14    ***
;	*** Sequential Read (FCB) ***
;	*****************************
;
	Public	func14
func14:

;	*****************************
;	***    DOS Function 15    ***
;	*** Sequential Write (FCB)***
;	*****************************
;
	Public	func15
func15:

;	*****************************
;	***    DOS Function 16    ***
;	***   Create File (FCB)   ***
;	*****************************
;
	Public	func16
func16:

;	*****************************
;	***    DOS Function 17    ***
;	***   Rename File (FCB)   ***
;	*****************************
;
	Public	func17
func17:

;	*****************************
;	***    DOS Function 21    ***
;	***   Random Read (FCB)   ***
;	*****************************
;
	Public	func21
func21:

;	*****************************
;	***    DOS Function 22    ***
;	***   Random Write (FCB)  ***
;	*****************************
;
	Public	func22
func22:

;	*****************************
;	***    DOS Function 23    ***
;	***    File Size (FCB)    ***
;	*****************************
;
	Public	func23
func23:

;	*****************************
;	***    DOS Function 24    ***
;	***  Set Relative Record  ***
;	*****************************
;
	Public	func24
func24:

;	*****************************
;	***    DOS Function 27    ***
;	***   Random Block Read   ***
;	*****************************
;
	Public	func27
func27:

;	*****************************
;	***    DOS Function 28    ***
;	***   Random Block Write  ***
;	*****************************
;
	Public	func28
func28:
; All FCB function come through here
	call	set_retry_RF		; Valid to RETRY or FAIL
	mov	ax,FD_FCB		; FCB file function
	xchg	ax,FD_FUNC		; recover function number
	mov	FD_FCBFUNC,ax		; pass FCB function number
	mov	FD_FCBOFF,dx		; Initialise the FCB Pointer
	mov	FD_FCBSEG,es
	mov	FD_FCBCNT,cx		; we may need record count
	call	fcbfdos_crit		; Execute the function
	 jc	fcb_error		; Check for an Error
	mov	cx,FD_FCBCNT		; Get the number of records
	jmp	return_CX		; processed and return in CX
fcb_error:
	jmp	fcberror_exit		; Use default Error handler



eject
;	*****************************
;	***    DOS Function 19    ***
;	***      Current Disk     ***
;	*****************************

	Public	func19
func19:
	mov	al,current_dsk		; Get the current logical disk
	ret				; and return


;	*****************************
;	***    DOS Function 1A    ***
;	***   Set Disk Trans Adr  ***
;	*****************************

	Public	func1A
func1A:
	mov	dma_offset,dx		; set the PCMODE DMA Offset
	mov	dma_segment,es		;  and then the DMA Segment
	ret

;	*****************************
;	***    DOS Function 1B    ***
;	***    Def. Disk Info     ***
;	*****************************
;
	Public	func1B
func1B:

;	*****************************
;	***    DOS Function 1C    ***
;	***    Sel. Disk Info     ***
;	*****************************
;
	Public	func1C
func1C:
	call	set_retry_RF		; Valid to RETRY or FAIL
	xor	dh,dh			; Pass the drive requested
	call	fdos_DISKINFO		; find out about drive
	 jc	fdos_DI_error

	mov	cx,es:DDSC_SECSIZE[bx]	; Get the Physical Sector Size
	call	return_CX		; in bytes

	mov	dx,es:DDSC_NCLSTRS[bx]	; Convert the last cluster no
	dec	dx			; returned in DDSC to maximum

⌨️ 快捷键说明

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