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

📄 pcmif.a86

📁 一个dos操作系统DRDOS的源码
💻 A86
📖 第 1 页 / 共 3 页
字号:
;    File              : $PCMIF.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: $
;    PCMIF.A86 1.21 93/09/09 22:36:50
;    Int 21/59 uses error stack 
;    PCMIF.A86 1.20 93/08/27 18:56:30 
;    Int 25/26 32 bit sector detection
;    PCMIF.A86 1.19 93/07/22 19:30:54 
;    chnage int 25/26 support for NDD 
;    PCMIF.A86 1.18 93/07/20 22:47:54 
;    Even fewer checks on int 25/26 
;    PCMIF.A86 1.14 93/05/06 19:28:31
;    Move int 23/28 support to CIO.
;    PCMIF.A86 1.13 93/05/05 23:31:0
;    int 2A/84 is now only generated on input-and-wait functions
;    PCMIF.A86 1.12 93/03/25 15:06:48
;    tweak int21 entry
;    ENDLOG
;
; 24 Aug 87 The CARRY flag is now preserved for all DOS functions below
;           038h Get/Set Country Code.
; 04 Sep 87 Display the Interrupt Number and Registers when an illegal
;           software interrupt is executed by an application. This
;           is disabled by DBG OFF.
; 09 Sep 87 DDIO interface changed to support a Double Word sector
;           number.
; 05 Oct 87 Critical Error abort routine now uses the correct 
;           terminate code.
; 14 Oct 87 INT2F responds like a Network Redirector
; 28 Oct 87 Preserve the state of the INDOS_INTERNAL flag during multiple
;           calls through DOS_ENTRY
; 29 Oct 87 DS now points at the IBM PC ROS during an INT1B and INT1B
;           moved into IBMROS.
;  7 Nov 87 Removal of development flags
;  5 Jan 88 Terminate CP/M applications making DOS Calls in Concurrent DOS
; 26 Feb 88 Terminate DOS applications making CP/M calls in DOSPLUS
; 26 Apr 88 INT25/26 error codes only translated for Concurrent
; 18 May 88 Prevent corruption of the EXIT_CODE by INT23 and INT24
;           when the application does not return.
; 23 May 88 Prevent termination during CONFIG.SYS processing in DOSPLUS
; 26 May 88 Force INDOS and ERROR flags to ZERO on terminate
;  1 Jun 88 Modify INT28 to execute delays and work with SideKick.
; 15 Jul 88 Support the IDLECNT field in the Process Descriptor and
;           CCB BUSY bit.
; 07 Sep 88 PolyTron PolyWindows make DOS functions calls whenever
;           CS < SS. Therefore during the INT21 Entry and Exit code
;           interrupts must be disabled untill the stack swap occurs
;           even though the INDOS_FLAG is non-zero.
; 24 Oct 88 File Lock/Unlock is now treated as an INACTIVE function.
;  4 Nov 88 Correct the INT25/26 Error Translation Code
; 21 Nov 88 Make INt25/26 Error Translation even better.
; 29 Nov 88 Command Line Editor Insert on by default.
; 21 Dec 88 IJs IDLE detection improvement only DELAY if someone else is
;           ready to run.
; 11 Jan 89 Inc/Dec INTERNAL_FLAG to support DOS_ENTRY reentrancy.
; 30 Jan 89 Inc/Dec INDOS_FLAG to INT25/26 Direct Disk I/O (CHKDSK/PRINT)
; 19 Feb 89 Check the SHARE_FLAG for SHARING status in DR DOS
;  9 Mar 89 Save/Restore PSP_USERSP/SS round int28's (SKPLUS/LINK/CTRL-C)
; 18 Apr 89 ij	Maintain the INDOS_FLAG correctly while processing INT 24
; 18 Apr 89 Only take over INTs 5B and 5C for Debug Systems
; 22 May 89 Setup DS before testing the state of the Share Flag.
; 25 May 89 Support INT28_FLAG for functions 01 to 0C inclusive
; 31 May 89 Move break_sp into DOS internal data area
;  1 Jun 89 Save PSP_USERSS and SP during a critival Error (INT 24)
; 05 Jun 89 Return NOT present for ASSIGN command and TRUE state for APPEND
; 29 Jun 89 Save/restore retry_sp & retry_off around INT 24
; 10 Jul 89 INT27 corrected to handle memory size of XXX1 (INFORM)
; 31 Jul 89 Move stacks to DATA.PCM (CDROM support under way...)
; 11 Aug 89 Create INT2F.PCM to support real INT 2F functions
;  6 Sep 89 INT2A/84 keyboard busy loop added to do_int28
; 23 Oct 89 MON_PERM removed from func5D/func5E/func5F (pain with MSNET..)
;  9 Nov 89 Int 5B & 5C no longer taken over in DRDOS Debug versions
;           (Conflicts with PC-Net)
; 15 Jan 90 pcmode_swapin/pcmode_swapout added for paged isr support
; 25/Jan/90 Support Idle Data Area
; 25/Jan/90 Add forth stack to support Japanese FEP and PTHOT.
; 29/Jan/90 keep int21 CS/IP/FLAGS on local stack
; 13/Feb/90 Added func63.
; 20/Feb/90 CDOS checks caller is DOS process and aborts if not.
; 22/Feb/90 Int25/26 checks disk label for passwords
;           Also swaps to normal stack like others DOS's
;  7 Mar 90 Convert to register preserved function calls
; 16 Mar 90 Int25/26 checks out for Leopard Beta 2
;  4 Jun 90 Int21/25&35 don't swap stacks-ANSI.SYS Framework DOS window bug
;  7 Jun 90 Print Rite fix moves to init.pcm
; 29 Jun 90 CDOS idle detection uses timer info
;  9 Aug 90 Int 8 tick count packed in P_CMOD
; 19 Sep 90 load current_psp before checking PSP_PIDF (thanks Datapac)
;  4 Oct 90 improved control break handling
; 11 Oct 90 dev_map now supported to set LPTn/COMn mapping
;  1 Nov 90 default Int 24 handler returns "Fail"
; 19 feb 91 do_int28 calls read_time_and_date (BIOS CLOCK needs a call
;           every day)
; 14 jun 91 copy user regs to local copy after int24 for pcshell
;  8 aug 91 SI preserved on Int25/26 for SCAN 7.7

	include	pcmode.equ
	include	fdos.def
	include	vectors.def
	include	i:msdos.equ
	include	i:mserror.equ
	include	i:psp.def
	include	i:fdos.equ

