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

📄 winsrch.asm

📁 Dos6.0
💻 ASM
📖 第 1 页 / 共 5 页
字号:
;
; The option ROM area that sometimes Compaq's VIDEO ROM is remapped to is
; checked.  If nothing is there then fine.
;
	mov	ax,REMAP_VIDEO_ROM_SEGMENT
	call	CheckForROMHeader
	jnc	short CVRexit
;
; If there is something there then check to see if it is Compaq's VIDEO ROM.
; If it is (CY = clear) then this area can still be used as a EMS window.
; Otherwise it can't.
;
	call	CheckForCompaqROM
	jc	short CVR_InUse

; Identified Video ROM @ E000, add it to our high scan set as being available

	movzx	di, byte ptr cs:[HighSet]
	add	byte ptr cs:[HighSet], 4
	mov	word ptr cs:[HighSet][di], 0E000h	; start of video rom
	dec	ax
	mov	word ptr cs:[HighSet][di+2], ax 	;   end of video rom
	jmp	short CVRexit

CVR_InUse:
	call	UpdatePageArray

CVRexit:
	pop	ax
	ret
CPQVideoROM	endp

ifdef	ROMCOMP

;===============================================================================
;==
;==  CPQROMcheck: Detect CPQ ROMs which have unused space in the F000 segment.
;==
;== 		  32K ROMs F000:0    - F000:7FFF = mirror image of
;==			   F000:8000 - F000:FFFF
;==
;==   		    	386G  Deskpr 386/16, 386/20, 386/25
;==   			386F  Deskpro 386s
;==   			386H  Deskpro 386/20e (Horizon only)
;==
;== 		  40K ROMs F000:0    - F000:5FFF   junk
;==			   F000:6000 - F000:FFFF = system ROM
;==
;==   			386H  Deskpro 386/20e (Gambler only)
;==   			386H  Deskpro 386/25e
;==   			386L  Deskpro 386/33
;==
;==		  64K ROMs F000:0    - F000:FFFF
;==
;==	   		386P  Portable 386
;==			386E  Systempro/Deskpro 486/25
;==			386D  Deskpro 386n
;==
;==  		  The pointers which need to be changed in order to
;==		  reclaim the lower 32K space include:
;==
;==			1BD0	dummy end of interrupt handler
;==			1C1F	IRQ 9 entry point
;==			1C28	287 error entry point
;==			20FB	diskette parameter table entry point
;==			2E12	fixed disk BIOS entry point
;==			2FA4	old fixed disk hardware entry point
;==			3343	fixed disk hardware entry point
;==			4A97	real-time clock entry point
;==
;==  Enter:
;==
;==  Exit:
;==
;===============================================================================
pCutTable	equ	801Eh		; pointer to cut-off table
CTsig		equ	1234h		; signature

tSegBase	equ	1		; segment base
tPOST		equ	2		; POST
tRunTime	equ	3		; Run-Time
tSetup		equ	4		; Setup
tVideo		equ	5		; System video (int 42h)
tProt16		equ	6		; 16 bit protected mode capable code
tProt32		equ	7		; 32 bit protected mode capable code

sCutTable 	struc
  sCTsig	dw	CTsig		; signature
  sCTnum	db	?		; number of entries
  sCTtype	db	?		; type of entry
  sCTaddr	dw	?		; address
sCutTable 	ends

sCutTableEntry 	struc
  sCTEtype	db	?		; type of entry
  sCTEaddr	dw	?		; address
sCutTableEntry	ends

CPQROMcheck proc	near
	pusha
	push	ds
	push	es
	push	fs

	call	IsCompaq		;Q: Is it a Compaq 386
	jnz	CRcExit			; N: can't use ROM space

	cmp	cs:[ROMparm],TRUE	;Q: Was ROM(Compress) parameter set?
	jne	CRcExit			; N: don't use ROM space

	cmp	cs:[UMBset],TRUE	;Q: Was RAM specified?
	je	short CRcRAM		; Y: RAM was implied

	cmp	gs:[NoEMSset],TRUE	;Q: Was NoEMS specified?
	je	short CRcRAM		; Y: RAM was implied

	cmp	gs:[NoPFset],TRUE	;Q: Was FRAME=NONE specified?
	jne	CRcExit			; N: RAM not implied

