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

📄 header.a86

📁 一个dos操作系统DRDOS的源码
💻 A86
📖 第 1 页 / 共 3 页
字号:
    org 05ceh - FIXED_DATA_START 
	Public	current_filepos
current_filepos	rw	2

    org 05f0h - FIXED_DATA_START 
	Public	prev_int21regs_ptr, prev_int21regs_off, prev_int21regs_seg
prev_int21regs_ptr	rw	0
prev_int21regs_off	dw	0
prev_int21regs_seg	dw	0

    org 0620h - FIXED_DATA_START 

	Public	indos_stack, error_stack, normal_stack

	Public	fcb_search_buf		; during FCB search 1st/next use bottom
fcb_search_buf	rb	0		;  of error stack as scratch buffer
	;	rb	43		;  - only used during int 21 call

		rw	STACK_SIZE	; Error Processing Stack
error_stack	rw	0

		rw	STACK_SIZE	; Normal Function Stack Area
normal_stack	rw	0

		rw	STACK_SIZE	; Indos Function Stack
indos_stack	rw	0

lookahead_flag	db	0

	Public	rwmode, err_drv, ioexerr
err_drv     db  0       
rwmode      db  0       
ioexerr     db  0       
	public	int2f_cmd, int2f_stack, file_mode
int2f_cmd   dw  0       
int2f_stack dw  0       
file_mode   dw  0       
	Public	cle_state
cle_state   dw  0       
	Public	swap_indos
swap_indos	rw	0

    org 0AADh - FIXED_DATA_START 

Ucasetbl	dw  128	; Table Size
	db	080h, 09ah,  'E',  'A', 08eh,  'A', 08fh, 080h
	db	 'E',  'E',  'E',  'I',  'I',  'I', 08eh, 08fh
	db	090h, 092h, 092h,  'O', 099h,  'O',  'U',  'U'
	db	 'Y', 099h, 09ah, 09bh, 09ch, 09dh, 09eh, 09fh
	db	 'A',  'I',  'O',  'U', 0a5h, 0a5h, 0a6h, 0a7h
	db	0a8h, 0a9h, 0aah, 0abh, 0ach, 0adh, 0aeh, 0afh
	db	0b0h, 0b1h, 0b2h, 0b3h, 0b4h, 0b5h, 0b6h, 0b7h
	db	0b8h, 0b9h, 0bah, 0bbh, 0bch, 0bdh, 0beh, 0bfh
	db	0c0h, 0c1h, 0c2h, 0c3h, 0c4h, 0c5h, 0c6h, 0c7h
	db	0c8h, 0c9h, 0cah, 0cbh, 0cch, 0cdh, 0ceh, 0cfh
	db	0d0h, 0d1h, 0d2h, 0d3h, 0d4h, 0d5h, 0d6h, 0d7h
	db	0d8h, 0d9h, 0dah, 0dbh, 0dch, 0ddh, 0deh, 0dfh
	db	0e0h, 0e1h, 0e2h, 0e3h, 0e4h, 0e5h, 0e6h, 0e7h
	db	0e8h, 0e9h, 0eah, 0ebh, 0ech, 0edh, 0eeh, 0efh
	db	0f0h, 0f1h, 0f2h, 0f3h, 0f4h, 0f5h, 0f6h, 0f7h
	db	0f8h, 0f9h, 0fah, 0fbh, 0fch, 0fdh, 0feh, 0ffh
info2_len	equ	word ptr (offset $ - offset Ucasetbl)


    org 0B2Fh - FIXED_DATA_START 