PCM_CODE	CSEG	BYTE

	extrn	pcmode_dseg:word
	extrn	break_check:near		; Control-C Check 
	extrn	error_exit:near
	extrn	fdos_nocrit:near
	extrn	get_ddsc:near

eject
;
;	This entry point is used when a CALLF PSP:0005 has been executed
;	Here the function number is passed in CL and not AH and only
;	functions 0 to 24 inclusive can be executed.
;
;		Entry Stack	->	INT 21 Stack
;
; SP + 04	Return Offset		Current Flags
; SP + 02	 PSP Segment		 PSP Segment
; SP + 00	   000Ah		Return Offset
;
	Public	call5_entry
call5_entry:
	pop	ax		; Remove 000Ah return Offset
	pushf			; Save the Flags
	push bp	! mov bp,sp	; Get Stack Frame Pointer
	mov	ax,02[bp]	; Get the FLAGS
	xchg	ax,06[bp]	; Swap with the return offset
	mov	02[bp],ax	; and then save the return offset
	pop	bp		; Restore the BP register
	mov	ah,cl		; Make it look like an INT 21
	cmp	ah,024h		; Check for a valid function for this
	jbe	int21_entry	; entry technique if not return
illegal_iret:
	mov	al,0
	iret

int21_e01:
	mov	ds,word ptr .INT31_SEGMENT
	jmps	int21_e02

eject
;	++++++++++++++++++++++++++
;	Int 20 - Program Terminate
;	++++++++++++++++++++++++++
;
	Public	int20_entry
int20_entry:
    mov ah,00h          
;	jmps	int21_entry		; and jump to the standard entry point

eject
;	+++++++++++++++++++++++++
;	Int 21 - Function Request
;	+++++++++++++++++++++++++
;
	Public	int21_entry
int21_entry:
	cmp	ah,pcmode_ftl		; is it in range ?
	 ja	illegal_iret		;  no, return BEFORE enabling ints
	cld				; Clear the direction flag
	PUSH$DOS			; Save User Registers
	mov	ds,pcmode_dseg		; get CS relative Data Segment
	test	pcmode_dseg,0FFFFh	; if Data Segment is zero then get
	 jz	int21_e01		; the Data segment address from
int21_e02:				; the segment portion of INT 31

;
;	The following routines execute on the users stack without
;	modifing the INDOS_FLAG etc. These routines should only read
;	or update BASIC system variables.
;
	cmp	ah,33h			; Func 33h - Control Break
	 je	int21_e10
	cmp	ah,50h			; Func 50h - Set PSP
	 jb	int21_e20
	cmp	ah,51h			; Func 51h - Get PSP
	 jbe	int21_e10
	cmp	ah,62h			; Func 62h - Get PSP
	 jne	int21_e20
int21_e10:
	mov	bp,sp			; Calculate the Stack Frame address
	call	internal_func		; "jump" to appropriate routine
	jmp	int21_exit

int21_e20:
	inc	indos_flag		; Increment the INDOS Flag

	mov	int21AX,ax		; save function number

