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

📄 atbase.asm

📁 award bios 源代码,喜欢汇编程序及想研究主板BIOS程序的人可以参考哦.我是费了老大的劲才找到的哦.
💻 ASM
📖 第 1 页 / 共 5 页
字号:

		align	4					;R25
		PUBLIC	INT_19S
INT_19S		PROC	NEAR

		mov	ax,G_RAM
		mov	ds,ax
		assume	ds:G_RAM

		cli
		mov	word ptr ds:[Disk_Parm_Ptr], offset cs:FDC_PARS
		mov	word ptr ds:[Disk_Parm_Ptr+2],cs
		sti

;R125 - start
ifdef	LAN_BOOT_SUPPORT
;Boot from INT 18H first if user enable in CMOS setup
		test	byte ptr ds:SYSTEM_FLAG,BOOT_LAN ;boot LAN ?
		jz	short NoInt18Hooked

		;check if INT 18H hooked by other ROMs
		cmp	word ptr ds:[Int18],offset cs:Int18_Hdlr
		jne	short YesTryInt18

		mov	ax,cs			;INT 18 hooked ?
		cmp	word ptr ds:[Int18+2],ax
		je	short NoInt18Hooked

YesTryInt18:
		int	18H
NoInt18Hooked:
endif;	LAN_BOOT_SUPPORT
;R125 - end

;R28 start
;R43ifdef CD_ROM
;R43		push	ax
;R43		test	byte ptr G_RAM:[CDROM_EMUL_HEAD],0fh
;R43		jz	No_CDROM_Bootable
;R43		mov	es,ax
;R43		mov	al,G_RAM:[CDROM_EMUL_HEAD]
;R43		mov	G_RAM:[CDROM_ALLOCATE],al
;R43		mov	dword ptr G_RAM:[CDROM_EMUL_START_SECTOR],0
;R43		mov	word ptr G_RAM:[CDROM_EMUL_CYL_SEC],0ffffh
;R43		mov	byte ptr G_RAM:[CDROM_EMUL_HEAD],16
;R43		inc	byte ptr G_RAM:[NumHDSKS]
;R43		mov	ax,201h
;R43		mov	bx,offset Boot
;R43		mov	cx,6
;R43		mov	dx,180h
;R43		int	13h
;R43		jc	CDROM_Fail
;R43		cmp	dword ptr es:[bx+1],'00DC'
;R43		jne	CDROM_Fail
;R43		cmp	byte ptr es:[bx+5],'1'
;R43		jne	CDROM_Fail
;R43		mov	eax,es:[bx+47h]
;R43		call	Xlat_CDsec_CHS
;R43		mov	ax,201h
;R43		mov	dl,80h
;R43		int	13h
;R43		jc	CDROM_Fail
;R43		mov	ax,es:[bx]
;R43		cmp	al,1			;Header ID,must be 1
;R43		jne	CDROM_Fail
;R43;--- Platform ID ---
;R43AT_80x86	EQU	0
;R43Power_PC	EQU	1
;R43Mac		EQU	2
;R43Comp_Platform:
;R43		cmp	ah,AT_80x86		;compare Platform ID
;R43		je	short Scan_bootable
;R43@@:
;R43		add	bx,20h
;R43		cmp	bx,offset Boot + 800h
;R43		jae	CDROM_Fail
;R43		mov	ax,es:[bx]
;R43Comp_Header:
;R43		cmp	al,90h
;R43		je	short Comp_Platform
;R43		cmp	al,91h
;R43		je	short Comp_Platform
;R43		jmp	short @B
;R43Scan_bootable:
;R43		add	bx,20h
;R43		cmp	bx,offset Boot + 800h
;R43		jae	CDROM_Fail
;R43		mov	ax,es:[bx]
;R43		cmp	al,88h			;Is Bootable image?
;R43		jne	short Comp_Header	;No,jump
;R43		mov	edx,es:[bx+8]
;R43		mov	ds:CDROM_EMUL_START_SECTOR,edx
;R43		and	ah,0fh
;R43		cmp	ah,1
;R43		je	short Floppy_120MB
;R43		cmp	ah,2
;R43		je	short Floppy_144MB
;R43		cmp	ah,3
;R43		je	short Floppy_288MB
;R43		cmp	ah,4			;Is emulate HD drive?
;R43		je	short HDD_Drive
;R43		jmp	short CDROM_Fail
;R43Floppy_120MB:
;R43		mov	byte ptr ds:[CDROM_EMUL_CYL_SEC],0fh
;R43		jmp	short @F
;R43Floppy_144MB:
;R43		mov	byte ptr ds:[CDROM_EMUL_CYL_SEC],12h
;R43		jmp	short @F
;R43Floppy_288MB:
;R43		mov	byte ptr G_RAM:[CDROM_EMUL_CYL_SEC],24h
;R43@@:
;R43		mov	byte ptr G_RAM:[CDROM_EMUL_CYL_SEC+1],50h
;R43		sub	byte ptr G_RAM:[CDROM_ALLOCATE],4
;R43		mov	byte ptr G_RAM:CDROM_EMUL_HEAD,2
;R43		jmp	short No_CDROM_Bootable
;R43HDD_Drive:
;R43		mov	ax,201h
;R43		mov	bx,offset Boot
;R43		mov	cx,1
;R43		mov	dx,80h
;R43		int	13h
;R43		add	bx,1beh
;R43@@:
;R43		cmp	word ptr es:[bx],0aa55h
;R43		je	short CDROM_Fail
;R43		test	byte ptr es:[bx],80h
;R43		jnz	short @F
;R43		add	bx,10h
;R43		jmp	@B
;R43@@:
;R43		mov	al,es:[bx+5]
;R43		inc	al
;R43		mov	ds:CDROM_EMUL_HEAD,al
;R43		mov	ax,es:[bx+6]
;R43		mov	ds:CDROM_EMUL_CYL_SEC,ax
;R43		jmp	short No_CDROM_Bootable
;R43CDROM_Fail:
;R43No_CDROM_Bootable:
;R43		pop	ax
;R43endif ;CD_ROM
;R28 end