; Filename upper case table
FileUcasetbl	dw  128	; Table Size
standard_table	rb	0
	db	080h, 09ah,  'E',  'A', 08eh,  'A', 08fh, 080h
	db	 'E',  'E',  'E',  'I',  'I',  'I', 08eh, 08fh
	db	090h, 092h, 092h,  'O', 099h,  'O',  'U',  'U'
	db	 'Y', 099h, 09ah, 09bh, 09ch, 09dh, 09eh, 09fh
	db	 'A',  'I',  'O',  'U', 0a5h, 0a5h, 0a6h, 0a7h
	db	0a8h, 0a9h, 0aah, 0abh, 0ach, 0adh, 0aeh, 0afh
	db	0b0h, 0b1h, 0b2h, 0b3h, 0b4h, 0b5h, 0b6h, 0b7h
	db	0b8h, 0b9h, 0bah, 0bbh, 0bch, 0bdh, 0beh, 0bfh
	db	0c0h, 0c1h, 0c2h, 0c3h, 0c4h, 0c5h, 0c6h, 0c7h
	db	0c8h, 0c9h, 0cah, 0cbh, 0cch, 0cdh, 0ceh, 0cfh
	db	0d0h, 0d1h, 0d2h, 0d3h, 0d4h, 0d5h, 0d6h, 0d7h
	db	0d8h, 0d9h, 0dah, 0dbh, 0dch, 0ddh, 0deh, 0dfh
	db	0e0h, 0e1h, 0e2h, 0e3h, 0e4h, 0e5h, 0e6h, 0e7h
	db	0e8h, 0e9h, 0eah, 0ebh, 0ech, 0edh, 0eeh, 0efh
	db	0f0h, 0f1h, 0f2h, 0f3h, 0f4h, 0f5h, 0f6h, 0f7h
	db	0f8h, 0f9h, 0fah, 0fbh, 0fch, 0fdh, 0feh, 0ffh

info4_len	equ	word ptr (offset $ - offset FileUcasetbl)

    org 0BB1h - FIXED_DATA_START 

FileCharstbl:
		dw  22	; Table Size
	db	 001h, 000h, 0ffh, 000h, 000h, 020h, 002h, 00eh
	db	 02eh, 022h, 02fh, 05ch, 05bh, 05dh, 03ah, 07ch
	db	 03ch, 03eh, 02bh, 03dh, 03bh, 02ch
info5_len	equ	word ptr (offset $ - offset FileCharstbl)

    org 0BE1h - FIXED_DATA_START    

Collatingtbl:
		dw  256	; Table Size
	db	 000h, 001h, 002h, 003h, 004h, 005h, 006h, 007h
	db	 008h, 009h, 00ah, 00bh, 00ch, 00dh, 00eh, 00fh
	db	 010h, 011h, 012h, 013h, 014h, 015h, 016h, 017h
	db	 018h, 019h, 01ah, 01bh, 01ch, 01dh, 01eh, 01fh
	db	 020h, 021h, 022h, 023h, 024h, 025h, 026h, 027h
	db	 028h, 029h, 02ah, 02bh, 02ch, 02dh, 02eh, 02fh
	db	 030h, 031h, 032h, 033h, 034h, 035h, 036h, 037h
	db	 038h, 039h, 03ah, 03bh, 03ch, 03dh, 03eh, 03fh
	db	 040h, 041h, 042h, 043h, 044h, 045h, 046h, 047h
	db	 048h, 049h, 04ah, 04bh, 04ch, 04dh, 04eh, 04fh
	db	 050h, 051h, 052h, 053h, 054h, 055h, 056h, 057h
	db	 058h, 059h, 05ah, 05bh, 05ch, 05dh, 05eh, 05fh
	db	 060h, 041h, 042h, 043h, 044h, 045h, 046h, 047h
	db	 048h, 049h, 04ah, 04bh, 04ch, 04dh, 04eh, 04fh
	db	 050h, 051h, 052h, 053h, 054h, 055h, 056h, 057h
	db	 058h, 059h, 05ah, 07bh, 07ch, 07dh, 07eh, 07fh
	db	 043h, 055h, 045h, 041h, 041h, 041h, 041h, 043h
	db	 045h, 045h, 045h, 049h, 049h, 049h, 041h, 041h
	db	 045h, 041h, 041h, 04fh, 04fh, 04fh, 055h, 055h
	db	 059h, 04fh, 055h, 024h, 024h, 024h, 024h, 024h
	db	 041h, 049h, 04fh, 055h, 04eh, 04eh, 0a6h, 0a7h
	db	 03fh, 0a9h, 0aah, 0abh, 0ach, 021h, 022h, 022h
	db	 0b0h, 0b1h, 0b2h, 0b3h, 0b4h, 0b5h, 0b6h, 0b7h
	db	 0b8h, 0b9h, 0bah, 0bbh, 0bch, 0bdh, 0beh, 0bfh
	db	 0c0h, 0c1h, 0c2h, 0c3h, 0c4h, 0c5h, 0c6h, 0c7h
	db	 0c8h, 0c9h, 0cah, 0cbh, 0cch, 0cdh, 0ceh, 0cfh
	db	 0d0h, 0d1h, 0d2h, 0d3h, 0d4h, 0d5h, 0d6h, 0d7h
	db	 0d8h, 0d9h, 0dah, 0dbh, 0dch, 0ddh, 0deh, 0dfh
	db	 0e0h, 053h, 0e2h, 0e3h, 0e4h, 0e5h, 0e6h, 0e7h
	db	 0e8h, 0e9h, 0eah, 0ebh, 0ech, 0edh, 0eeh, 0efh
	db	 0f0h, 0f1h, 0f2h, 0f3h, 0f4h, 0f5h, 0f6h, 0f7h
	db	 0f8h, 0f9h, 0fah, 0fbh, 0fch, 0fdh, 0feh, 0ffh
