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

📄 header.a86

📁 一个dos操作系统DRDOS的源码
💻 A86
📖 第 1 页 / 共 3 页
字号:
;    File              : $HEADER.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: $
;    HEADER.A86 1.26 94/12/02 09:34:18 
;    added FCB LRU counter and sharing flag    
;    HEADER.A86 1.24 94/11/15 08:53:04
;    Fixed the NWDOS.386 stuff. Still point at startupinfo, but take out the
;    vxdname and the vxdnameseg entries.
;    HEADER.A86 1.23 94/06/28 14:31:07
;    Fix last_key_ext bug
;    HEADER.A86 1.17 93/11/22 15:23:16 
;    Move idle data to instance page to get per domain idle detection 
;    HEADER.A86 1.15 93/11/08 19:09:22 
;    Handle EXEPACK problems even if DOS not in HMA
;    HEADER.A86 1.14 93/11/14 18:14:21
;    Initialise fdos_buf to 2/0
;    HEADER.A86 1.13 93/10/07 19:08:25
;    CALL5 always goes through 0:C0 (or FFFF:D0 alias)
;    HEADER.A86 1.12 93/09/03 20:28:39 
;    Add intl/dbcs support for int 21/6523 (query yes/no char)
;    HEADER.A86 1.11 93/09/02 22:26:24 
;    Make uppercase tables compatible (See COMPATIBLE flag in COUNTRY.SYS)
;    HEADER.A86 1.9 93/08/10 17:41:25 
;    Move code fragments for Rolodex Live
;    HEADER.A86 1.8 93/08/04 15:15:39 
;    re-arrange dummy fcbs
;    HEADER.A86 1.6 93/07/22 19:29:19 
;    add no/yes characters
;    HEADER.A86 1.5 93/07/20 22:46:33 
;    dmd_upper_root defaults to FFFF
;    ENDLOG
;

;	DRDOS Header/Initialization Code
;
; NB.
; On a system where the kernel stays low and history is disabled we throw
; away as much code as possible. This includes the patch area, the command
; line history code, and the BDOS initialisation code.
; As we use the patch area the pointer in the header should be incremented
; in order to retain progressively larger amounts of code.

	include pcmode.equ
	include	vectors.def

	include	i:cmdline.equ
	include	i:doshndl.def
	include	i:driver.equ
	include i:exe.def
	include	i:f52data.def
	include i:fdos.equ
	include	i:mserror.equ
	include	i:psp.def
	include	i:reqhdr.equ
	include	i:country.def

PADDING		equ	14*1024		; offset code start by this much

DOSINROM	equ	0800h
DOSINHMA	equ	1000h


;****************************************************************************
;	The format of the header is FIXED and should not be modified.
;****************************************************************************

PCM_HEADER	CSEG	PARA

	extrn	edit_size:word

	dw	PADDING
	rb	PADDING-2		; Insert Header

	Public	code_start
code_start:

;	jmp	pcmode_init	; PCMODE Init Entry
    db  0E9h       
	dw	pcmode_init-PADDING-3
;	jmp	pcmode_reinit	; PCMODE Re Init Entry
	db	0E9h
	dw	pcmode_reinit-PADDING-6

	Public	pcmode_dseg, os_version, patch_version

pcmode_dseg	dw	0			; 0006h PCMODE Data Segment Pointer
		dw	PADDING			; 0008h	offset of start of code
os_version	dw	1072h			; 000Ah OS version
		dw	patch_area-PADDING	; 000Ch offset of disposable code
		dw	pcmode_init-PADDING	; 000Eh offset of initialisation code
		db	0EAh			; 0010h JMPF (MUST be para aligned)
		dw	4*30h			; 0011h  through the Int 30 vec
		dw	0			; 0013h  to CALL 5 entry point
		rb	7			; 0015h make following offsets same as 5.0
		dw	0			; 001Ch Compressed Data Flag
		dw	code_end-PADDING	; 001Eh PCMODE Code Size in Bytes
		dw	data_end		; 0020h PCMODE Data Length in Bytes
patch_version	dw	DOSINROM+0000h		; 0022h sub-version (was SYSDAT length)
		db	0			; 0024h Kanji Support Flag
		db	0			; 0025h Reserved
		dw	edit_size-PADDING	; 0026h Pointer Command Line Editor
						;       control table.
		dw	NoYesChars		; 0028h offset in data of pointers to 
						; default country info.

;****************************************************************************
;	The format of the data is FIXED and should not be modified.
;****************************************************************************