new_dsk:
		mov	dx,ax			; (ax is 0)
		mov	es,ax			; set to load at 0:offset Boot

		mov	bx,offset Boot
		mov	cx,1			; set to read one sector

;		mov	al,CMOS_AWARD_CK NMI_ON	; get CMOS byte with boot indicator
;		call	Get_CMOS
;		test	al,HARD_DISK_FIRST	; check try hard first

;R79		mov	si,offset BootSeq_Item
;R79		call	GetItem_Cmos
;R79 - start
		mov	al,ds:[BootSel]		;get boot sequence
;R79 - end
;R28 start
		xor	ah,ah
		mov	si,ax
		shl	si,1			;si = si*3
		add	si,ax			;---------
		add	si,offset Boot_Seq_Drive
;R28 end
;R28		or	al,al
;R28		jz	short do_boot		; skip if floppy first
;R28		mov	dl,80h			; else setup for hard first
;R28 do_boot:

		mov	dl,cs:[si]		;R28
		call	try_boot		; try boot load on first device
		jnc	good_load		; skip if load good
;R28		xor	dl,80h			; get to next device
		mov	dl,cs:[si+1]		;R28
		call	try_boot		; try boot load on second device
		jnc	good_load		; skip if load good
;R88;R28 start
;R88ifdef CD_ROM
		mov	dl,cs:[si+2]
		call	try_boot
		jnc	good_load
;R88endif ;CD_ROM
;R88;R28 end
		jmp	hang			; else skip to handle bad load


		align	4					;R25
try_boot	proc	near
		push	si			;R28
		cmp	dl,None_Drive		;R66
		je	load_failed		;R66
;R88 start
ifdef HDD_Boot_Selectable
		and	byte ptr [CDROM_ALLOCATE],not Enable_SCSI_Boot
		cmp	dl,SCSI_Drive
		jne	short @F
		cmp	byte ptr cs:[SCSI_Drive_Max_Num],80h	   ;SCSI present ?   R88A
		jbe	Load_Failed				   ;no SCSI drive    R88A
		or	byte ptr [CDROM_ALLOCATE],Enable_SCSI_Boot
		mov	dl,C_DRIVE
@@:
endif ;HDD_Boot_Selectable
;R88 end

		mov	si,3			; setup for three retries
		xor	di,di			; assume floppy boot try

;R10		or	dl,dl			; boot from HDD?
;R10		js	short @F 		; yes
;R10		mov	al,10h NMI_ON		; FDD CMOS value
;R10		call	Get_CMOS
;R10		test	al,11110000b
;R10		jz	short Load_Failed
;R10 @@:
;R115A start
		mov	al,10h NMI_ON		; FDD CMOS value
		call	Get_CMOS
ifdef	ATAPI_Boot
		test	al,11110000b
		jz	short No_FloppyA
		or	byte ptr [ATAPI_Byte],8
No_FloppyA:
endif	;ATAPI_Boot
;R115A end

		or	dl,dl			; check hard disk boot
;R28		jns	short try_again		; skip if not for floppy
;R28 start
		js	short @F
;R60 start
;R115A		mov	al,10h NMI_ON		; FDD CMOS value
;R115A		call	Get_CMOS
		test	al,11110000b
		jnz	short Floppy_Exist
		test	byte ptr [ATAPI_Byte],4			;R97
		jnz	short Floppy_Exist			;R97
		cmp	word ptr [int13],offset HRDSKIO
		jne	short Floppy_Exist
		cmp	word ptr [int40],offset DSK_VECT
		je	Load_Failed