info6_len	equ	word ptr (offset $ - offset Collatingtbl)

    org 0CE3h - FIXED_DATA_START    

DBCS_tbl:
		dw	0	; Table Size
	db	 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
	db	 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
info7_len	equ	word ptr (offset $ - offset DBCS_tbl)



    org 0d12h - FIXED_DATA_START    

dos_version	dw	6			; our DOS version number

; Don't know what these are for.....
		db	0c8h,0a6h
		db	0c8h,0a5h
		db	0c8h,0a5h
		db	0c8h,0a5h

; Now we have a list of days in each month
	Public	days_in_month

days_in_month	db	31,28,31,30,31,30	; Jan, Feb, Mar, Apr, May, Jun
		db	31,31,30,31,30,31	; Jul, Aug, Sep, Oct, Nov, Dec
	
    org 0d90h - FIXED_DATA_START    

	Public	last_key_ext

;;last_key_ext	db	0			; flag set if last key zero
;** LINKER BODGE **
; I'd like to do the above, but LINKCMD blows up when I do (it seems to be to
; many relocatable publics in the data segment that do it). So as a work around
; I do the below instead. Since the location is fixed anyway it works out OK.
last_key_ext	equ	byte ptr 0d90h
;** LINKER BODGE **

    org 0e5bh - FIXED_DATA_START    
	
; 
; Extended Error/Class/Action/Locus table. Used in conjuction with
; Int2F/1222 to setup extended error information
		db	13h,0Bh,07h,02h
		db	14h,04h,05h,01h
		db	15h,05h,07h,0FFh
		db	16h,04h,05h,01h
		db	17h,0Bh,04h,02h
		db	18h,04h,05h,01h
		db	19h,05h,01h,02h
		db	1Ah,0Bh,07h,02h
		db	1Bh,0Bh,04h,02h
		db	1Ch,02h,07h,04h
		db	1Dh,05h,04h,0FFh
		db	1Eh,05h,04h,0FFh
		db	1Fh,0Dh,04h,0FFh
		db	20h,0Ah,02h,02h
		db	21h,0Ah,02h,02h
		db	22h,0Bh,07h,02h
		db	32h,09h,03h,03h
		db	23h,07h,04h,01h
		db	24h,01h,04h,05h
		db	0FFh,0Dh,05h,0FFh

    org 0eabh - FIXED_DATA_START    

; This is a translation table from old error codes to extended errors
	db	13h,14h,15h,16h,17h,18h,19h,1Ah
	db	1Bh,1Ch,1Dh,1Eh,1Fh,1Fh,1Fh,22h
	db	24h


; KLUDGE for DRDOS 6.0 security - the word at offset zero in SYSDAT (the
; SYStem DATa page) was the segment of the secure path string, with
; a zero value indicating a non-secure system.
; In order for DRDOS 6 level utilities to run we point SYSDAT at offset
; 10h in the DOS data segment (this unused word is zero). On secure systems
; the new LOGIN TSR will fix up both SYSDAT and the PD value to point to
; it's own dummy SYSDAT, and the utilities will behave correctly.

	Public	@private_data

@private_data	rb	0		; We need some private data
		dw	endOfInstanceData ; 0000 historical PD offset
dummy_sysdat	dw	1		; 0002 historical SYSDAT segment
		dw	offset histbuf1	; 0004 History Control Block 1
		dw	offset histbuf2	; 0006 History Control Block 2