PCMODE_DATA	DSEG	WORD


	Public	codeSeg			; BDOS code segment
	Public	dmd_root		; Root of DOS Memory List
	Public	hmaRoot			; Root of HMA chain
	Public	func52_data		; Start of the FUNC 52 compatible data
	Public	last_drv		; Last Drive
	Public	phys_drv
	Public	dev_root		; Root of Device List
	Public	nul_device		; NUL Device
	Public	ddsc_ptr
	Public	retcode
	Public	user_retcode
	Public	system_retcode
	Public	break_sp
	Public	net_retry
	Public	net_delay
    Public  file_ptr        
	Public	clk_device		; Clock Device Pointer
	Public	con_device		; Console Device Pointer
	Public	bcb_root		; Linked List of Buffers
	Public	fcb_ptr
	Public	ldt_ptr
	Public	join_drv
	Public	share_stub
	Public	sector_size
	Public	setverPtr
	Public	dos_version

	Public	@hist_flg		; History control flag
	Public	dmd_address		; don't free DMD's with segment under this value
	Public	dmd_owner		; don't free DMD's with owner under this value
	Public	dmd_upper_root		; link to upper memory
	Public	dmd_upper_link
	Public	LocalMachineID		; Normal 0, fixed up by multi-tasker

	Public	biosDate		; 6 byte buffer to read/write clock
	Public	minute
	Public	hour
	Public	hundredth
	Public	second
	Public	dayOfMonth
	Public	month
	Public	yearsSince1980
	Public	daysSince1980
	Public	dayOfWeek


	org	0
		
dos_data	db	0
		dw	code_start
		rb	1	; padding
if DOS5
		dw	1
else
		dw	0
endif


; make end of vladivar instance data public for the multi-tasker
	rb	06h - (offset $ - offset dos_data)
	dw	endOfInstanceData

	rb	0eh - (offset $ - offset dos_data)
	Public	netbios, name_num, fcb_lru_count
netbios		db	0		; NetBios Name Number
name_num	db	0		; 0 - Undefined Name
fcb_lru_count	dw	0		; fcb LRU counter

	rb	26h-0ch-(offset $ - offset dos_data) ; align func52_data on 26

;************************************************************************
;*									*
;*	Below is the DOS defined area of the SYSTEM variables		*
;*	above are variables defined for DR DOS.				*
;*									*
;************************************************************************
net_retry	dw	3		;-000C Network retry count
net_delay	dw	1		;-000A Network delay count
bcb_root	dw	-1,-1		;-0008 Current DOS disk buffer
		dw	0		;-0004 Unread CON input
dmd_root	dw	0		;-0002 Root of DOS Memory List (Segment)
func52_data	rb	0
ddsc_ptr	rd	0		; 0000 DWORD ptr to DDSC
		dw	-1,-1
file_ptr	rd	0		; 0004 DWORD ptr file table
		dw	msdos_file_tbl,0
clk_device	rd	0		; 0008 DWORD ptr Clock Device Header
		dw	-1,-1		;      Initialize to an Invalid Address
con_device	rd	0		; 000C DWORD ptr Console Device Header
		dw	-1,-1		;      Initialize to an Invalid Address
sector_size	dw	128		; 0010 WORD Buffer Size (Max Sector Size)
buf_ptr		dw	buf_info,0	; 0012 DWORD ptr to Disk Buffer Info
ldt_ptr		dw	0,0		; 0016 DWORD ptr Path Structures
fcb_ptr		dw	dummy_fcbs,0	; 001A DWORD ptr FCB Control Structures
		dw	0		; 001E WORD UNKNOWN
phys_drv	db	0		; 0020 BYTE Number of Physical Drives
last_drv	db	0		; 0021 BYTE Last Drive
dev_root	rd	0		; 0022 DWORD ptr Device Driver List
nul_device	dw	-1,-1		;      Next Device Pointer
		dw DA_CHARDEV+DA_ISNUL	; 0026 NUL Device Attributes
		dw	nul_strat	; 0028 NUL Device Strategy routine
		dw	nul_int		; 002A NUL Device Interrupt routine
		db	'NUL     '	; 002C NUL Device Name
join_drv	db	0		; 0034 BYTE Number of JOIN'd drives
		dw	0		; 0035 DOS 4 pointer to special names (always zero in DOS 5)
setverPtr	dw	0,0		; 0037 setver list
		dw	0		; 003B unknown
		dw	0		; 003D psp of last umb exec
		dw	1		; 003F number of buffers
		dw	1		; 0041 size of pre-read buffer
	public	bootDrv
bootDrv		db	0		; 0043 drive we booted from
		db	0		; 0044 cpu type (1 if >=386)
		dw	0		; 0045 Extended memory