Floppy_Exist:
;R60 end
;R120 start
ifdef	Support_DriveA_Boot_Permit
		cmp	dl,A_DRIVE
		jne	short Not_DriveA_Boot
		mov	al,DriveA_Boot_Permit_CMOS NMI_OFF
		call	Get_Cmos
		test	al,DriveA_Boot_Permit_CMOS_Mask
		jz	Load_Failed
Not_DriveA_Boot:
endif	;Support_DriveA_Boot_Permit
;R120 end
;R115 start
;R115Aifdef	LS120_SUPPORT
;R115A		cmp	dl,A_DRIVE
;R115A		jne	short Not_FloppyA_boot
;R115A		test	al,11110000b
;R115A		jz	short Not_LS120_boot
;R115A		or	byte ptr [ATAPI_Byte],8
;R115ANot_FloppyA_boot:
ifdef	ATAPI_Boot					;R115A
		cmp	dl,LS120_DRIVE
		jne	short Not_LS120_boot
		and	byte ptr [ATAPI_Byte],not 8
		mov	dl,A_DRIVE
Not_LS120_boot:
;R115Aendif	;LS120_SUPPORT
endif	;ATAPI_Boot					;R115A
;R115 end
ifdef CD_ROM
		mov	al,G_RAM:[CDROM_ALLOCATE]
		and	al,0fh
		shr	al,2
		cmp	al,1			;emulate Drive A?
;R43		jne	short try_again
		jne	try_again				;R43
		inc	dl
endif ;CD_ROM
;R43		jmp	short try_again
		jmp	try_again				;R43
@@:
;R28 end
		inc	di			; else signal hard boot, (tested by Check_Boot_Record)
;R28 start
ifdef CD_ROM
;R43		cmp	dl,80h
;R43		jne	short @F
;R43 start
		cmp	dl,80h
		jne	Not_from_CDROM
		test	byte ptr G_RAM:[CDROM_EMUL_HEAD],0fh
		jz	No_CDROM_Bootable
		pusha
		push	es
		push	ds
		mov	ax,G_RAM			;R97
		mov	es,ax
		test	byte ptr G_RAM:[CDROM_ALLOCATE],0fh
		jnz	short @F
		mov	al,G_RAM:[CDROM_EMUL_HEAD]
;;R123		mov	G_RAM:[CDROM_ALLOCATE],al
		and	al,0fh				;R123
		and	G_RAM:[CDROM_ALLOCATE],0f0h	;R123
		or	G_RAM:[CDROM_ALLOCATE],al	;R123
		inc	byte ptr G_RAM:[NumHDSKS]
@@:
;R52A start
ifndef	NO_CDROM_BOOT_MESSAGE				;R78
		push	ds
		push	es
		mov	di,CD_ROM_TEMP_SEG
		mov	es,di
		mov	di,27*2 - CD_Boot_Str0_len	;R53
		mov	cx,CD_Boot_Str0_len		;R53
		push	cs				;R53
		pop	ds				;R53
		lea	si,CD_Boot_Str0			;R53
		rep	movsb				;R53
		mov	bp,27*2 - CD_Boot_Str0_len	;R53
;R68		mov	cx,Model_Number_Len		;R53
;R68		add	cx,CD_Boot_Str0_len		;R53
		mov	cx,CD_Boot_Str0_len		;R68
		call	Display_str			;R53
;R68		mov	di,27*2
;R53		push	cs
;R53		pop	ds
;R68Found_Loop:
;R68		lea	si,Special_CDROM_Drive
;R68		mov	cx,Special_CDROM_Len0
;R68		rep	cmpsb
;R68		jz	short Found_It
;R68		cmp	di,27*2+Model_Number_Len-Special_CDROM_Len0
;R68		jbe	short Found_Loop
;R68Found_It:
		pop	es
		pop	ds
endif	;NO_CDROM_BOOT_MESSAGE				;R78
;R68		jnz	short @F
;R68		or	byte ptr G_RAM:[CDROM_ALLOCATE],Special_CDROM_Bit
@@:
;R52A end
		mov	dword ptr G_RAM:[CDROM_EMUL_START_SECTOR],0
		mov	word ptr G_RAM:[CDROM_EMUL_CYL_SEC],0ffffh
;R123C		mov	byte ptr G_RAM:[CDROM_EMUL_HEAD],16
		mov	byte ptr G_RAM:[CDROM_EMUL_HEAD],255	;R123C
;R96		mov	cx,800h					;R53
;R97		mov	cx,2000h				;R96