;
;  Need to detect ROMs, include RAM, and fix the vectors (end of init)
;
CRcRAM:

	mov	ax,0F000h
	mov	fs,ax
	mov	ax,cs
	mov	es,ax
	assume	es:LAST
;
;  Access cut-off table
;
	mov	bx,fs:[pCutTable]	; get pointer to cut-off table
	cmp	fs:[bx].sCTsig,CTsig	;Q: Is this a valid table?
	jne	CRcExit			; N: no ROM compression
	movzx	cx,fs:[bx].sCTnum	; Y: get number of entries
	jcxz	CRcExit			; no ROM compression if no entries
;
;  Get segment base (assume F0000h)
;
	push	bx
CRcBase:
	mov	ax,fs:[bx].sCTaddr	; get possible base
	cmp	fs:[bx].sCTtype,tSegBase;Q: Is this the segment base entry?
	je	short CRcBaseDone	; Y: get base
	add	bx,size sCutTableEntry	; N: next entry
	loop	CRcBase
	mov	ax,0F000h		; default to F000h
CRcBaseDone:
	pop	bx
;
;  Get size of POST code
;
	movzx	cx,fs:[bx].sCTnum	; get number of entries again
CRcPOST:
	cmp	fs:[bx].sCTtype,tPOST	;Q: Is this the POST entry?
	je	short CRcPOSTdone	; Y: get base
	add	bx,size sCutTableEntry	; N: next entry
	loop	CRcPOST
	jmp	short CRcExit		; no ROM compression if no entries
CRcPOSTdone:
	mov	bx,fs:[bx].sCTaddr	; get size of POST
	inc	bx
	jmp	short CRcAddRAM		; map RAM

ifdef	ROMCOMP
	mov	al,fs:[0FFE4h]		; get ROM type

;
;  Check for 64K ROMs
;
	lea	di,ROM64k
	mov	cx,Num64kROMs
	repne scas ROM64k		;Q: 64K ROM?
	je	CRcExit			; Y: no ROM compression

;
;  Check for 40K ROMs
;
	mov	bx,6000h		; start of 40K ROMs
	lea	di,ROM40k
	mov	cx,Num40kROMs
	repne scas ROM40k		;Q: 40K ROM?
	je	short CRcCompress	; Y: ROM compression

;
;  Check for 32K ROMs
;
	mov	bx,8000h		; start of 32K ROMs
	lea	di,ROM32k
	mov	cx,Num32kROMs
	repne scas ROM32k		;Q: 32K ROM?
	jne	CRcExit			; N: no ROM compression
;
;  Compress the System ROM
;
CRcCompress:

	or	gs:[GenFlags],fROMComp  ; set ROM compression flag
	mov	cs:[ROMstart],bx	; save starting of ROM after compression

;
;  Map lower image of ROM with RAM
;
	mov	ax,0F000h		; start of RAM
endif

CRcAddRAM:
	shr	bx,4
	add	bx,ax			; end of RAM
	dec	bx
	movzx	di,byte ptr cs:[RAMset]	; add to RAM list
	add	byte ptr cs:[RAMset],4
	mov	cs:[RAMset][di],ax	; from F000h ...
	mov	cs:[RAMset][di][2],bx	; ... to either F800h or F600h

CRcExit:
	pop	fs
	pop	es
	pop	ds
	popa
	ret
	assume	es:nothing
CPQROMcheck	endp

endif	; ROMCOMP


;===============================================================================
;==
;==  ROMcompress: Check to see if lower 32k of system ROM can be mapped over by
;==		  RAM.	This code was adapted from Helix.
;==
;==  Enter:
;==
;==  Exit:
;==
;===============================================================================
	public	ROMcompress