buf_info	rd	1		; 0047 disk buffer chain
		dw	0		; 004B 0 (DOS 4 = # hashing chains)
		rd	1		; 004D pre-read buffer
		dw	0		; 0051 # of sectors
		db	0		; 0053 00=conv 01=HMA
		dw	0		; 0054 deblock buf in conv
deblock_seg	dw	0		; 0056 (offset always zero)
		rb	3		; 0058 unknown
		dw	0		; 005B unknown
		db	0, 0FFh, 0	; 005D unknown
		db	0		; 0060 unknown
		dw	0		; 0061 unknown
dmd_upper_link	db	0		; 0063 upper memory link flag
		dw	0		; 0064 unknown
dmd_upper_root	dw	0FFFFh		; 0066 dmd_upper_root
		dw	0		; 0068 para of last mem search

		dw	invalid_stub,0	; 006A DWORD ptr to 15
		dw	nul_int,0	; 006E  SHARE STUB routines
		dw	nul_int,0	; 0072
		dw	nul_int,0	; 0076
		dw	nul_int,0	; 007A
		dw	nul_int,0	; 007E
		dw	nul_int,0	; 0082
		dw	nul_int,0	; 0086
		dw	nul_int,0	; 008A
		dw	nul_int,0	; 008E
		dw	invalid_stub,0	; 0092
		dw	nul_int,0	; 0096
		dw	nul_int,0	; 009A
		dw	nul_int,0	; 009E
		dw	nul_int,0	; 00A2

msdos_file_tbl	dw	-1		; 00A6 1st HDB entries
		dw	-1		; Pointer to next Entry (None)
		dw	5		; Number of Entries

		rb	5*DHNDL_LEN	; Reserve 5 Internal Handles

	rb	1fbh - (offset $ - offset dos_data)

	Public	savbuf
savbuf		rb	128		; cmdline editing temp buffer
	Public	fdos_buf
fdos_buf	db	2,0		; initialise buffer to empty
		rb	128+1		; room for 128 byte readline + LF

	rb	2feh - (offset $ - offset dos_data)
; this byte is used for ^P support
	Public	cio_state
cio_state	db	0		; 0 = no printer echo, ~0 echo
	Public	verify_flag
verify_flag	db	0		; ~0, write with verify

	rb	300h - (offset $ - offset dos_data)
; this byte is used for TAB's
	Public column
column		db	0		; Current Cursor Column
	Public	switch_char
switch_char	db	'/'
	Public	mem_strategy
mem_strategy	db	0		; memory allocation strategy
	Public	sharing_flag
sharing_flag	db	0		; 00 = sharing module not loaded
					; 01 = sharing module loaded, but
					;      open/close for block devices
					;      disabled
					; FF = sharing module loaded,
					;      open/close for block devices
					;      enabled (not implemented)
	Public	net_set_count
net_set_count	db	1		; count the name below was set
	Public	net_name
net_name	db	'               ' ; 15 Character Network Name
		db	00		  ; Terminating 0 byte

; These tables point to routines to be patched by MSNET
		dw	criticalSectionEnable
		dw	criticalSectionEnable
		dw	criticalSectionEnable
		dw	criticalSectionEnable
		dw	0		; terminating null

		rb	1		; padding

;
;	Variables contained the the "STATE_DATA" segment contain
;	information about the STATE of the current DOS Process. These
;	variables must be preserved regardless of the state of the INDOS
;	flag.
;
;	All variables that appear in "STATE_DATA" **MUST** be declared
;	in this file as the offsets from the INTERNAL_DATA variable are
;	critical to the DOS applications that modify this data area.
;
;
	Public	error_flag, indos_flag
	Public	error_locus, error_code
	Public	error_action, error_class
	Public	error_dev, error_drive
	Public  dma_offset, dma_segment
	Public	current_psp, current_dsk
	Public	break_flag

	Public	internal_data

internal_data	rw	0		; <-- Address returned by INT21/5D06
error_flag	db	0		; INDOS - 01 - Error Mode Flag
indos_flag	db	0		; INDOS + 00 - Indos Flag
error_drive	db	0		; INDOS + 01 - Drive on write protect error
error_locus	db	0		; INDOS + 02 - Error Locus
error_code	dw	0		; INDOS + 03 - DOS format error Code
error_action	db	0		; INDOS + 05 - Error Action Code
error_class	db	0		; INDOS + 06 - Error Class
error_dev	rd	1		; INDOS + 07 - Failing Device Address
dma_offset	rw	1		; INDOS + 0B - DMA Offset
dma_segment	rw	1		; INDOS + 0D - DMA Segment	
current_psp	rw	1		; INDOS + 0F - Current PSP
break_sp	rw	1		; INDOS + 11 - used in int 23
retcode		rw	0
user_retcode	db	0		; INDOS + 13 - return code from process
system_retcode	db	0		; INDOS + 14 - reason for process terminate
current_dsk	db	0		; INDOS + 15 - Current Drive
break_flag	db	0		; INDOS + 16 - Break Flag
		dw	0		; INDOS + 17 - unknown

	Public	swap_always
swap_always	rw	0

	Public	int21AX
int21AX		dw	0		; INDOS + 19 - AX from last Int 21

	Public	owning_psp, machine_id
owning_psp	dw	0		; INDOS + 1B - owning psp
machine_id	dw	0		; INDOS + 1D - remote machine ID


	public	load_psp, load_image, load_top, load_max, load_handle
	
load_psp	dw	0		; Paragraph of the new PSP.
load_image	dw	0		; Paragraph of the Load Image.
load_top	dw	0		; Last paragraph of Allocated Memory
load_max	dw	0		; ditto, but not messed with
load_handle	dw	0		; Handle allocated to load file on OPEN

	Public	locus, valid_flg, retry_off, retry_sp
locus		db	0		; Public Error Locus Value
valid_flg	db	0		; Valid Options for Critical Error 
retry_off	dw	0		; IP for Error Retry
retry_sp	dw	0		; SP for Error Retry



; Some important data structures....
	rb	0350h - (offset $ - offset dos_data)	; DOS 5
dayOfMonth		db	0
month			db	0
yearsSince1980		dw	0
daysSince1980		dw	0FFFFh	; force rebuild on first clock read
dayOfWeek		db	0

	public	internal_flag
internal_flag   db  0      

	Public	int28_flag
int28_flag		db	FALSE


	public	ioctlRH

ioctlRH		rb	23		; up to 23 bytes possible

	public	load_env, load_envsize, exe_loadhigh
load_env	dw	0		; Paragraph of the new environment
load_envsize	dw	0		; Size of new environment
exe_loadhigh	db	0		; load high flag


	Public	fcb_pb, fcb_path, fcb_path2

; These variables are used during FCB processing - we build another parameter
; block outside the MXDisk which makes handle calls to the FDOS

fcb_pb		rw	7
fcb_path	rb	15
fcb_path2	rb	15

	public	char_count
char_count	db	0


;****************************************************************************
;	The format of the data is FIXED and should not be modified.
;****************************************************************************

; WARNING - if anyone adds/deletes PCMODE_DATA they MUST adjust these
; values so the following data will origin correctly
FIXED_DOS_DATA	cseg	word

FIXED_DATA_START	equ	3B0h
	public	MUSTBE03B0
MUSTBE03B0:

	org	03b6h - FIXED_DATA_START	; DOS 5
biosDate	dw	0		; days since 1980
minute		db	0
hour		db	0
hundredth	db	0
second		db	0
		rb	2		; padding

	Public	reloc_buf, load_file, RELOC_CNT
RELOC_CNT	equ	80h/16		; buffer 128 bytes here

; function 4B uses these data area's as workspace during an EXEC

	Public	pri_pathname
reloc_buf	rb	0		; shared with primary pathname
pri_pathname	rb	80h
	Public	sec_pathname
load_file	rb	0
sec_pathname	rb	80h
	Public	srch_buf
srch_buf	rb	21+32		; 21 byte srch state, 32 byte dir entry
	Public	temp_ldt
temp_ldt	rb	LDT_LEN
	Public	name_buf
name_buf	rb	32		; space enough for 1 dir entry

magic_byte	db	0
		rb	1		; padding
	Public	file_attrib
file_attrib	dw	0
		rb	3		; padding
	Public	remote_call
remote_call	dw	0


    org 057Ch - FIXED_DATA_START 
	Public	exit_type		; used by break and critical error
exit_type	db	0		;  handlers during termination
		rb	1		; padding
	Public	term_psp
term_psp    dw  0       

	Public	int24_esbp
int24_esbp	rw	2
	Public	int21regs_ptr, int21regs_off, int21regs_seg
int21regs_ptr	rw	0
int21regs_off	dw	0
int21regs_seg	dw	0
	public	critical_sp
critical_sp	dw	0		; critical error internal stack
	Public	current_ddsc
current_ddsc	rw	2

    org 059ah - FIXED_DATA_START 
	Public	current_device
current_device	rw	2
	Public	current_dhndl
current_dhndl	rw	2
	Public	current_ldt
current_ldt	rw	2
		rw	2		; pointer to callers FCB
	Public	current_ifn
current_ifn	dw	0

    org 05b2h - FIXED_DATA_START 
		dw	offset pri_pathname
		dw	offset sec_pathname
		dw	offset pri_pathname

⌨️ 快捷键说明

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