@hist_flg	db	0		; 0008 History Control
					;   Bit 0 = Buffer Select 1 = COMMAND
					;   Bit 1 = History Enable 1 = ENABLE
		db	1		; 0009 Dual Language Version
		db	0		; 000A Current message language
		dw	0		; 000B Extended memory
		db	0		; 000D (was # JMPF entries to fix up)
codeSeg		dw	0		; 000E BDOS code segment (was seg of JMPF table)
hmaRoot		dw	0		; 0010 Root of himem free chain
		dw	0		; 0012 Initial Environment
hmaAlloc	dw	0		; 0014 Root of himem allocation chain
dmd_owner	dw	0		; 0016 Owner below which DMD's not freed
		dw	0		; 0018 Link to upper memory DMD's
LocalMachineID	dw	0		; 001A Patched by multi-tasker to correct value
dmd_address	dw	0		; 001C Address below which DMD's not freed
		dw	offset country_filename
hashptr		dw	0,0		; 0020 hash root
hashmax		dw	0		; 0024 max dir entries hashed
		dw	0		; 0026 was deblock seg
		dw	offset share_stub
					; 0028 share stub offset
		dw	offset globalPrivateData
					; 002A pointer to global private data
		dw	offset int2FBiosHandler
					; 002C pointer to int 2F internal hook
		rw	10		; space for expansion

	Public	deblock_seg, fdos_stub

fdos_stub	dw	fdos_stub_entry
		dw	0		; fixup up at run time

share_stub	dw	invalid_stub,0	; DWORD ptr to 15
		dw	nul_int,0	; SHARE STUB routines
		dw	nul_int,0	; 
		dw	nul_int,0	; 
		dw	nul_int,0	; 
		dw	nul_int,0	; 
		dw	nul_int,0	; 
		dw	nul_int,0	; 
		dw	nul_int,0	; 
		dw	nul_int,0	; 
		dw	invalid_stub,0	; 
		dw	nul_int,0	; 
		dw	nul_int,0	; 
		dw	nul_int,0	; 
		dw	nul_int,0	; 


	Public	WindowsHandleCheck
WindowsHandleCheck db	26h		; MUST follow share_stub
					; patched by switcher


	org	0FC0h - FIXED_DATA_START

childSP		dw	0
childSS		dw	0
childIP		dw	0
childCS		dw	0

;	The following table defines the format of a DOS .EXE format file.
;	The .EXE header is read into this data area and check for integrity
;	
	Public	exe_buffer
exe_buffer	rb	EXE_LENGTH	; Local EXE header buffer


if IDLE_DETECT

	Public	idle_data
	Public	active_cnt, idle_max
	Public	idle_flags, idle_vec

idle_data	rw	0		; Idle State Data Area
active_cnt	dw	0		; InActive Function Count
idle_max	dw	10		; Max No. of consecutive funcs.
idle_flags	dw	IDLE_INIT	; $IDLE$ Has not been loaded
idle_vec	rd	1 		; DWORD pointer to IDLE handler


		Public	int28_delay, int28_reload
int28_delay	dw	0		; No. Consecutive INT28's 
int28_reload	dw	10		; INT28 Delay Reload Value
		dw	indos_flag	; Offset of INDOS_FLAG
		rw	2		; 2 OEM Reserved Words
endif

	org	1000h - FIXED_DATA_START	; nice 4K boundry
						; for multitasker

PCMODE_DSIZE	DSEG	PARA

	Public	data_end
data_end	rw	0


PCMODE_CODE	CSEG	WORD 'DATA'


PCMODE_CODE_START	equ	1000h
	public	MUSTBE1000
MUSTBE1000:

	Public	endOfInstanceData

endOfInstanceData	rw	0

;*** fixed data - init does segment fixups ***

stub_entries	rw	0

	Public	lock_bios, unlock_bios, lock_tables, unlock_tables

lock_bios	dw	lockbios,0		; MSNET critical region stubs
unlock_bios	dw	unlockbios,0		; MSNET critical region stubs
lock_tables	dw	locktables,0		; MSNET critical region stubs
unlock_tables	dw	unlocktables,0		; MSNET critical region stubs

	Public	exec_stub
exec_stub	dw	ExecStub,0		; Int 21 EXEC hook
	public	func4B05_stub
func4B05_stub	dw	Func4B05Stub,0		; Int 21/4B05 hook

NUM_STUB_ENTRIES	equ	(offset $ - offset stub_entries)/4
;*** fixed data ends ***

	cmp	ds:error_flag,0		; JT-FAX uses this code sequence to
	jnz	$			; find the address of the ERROR_FLAG
	mov	sp,0A06h

	test	ss:error_flag,0FFh	; SIDEKICK usues this fragment to
	 jnz	$			; locate the ERROR_FLAG
	push	ss:word ptr int28_flag
	int	28h

;==========================
; Entry points for DOS Code
;==========================
;
; These are normally all of the form
;
;EntryPoint:
;	JMPF	xxxx:RealEntryPoint
;	db	3 dup(?)
;
; When we are in the HMA, and so may disable the HMA during EXEC for EXEPACK
; problems, we convert them to the following
;
;EntryPoint:
;	call	A20Enable
;	JMPF	xxxx:RealEntryPoint
;
; On an exec the A20 gate is disabled. This allows EXEPACKed programs to
; unpack properly. (some exepacked apps have a wrap-round bug which addresses
; the bottom 64K via the HMA).
;
; On the first Int 21 etc the A20Enable routine enables the A20 gate.
;

	extrn	int20_entry:near, int21_entry:near
	extrn	int25_entry:near, int26_entry:near
	extrn	int27_entry:near, int2F_entry:near
	extrn	call5_entry:near

FirstCodeEntryPoint	rw	0

Int20Entry:
	db	0EAh			; JMPF
	dw	int20_entry
	rb	5			; filled in at run time
	

Int21Entry:
	db	0EAh			; JMPF
	dw	int21_entry
	rb	5			; filled in at run time

Int25Entry:
	db	0EAh			; JMPF
	dw	int25_entry
	rb	5			; filled in at run time

Int26Entry:
	db	0EAh			; JMPF
	dw	int26_entry
	rb	5			; filled in at run time

Int27Entry:
	db	0EAh			; JMPF
	dw	int27_entry
	rb	5			; filled in at run time

Int2FEntry:
	db	0EAh			; JMPF
	dw	int2f_entry
	rb	5			; filled in at run time

Call5Entry:
	db	0EAh			; JMPF
	dw	call5_entry
	rb	5			; filled in at run time

LastCodeEntryPoint	rw	0


BIOSA20Enable:
;-------------
; CALLF'd by the BIOS
	call	A20Enable		; do a near call
	sti				; re-enable interrupts
	retf				; RETF to BIOS


A20Disable:
;----------
; On Entry:
;	DX = psp we are execing
	cmp	dx,0FF0h		; if we are above 64K skip the
	 jae	A20Disable10		;  EXE pack kludge
	push	ax
	mov	ah,6			; disable the A20 gate during EXEC
	callf	cs:xmsDriver		;  so buggy EXE packing will work
	pop	ax
A20Disable10:
	ret

A20Enable:
;---------
; On Entry:
;	None
;	WARNING - DS/ES/STACK could be anything
; On Exit:
;	All regs preserved
;
; Unhook our Entry stubs so we don't get here again.
; Enable the global A20 line to make the DOS/BIOS/COMMAND code visible
;
	cli
	push	ax
	push	ds
	mov	ax,0FFFFh
	mov	ds,ax
	mov	ax,ds:.94h		; is the HMA alias for Int 21
	or	ax,ds:.96h		;  zero - if so the HMA is there
	pop	ds
	 jnz	A20Enable10
	pop	ax
	ret

A20Enable10:
; We need to enable the A20 gate, go do so
	push	bx
	mov	cs:oldSS,ss		; save stack
	mov	cs:oldSP,sp
	mov	ax,cs
	mov	ss,ax			; swap to the error stack in case
	mov	sp,offset error_stack	;  3rd part XMS driver needs a lot

	mov	ah,5			; enable A20, ignoring errors as we
	callf	cs:xmsDriver		;  can't do anything about them

	mov	ss,cs:oldSS		; switch back to callers stack
	mov	sp,cs:oldSP

	pop	bx
	pop	ax
	ret

oldSS		dw	0		; save area for stack swap
oldSP		dw	0

;	+++++++++++++++++++++++++++++++++
;	Default Int 24 Handler for DR DOS
;	+++++++++++++++++++++++++++++++++
;
;	Our default critical error handler during boot simply FAIL's all
;	critical errors. When COMMAND.COM is loaded this will install
;	the "normal" Retry/Abort/Ignore handler.
;
;	These interrupts normally point to an IRET.
;
;

Int24Entry:
;==========
	mov	al,3			; return "FAIL"
DummyIRET:
;=========
	iret

;	EXEC Code
;
;	In order to cope with old buggy EXEPACKED programs we need to turn
;	the A20 gate of during the exec, and turn it back on asap.
;	To do this we hook all the DOS code entry points and re-enable the
;	A20 whenever the app issues an Int 21 etc
;


ExecStub:
;========
; On Entry:
;	AX = FCB validity flags

⌨️ 快捷键说明

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