ROMcompress proc near

	cmp	cs:[Highscan], TRUE
	jne	RcQuickExit

	pusha
	push	es
	push	ds

	call	chkt2mrg			;check for type 2 merge
	assume	ds:nothing, es:nothing
	jc	short domerge			;if found skip type 1 check

	mov	ax, 0f000h			;first 3000h words (12k)
	mov	ds, ax				; at f000:0000 & f000:8000
	mov	es, ax				; must be the same
	xor	si, si
	mov	di, 8000h
	mov	cx, 3000h
	cld
	repe cmpsw
	jne	short RcExit

	xor	si,si
	mov	ds,si
	mov	cx,128
chkvecs:lodsw
	mov	dx,ax
	lodsw
	cmp	ax,0f000h
	jne	short @f
	cmp	dx,8000h
	jae	short @f
	cmp	si,32h*4			;cpm jump?
	je	short @f			;skip it
	cmp	dx,6000h
	jae	short RcExit
@@:	loop	chkvecs

domerge:xor	si,si
	mov	ds,si
	mov	cx,128
merge:	lodsw
	mov	dx,ax
	lodsw
	cmp	ax,0f000h
	jne	short @f
	cmp	dx,8000h
	jae	short @f
	add	word ptr [si-4],8000h
@@:	loop	merge

;  Make sure BIOS points to INT 13h entry point on upper 32K image by making an
;  INT 2Fh AH=13h (DOS 3.20 and later): changes the INT 13h calls from IBMBIO.
;  Note: Does not affect DOS 3.00-3.10, but valid only on DOS 3.20 and later.

	mov	ah,13h
	int	2fh
	mov	ax,ds
	cmp	ax,0f000h
	jne	short @f
	or	dx,8000h
@@:	mov	ax,es
	cmp	ax,0f000h
	jne	short @f
	or	bx,8000h
@@:	mov	ah,13h
	int	2fh

; Add 32k ROM area to RAM list

	movzx	di, byte ptr cs:[HighSet]
	add	byte ptr cs:[HighSet], 4
	mov	word ptr cs:[HighSet][di], 0f000h	; from F000h
	mov	word ptr cs:[HighSet][di+2], 0f7ffh	;   to F7FFh

RcExit:
	pop	ds
	pop	es
	popa

RcQuickExit:
	ret

ROMcompress endp


chkt2mrg proc near
	xor	si,si
	mov	ds,si
	mov	cx,128
	cld
chkt2a: lodsw
	mov	bx,ax
	lodsw
	cmp	ax,0f000h
	jne	short @f
	cmp	bx,8000h
	jae	short @f
	mov	es,ax
	cmp	si,32h*4			;cpm jump?
	je	short @f
	cmp	byte ptr es:[bx],0e9h		;check for jmp $+8000
	jne	short chkt2ng
	cmp	word ptr es:[bx+1],7ffdh	;
	jne	short chkt2ng
@@:	loop	chkt2a
	mov	ah,8
	mov	dl,0
	int	13h
	mov	ax,es
	mov	ds,ax
	mov	si,di
	or	si,8000h
	mov	cx,11
	repe cmpsb
	jne	short chkt2ng
	mov	ah,8
	mov	dl,1
	int	13h
	mov	ax,es
	mov	ds,ax
	mov	si,di
	or	si,8000h
	mov	cx,11
	repe cmpsb
	jne	short chkt2ng
	mov	ah,8
	mov	dl,80h
	int	13h
	mov	ax,es
	mov	ds,ax
	mov	si,di
	or	si,8000h
	mov	cx,11
	repe cmpsb
	jne	short chkt2ng
	stc
	ret
chkt2ng:clc
	ret
chkt2mrg endp

	assume	ds:_DATA

;ifndef IBMCOPYRIGHT

	; IBM version doesn't do this because their QBASIC uses ROM Basic

;===============================================================================
;==
;==  ROMbasic:	Check to see if machine has ROM basic that can be mapped
;==		over by RAM.  This code was adapted from Helix.
;==
;==  Enter:
;==
;==  Exit:
;==
;===============================================================================
	public	ROMbasic

basic_id db	'The IBM Personal Computer Basic'
basic_id_length equ $-basic_id