if DOS5
	cmp	WindowsHandleCheck,26h	; is windows active ?
	 jne	int21_e30
	mov	ax,LocalMachineID	; get local machine ID (zero unless
	mov	machine_id,ax		;  we are multi-tasking)
else
    callf   win386_local_machine    
	cmp	machine_id,0		; did it nobble the machine ID
	 jnz	int21_e30		; if so leave it alone

	mov	ax,LocalMachineID	; get local machine ID (zero unless
	mov	machine_id,ax		;  we are multi-tasking)
endif
int21_e30:
	mov	ax,current_psp
	mov	owning_psp,ax
	mov	es,ax			; Get the PSP

	mov	ax,sp
	mov	PSP_USERSP,ax		; Save the SS:SP pointer to 
	mov	PSP_USERSS,ss		; the register image ready for any
					; Critical errors that might occur

	xchg	ax,int21regs_off	; point to callers registers
	mov	prev_int21regs_off,ax	; while saving current
	mov	ax,ss			;  pointer to cater for
	xchg	ax,int21regs_seg	;  re-entrancy
	mov	prev_int21regs_seg,ax

	xor	ax,ax
	mov	remote_call,ax		; indicate we are a local call
	mov	int28_flag,al		; Do NOT Generate INT 28s

	mov	ax,ds
	mov	ss,ax			; swap initially to the error
	mov	sp,offset error_stack	;  stack until we know better
	mov	ax,int21AX		; reload AX

	sti
	cmp	ah,59h			; Func 59h - Return Extended Error
	 je	int21_e50		;  use the error stack
	cmp	ah,0Ch			; are we a character function
	 ja	int21_e40		;  in range 01-0C ?
	cmp	ah,00h
	 je	int21_e40
	cmp	error_flag,0		; Use the "ERROR" Stack for the above
	 jnz	int21_e50		;  functions 01-0C if error_flag set
	mov	sp,offset indos_stack	; else use the "INDOS" stack for these
	mov	int28_flag,TRUE		;  functions and generate INT 28s
	jmps	int21_e50

int21_e40:
	mov	error_flag,0		; clear the error flag in case someone
					; hasn't returned from an Int 24
	push	ax			; save function on stack
	mov	ah,82h			; magic number in AH
	int	2ah			; call server hook
	pop	ax			; recover function number

	mov	sp,offset normal_stack	; switch to the NORMAL stack
	test	break_flag,0FFh		; is the Break Flag ON
	 jz	int21_e50		;  NO - So continue
	call	break_check		; Handle the Control-C
int21_e50:
if IDLE_DETECT
	test	idle_flags,IDLE_DISABLE	; don't break the pipeline unless
	 jz	int21_idle		;  IDLE checking enabled
int21_e60:
endif
	call	int21_func		; Execute the function
	cli				; Stop anybody interfering
	les	bp,int21regs_ptr	; point to user stack
	mov	es:reg_AL[bp],al	; always return AL
	mov	ax,prev_int21regs_off
	mov	int21regs_off,ax
	mov	ax,prev_int21regs_seg
	mov	int21regs_seg,ax
	mov	ax,es
	mov	ss,ax			; back to users stack
	mov	sp,bp
	dec	indos_flag		; Decrement the INDOS_FLAG
;	jmp	int21_exit

	Public	int21_exit
int21_exit:
	POP$DOS				; Restore Registers
	iret

eject
if IDLE_DETECT
; Only called if Idle detection is enabled
; AH,DL as on Int 21 Entry
; Decide if function is active/inactive

int21_idle:
;----------
if IDLE_DETECT
	mov	bx,int28_reload		; reset the INT28 delay counter
	mov	int28_delay,bx		;  with the Reload value
endif
	cmp ah,5Ch ! je int21_inactive	; Treat Lock/Unlock as inactive some
					; applications poll locked record.
	cmp ah,44h ! je int21_inactive	; IO Control Treated as Inactive
	cmp ah,2Ch ! ja int21_active	; > Get Current Time all active
		     je int21_inactive	; Get Current Time inactive
	cmp ah,2Ah ! je int21_inactive	; Get Current Date inactive
	cmp ah,0Bh ! je int21_inactive	; Console Status
	cmp ah,0Ch ! je int21_inactive	; Flush and Invoke Treated as Inactive
	cmp ah,19h ! je int21_inactive	; Get Current Disk
	cmp ah,06h ! jne int21_active	; Treat RAW_IO Status as Inactive
	cmp dl,0FFh ! je int21_inactive	;

int21_active:				; Active function Executed
	or	idle_flags,IDLE_DOSFUNC	; set DOSFUNC flag for BIOS
	call	active			; remember we were active
	jmps	int21_e60		; continue execution

int21_inactive:
	call	inactive		; Process this INACTIVE function
	jmps	int21_e60


⌨️ 快捷键说明

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