;R123A		mov	cx,0a000h				;R123
;R123A		test	G_RAM:[CDROM_ALLOCATE],Special_CDROM_Bit  ;R123
;R123A		jnz	@F					;R123
;R123A start
;R123D		test	G_RAM:[CDROM_ALLOCATE],Special_CDROM_Bit
;R123D		jz	@F
		xor	cx,cx
;R123B		mov	bx,1
;R123D		mov	bx,5			;R123B  5*2.5 =12.5 sec
		movzx	bx,byte ptr DGROUP:[CDROM_Boot_Delay]	;R123D
		or	bl,bl					;R123D
		jz	short @F				;R123D
		call	WAIT_REFRESH
;R123D		mov	cx,0a000h				;R123B	more loop to read boot data
;R123D		jmp	short Spec_CDROM			;R123B

@@:
;R123A end

;R123D		mov	cx,800h					;R97
		xor	cl,cl					;R123D
		mov	ch,byte ptr DGROUP:[CDROM_Boot_loop]	;R123D

Spec_CDROM:							;R123B
@@:								;R53
		push	cx					;R53

		mov	ax,201h
		mov	bx,offset Boot
		mov	cx,6
		mov	dx,180h
;R57		int	13h
		pushf						;R57
		call	far ptr HRDSKIO				;R57

;R53		jc	CDROM_Fail
		pop	cx					;R53
		jnc	short @F				;R53
		cmp	ah,32H					;R127
				;R127 Media type not supported by drive
		je	short CDROM_Fail_0			;R127
		loop	short @B 				;R53
CDROM_Fail_0:							;R127
		jmp	CDROM_Fail				;R53
@@:								;R53
		cmp	dword ptr es:[bx+1],'00DC'
		jne	CDROM_Fail
		cmp	byte ptr es:[bx+5],'1'
		jne	CDROM_Fail
		mov	eax,es:[bx+47h]
		call	Xlat_CDsec_CHS
;read booting catalog to CD_ROM_TEMP_SEG:CD_ROM_TEMP_OFF
		mov	bx,CD_ROM_TEMP_SEG
		mov	es,bx
		mov	bx,CD_ROM_TEMP_OFF
		mov	ax,201h
		mov	dl,80h
;R57		int	13h
		pushf						;R57
		call	far ptr HRDSKIO				;R57

		jc	CDROM_Fail
		cmp	byte ptr es:[bx],1	;Header ID,must be 1
		jne	CDROM_Fail

;R44A		mov	di,CD_ROM_TEMP_SEG
;R44A		mov	es,di
;R44A		mov	di,200h
;R44A		mov	dl,G_RAM:[CDROM_ALLOCATE]
;R44A		and	dl,3
;R44A		add	dl,80h
;R44A		Post_func_call	Auto_IDE_Detect
;R53		mov	di,27*2 - CD_Boot_Str0_len
;R53		mov	cx,CD_Boot_Str0_len
;R53		push	cs
;R53		pop	ds
;R53		lea	si,CD_Boot_Str0
;R53		rep	movsb
;R53		add	di,Model_Number_Len
;R53		lea	si,CD_Boot_Str1
;R53		mov	cx,CD_Boot_Str1_len
;R53		rep	movsb
;R53
;R53		mov	bp,27*2 - CD_Boot_Str0_len
;R53		mov	cx,Model_Number_Len
;R53		add	cx,CD_Boot_Str0_len
;R53		add	cx,CD_Boot_Str1_len
;R53		call	Display_str
ifndef	NO_CDROM_BOOT_MESSAGE					;R78
		push	es					;R53
		push	cs					;R53
		pop	es					;R53
		lea	bp,CD_Boot_Str1				;R53
		mov	cx,CD_Boot_Str1_len			;R53
		call	Display_str				;R53
		pop	es					;R53
endif	;NO_CDROM_BOOT_MESSAGE					;R78

		mov	bx,CD_ROM_TEMP_SEG
		mov	es,bx
		mov	bx,CD_ROM_TEMP_OFF
		mov	di,TEMP_OFF
		mov	dword ptr es:[di+0b0h],'.0  '
		mov	dword ptr es:[di+0b4h],' DH '
		mov	ah,es:[bx+1]
;--- Platform ID ---
AT_80x86	EQU	0
Power_PC	EQU	1
Mac		EQU	2
Comp_Platform:
		cmp	ah,AT_80x86		;compare Platform ID
		je	short Scan_bootable
@@:
		add	bx,20h
		cmp	bx,CD_ROM_TEMP_OFF + 800h
		jae	Scan_over
		mov	ax,es:[bx]
Comp_Header:
		cmp	al,90h
		je	short Comp_Platform
		cmp	al,91h
		je	short Comp_Platform
		jmp	short @B
Scan_bootable:
		add	bx,20h
		cmp	bx,CD_ROM_TEMP_OFF + 800h

⌨️ 快捷键说明

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