ROMbasic proc	near

	push	es

	cmp	cs:[Highscan], TRUE
	jne	RbNoBasic

	test	gs:[GenFlags], fMCA	; Q: MCA
	jnz	short RbChk4Basic	; Y: look for ROM basic

	mov	ax,3518h		; code from Helix to look for ROM basic
	int	21h			; on non-MCA machines
	mov	ax,es
	cmp	ax,0f600h
	jne	short RbNoBasic
	cmp	bx,0
	jne	short RbNoBasic
	mov	di,8000h
	mov	cx,32
	mov	al,'I'
	cld
	repne	scasb
	jne	short RbNoBasic
	cmp	word ptr es:[di],'MB'
	jne	short RbNoBasic

;  We either have an MCA machine, or a non MCA which looks like it might have
;  ROM basic (non MCA PS/2).  Do a more detailed ROM Basic search.

RbChk4Basic:

	mov	ax,0f600h		; more code from Helix
	mov	es,ax
	xor	di,di
	mov	cx,8000h-basic_id_length
	mov	al, cs:[basic_id]
basic_loop:
	repne	scasb
	jne	short RbNoBasic
	push	cx
	push	di
	mov	si,offset LAST:basic_id+1
	mov	cx,basic_id_length-1
	push	ds
	push	cs
	pop	ds
	rep	cmpsb
	pop	ds
	pop	di
	pop	cx
	jne	short basic_loop

;  Looks like we found ROM basic, add 32k to our HighScan set

	movzx	di, byte ptr cs:[HighSet]
	add	byte ptr cs:[HighSet], 4
	mov	word ptr cs:[HighSet][di], 0f600h	; from F600h
	mov	word ptr cs:[HighSet][di+2], 0fdffh	;   to FDFFh

RbNoBasic:
	pop	es

	ret

ROMbasic endp

;endif	IBMCOPYRIGHT

;===============================================================================
;==
;==  DefaultROM: Check to see if C600-C7FF should be excluded due to a bad CPQ
;==		 Video ROM.
;==
;==  Enter:
;==
;==  Exit:
;==
;===============================================================================
DefaultROM proc	near
	push	ds

	call	IsCompaq		;Q: Is it a Compaq 386
	jnz	short DRcheckMCA	; N: check if E000 should be excluded
;
;  Check if CPQ video ROMs are dated between 01/16/90 and 07/30/90
;
	push	0C000h
	pop	ds
	cmp	word ptr ds:[5FFBh],'09';Q: VGA ROMs from '90?
	jne	short DRcheckE000	; N: no problem
	cmp	byte ptr ds:[5FFAh],'/'	;Q: VGA ROMs have format mm/dd/yy?
	jne	short DRcheckE000	; N: no problem
	cmp	byte ptr ds:[5FF7h],'/'	;Q: VGA ROMs have format mm/dd/yy?
	jne	short DRcheckE000	; N: no problem
	cmp	byte ptr ds:[5FF5h],'0'	;Q: VGA ROMs have format mm/dd/yy?
	jne	short DRcheckE000	; N: no problem

	cmp	byte ptr ds:[5FF6h],'7'	;Q: VGA ROMs after July?
	ja	short DRcheckE000	; Y: no problem

	cmp	byte ptr ds:[5FF6h],'1'	;Q: VGA ROMs after January?
	ja	short DRexcC7FF		; Y: problem, exclude to C7FF

	cmp	byte ptr ds:[5FF8h],'1'	;Q: After Jan 20, 1990?
	ja	short DRexcC7FF		; Y: exclude
	jb	short DRcheckE000	; N: no problem

	cmp	byte ptr ds:[5FF9h],'6'	;Q: Before Jan 16, 1990?
	jb	short DRcheckE000	; Y: no problem

DRexcC7FF:
	mov	cs:[VGAROM],0C7FFh	; exclude to C7FFh area
	jmp	short DRcheckE000

DRcheckMCA:

	test	gs:[GenFlags], fMCA	; Q: MCA system

⌨️ 快捷键说明

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