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

📄 e0post.asm

📁 <B>Award BIOS(Basic Input/Output System)(电脑启动时所必需)的源码</B>
💻 ASM
📖 第 1 页 / 共 5 页
字号:
;
;	If someone pressed a key, go into override
;
		mov	al, CMOS_OVERRIDE NMI_OFF	; override location
		mov	ah, NOT OVERRIDE_ENABLE
		F000_call	ROM_AND_CMOS

Wait_OBF_key:

ifdef		Override_Key_Support
		in	al, STAT8042
		test	al, OBF_8042			; anything waiting from keyboard
		jz	short CMOS_Access_Test_pass	; no...

		in	al,DATA8042		; read key pressed
		cmp	al,KEY_OVERRIDE 	; is it override key?
		jne	short Wait_OBF_key		; no, look for another key

		mov	al, CMOS_OVERRIDE NMI_OFF	; override location
		mov	ah, OVERRIDE_ENABLE		; turn on override
		F000_call	ROM_OR_CMOS

		mov	al, CMOS_ERROR NMI_OFF	; show as an error
		mov	ah, EQUIP_STATUS
		F000_call	ROM_OR_CMOS

		mov	bl,1			; beep on override
		call	E000_Snd_Spkr
endif	;No_Override_Key

CMOS_Access_Test_pass:
		clc
		ret

CMOS_Access_Test_fail:
		stc				; set carry flag
		ret
POST_18S 	ENDP

POST_19S:
		ret


;[]==============================================================[]
;
; POST_20S:
;
;	Programs the chipset registers with default values.
;
;Saves: NONE
;Entry: NONE
;Exit:	C	Set if fatal error
;
;[]==============================================================[]
POST_20S 	PROC	NEAR
		cli
		cld
		call	far ptr fProc_Prg_Chipset_Default
		ret
POST_20S 	ENDP

POST_21S:
		ret

;[]==============================================================[]
;
; POST_22S:
;
;	 Init OnBoard Generator
;
;Saves: NONE
;Entry: NONE
;Exit:	C	Set if fatal error
;[]==============================================================[]
POST_22S 	PROC	NEAR
ifdef	Early_Init_ClkGen
		extrn	Early_Init_Onboard_Generator:near
		call	Early_Init_Onboard_Generator
endif;	Early_Init_ClkGen
		ret
POST_22S 	ENDP

POST_23S:
		ret


;[]==============================================================[]
;
; POST_24S:
;
;	Check CPU & cache init
;
;ENTRY: NONE
;EXIT:	NONE
;[]==============================================================[]
		ALIGN	4
POST_24S 	PROC	NEAR

		call	Chk_Intel_S_CPU

ifndef	Not_Init_Cyrix
		call	Cyrix_Init
endif	;Not_Init_Cyrix

		F000_call	Cache_Init

ifndef	NO_TOUCH_PORT_92H
		xor	al,al
		out	92h,al			;A20 off
endif;	NO_TOUCH_PORT_92H

;;;ifdef	CMOS_BACKUP_SUPPORT
;;;		call	Check_Flash_CMOS
;;;endif	;CMOS_BACKUP_SUPPORT
		clc
		ret
POST_24S ENDP

POST_25S:
		ret


;[]==============================================================[]
; POST_26S:
;ENTRY: NONE
;EXIT:	NONE
;[]==============================================================[]
POST_26S 	PROC	NEAR
		ret
POST_26S ENDP

;[]==============================================================[]
;
; POST_27S:
;
;	Initialize int. vectors (0-77h) to the spurious interrupt
;	handler. Then initialize 00h-1fh to their proper places.
;
;
;Saves: NONE
;
;Entry: NONE
;Exit:	C	Set if fatal error
;
;[]==============================================================[]
		ALIGN	4
POST_27S	PROC	NEAR
		cli
		mov	ax,0f000h
		mov	ds,ax
		cld
;
;	Initialize vectors 0-78h to the spurious interrupt handler
;
		xor	di,di			; di = start of segment
		mov	es,di			; es = first segment

		mov	ax,0f000h
		shl	eax, 10h
		mov	ax, offset SPURIOUS_soft_HDLR

		mov	ecx,78h 		; cx = number of vectors
		rep	stosd			; store all vectors...

;R256 - start
	;Set interrupt service vector of INT 50H to hardware spurious
	;interrupt handler to patch NSTL spurious IRQ masking function.
	;NSTL replace INT 8H interrupt vector with INT 50H.
	;INT 50H is a software interrupt, our BIOS only set flag in G_RAM
	;offset INT_OCCUR_FLG it cause the IRQ0 can not be masked.
		mov	ax, offset SPURIOUS_INT_HDLR;spurious interrupt handler
		mov	di, offset Int50	; INT 50H interrupt vector
		stosd
;R256 - end

;
;	Initialize vectors 00-1fh to the real handlers
;
		mov	cx,20h
		mov	ax,0f000h
		mov	si,offset Int_Tbl
		xor	di,di

		ALIGN	4
Set_Int_TABLE:
		movsw				; load next offset
		stosw				; load segment in ax
		loop	short Set_Int_TABLE

;
;	Check video table entry...
;

		cmp	word ptr [si-2],0	; if video table entry is 0?
		jne	short Init_Vectors_70_77 ; no, exit...

		mov	word ptr es:[di-2],0	; set segment to 0 to indicate
						; no extended characters installed.

;
;	Initialize vectors 70-77
;
Init_Vectors_70_77:
		mov	cx,8
		mov	si,offset Sec_Hrdwr_Ints
		mov	di, offset Int70

		ALIGN	4
Init_Vectors_Loop:
		movsw
		stosw
		loop	short Init_Vectors_Loop

		mov	di,offset int60
		mov	ecx,8
		xor	eax,eax
		rep	stosd

	;replace INT 9 with temporary handler
		lea	di,INT09
		lea	ax,POST_INT9_Vect
		mov	es:[di],ax
		mov	es:[di+2],seg EGROUP

		clc
		ret
POST_27S  	ENDP

;R279 POST_28S:
;R279 		ret

;R279 - starts
;[]==============================================================[]
;
; POST_28S:
;
;	Check normal ISA CMOS checksum and battery. If it fails,
;	we load the manufacturing defaults.
;
;
;Saves: NONE
;
;Entry: NONE
;Exit:	C	Set if fatal error
;
;[]==============================================================[]
	;------------------------------------------------------
	;       RTC          default  low   high   descriptions
	;       location     value    limit limit
	;------------------------------------------------------
RTC_Limits	Label	Byte
	db	00h NMI_OFF,   0     , 00h , 59h	;second
	db	02h NMI_OFF,   0     , 00h , 59h 	;minute
	db	04h NMI_OFF,   0     , 00h , 23h 	;hour
	db	07h NMI_OFF,   1     , 01h , 31h 	;day of month
	db	08h NMI_OFF,   1     , 01h , 12h 	;month
;R261	db	09h NMI_OFF,  98h    , 00h , 99h 	;year
	db	09h NMI_OFF,  99h    , 00h , 99h 	;year  	;R261
	db	32h NMI_OFF,  19h    , 19h , 20h 	;year
RTC_Limits_End	Label	Byte
NO_OF_RTC_BYTES	EQU	(($-(offset RTC_Limits))/4)

;R259 - start
ifdef	Date_DEFAULT_IS_BIOS_MAKE_DAY
;[]==============================================================[]
;
; trans_to_byte:
;
;	   Let	string of ASCII code into byte
;
; input  : AX
; output : BL
;
;[]==============================================================[]

trans_to_byte	proc	near
		and	ax, 0f0fh
		mov	bl, al
		shl	bl, 4
		add	bl, ah
		ret
trans_to_byte	endp
endif	;Date_DEFAULT_IS_BIOS_MAKE_DAY
;R259 - end
		ALIGN	4
POST_28S	PROC	NEAR

		PUBLIC	SETUP_CMOS
SETUP_CMOS	LABEL	NEAR

;--------------------------
;Check date & time boundary
;--------------------------
		push	cs
		pop	ds

		cli
;R259 - start
ifdef	Date_DEFAULT_IS_BIOS_MAKE_DAY

		f000_call E000_64K_shadow_RW		;Enable E000 Shadow write

		mov	di, offset RTC_Limits
		push	es
		mov	ax,0f000h
		mov	es,ax
		mov	si,offset DGROUP:BIOS_INFORM_STR

		mov	ax, word ptr es:[si+1]		;String of month
		call	trans_to_byte
		mov	[di+17], bl

		mov	ax, word ptr es:[si+4]		;String of day
		call	trans_to_byte
		mov	[di+13], bl

		mov	ax, word ptr es:[si+9]		;String of year's
		call	trans_to_byte			;last 2 digital
		mov	[di+21], bl

		mov	ax, word ptr es:[si+7]		;String of year's
		call	trans_to_byte			;first 2 digital
		mov	[di+25], bl

		pop	es

		f000_call E000_64K_shadow_R		;;Disable E000 Shadow write

endif	;Date_DEFAULT_IS_BIOS_MAKE_DAY
;R259 - end


		mov	si, offset RTC_Limits

	Check_Next_RTC_Loc:

		cmp	si, offset RTC_Limits_End
		je	short To_Check_Valid_Century

		mov	al, ds:[si]		;AL=CMOS index
		call	Get_Rtc_Byte
		jc	short This_RTC_Byte_OK
		mov	bx, ds:[si+2]
		cmp	al, bl			;below low limit ?
		jb	short Load_RTC_Defaults
		cmp	al, bh			;above high limit ?
		ja	short Load_RTC_Defaults

		and	al,0fh			;low nibbble
		cmp	al,09h			;max. BCD is 9
		ja	short Load_RTC_Defaults	;number valid

	This_RTC_Byte_OK:

		add	si, 4
		jmp	short Check_Next_RTC_Loc

	Load_RTC_Defaults:

		mov	si, offset RTC_Limits
		mov	cx, NO_OF_RTC_BYTES
	@@:
		mov	ax, ds:[si]
		call	Set_Rtc_Byte
		add	si, 4
		loop	short @B
		jmp	short Finish_RTC

	To_Check_Valid_Century:

		call	Valid_Century

	Finish_RTC:

		push	ds
		push	0f000h
		pop	ds

ifdef		Override_Key_Support
		mov	al, CMOS_OVERRIDE NMI_OFF	; override location
		call	F000_Get_Cmos
		test	al,OVERRIDE_ENABLE		; override?
		jnz	short Over_Yes

		in	al, STAT8042
		test	al, OBF_8042		; anything waiting from keyboard
		jz	short @F		; no...

		in	al,DATA8042		; read key pressed
		cmp	al,KEY_OVERRIDE 	; is it override key?
		jne	short @F		; no, look for another key

Over_Yes:
		call	Destroy_Cmos_Cksum	; destory CMOS

		mov	al, CMOS_OVERRIDE NMI_OFF	; override location
		mov	ah,al
		call	F000_Get_Cmos
		or	al,OVERRIDE_ENABLE		; override?
		xchg	ah,al
		call	F000_Set_Cmos
@@:
endif	;No_Override_Key

ifndef	NO_RTC_BATTERY_CHECK
;Destroy CMOS checksum if CMOS lose battery power
		mov	al,0dh + 80h
		call	F000_Get_Cmos

		test	al,80H			;CMOS battery power ok?
		jnz	short Cmos_PowerOk
		call	Destroy_Cmos_Cksum

		mov	al,CMOS_STATUS + 80h
		call	F000_Get_Cmos
		or	al,RTC_STATUS+EQUIP_STATUS
		mov	ah,al
		mov	al,CMOS_STATUS + 80h
		call	F000_Set_Cmos

Cmos_PowerOk:
endif;	NO_RTC_BATTERY_CHECK

		call	Check_If_Cmos_All_Zeros

ifdef	JUMPER_CMOS_CLEAR_SUPPORT
		call	Ct_Cmos_Jumper_Chk	;return jumper status
		jnc	short NoClearCmos	;clear CMOS ?
						;yes
		call	Destroy_Cmos_Cksum	;destroy CMOS checksum
						;no
NoClearCmos:
endif;	JUMPER_CMOS_CLEAR_SUPPORT

;Set initial value of CPU_CLOCK to prevent system hang in routine
;"Read_Cmos_To_Stack"

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

		mov	al, CPU66
		cmp	byte ptr CPU_LEVEL[bp], LEVEL_686
		jae	short _ijhytse

		mov	al, CPU33
		cmp	byte ptr CPU_LEVEL[bp], LEVEL_486
		jbe	short _ijhytse
		mov	al, CPU50
	_ijhytse:
		mov	ds:[CPU_CLOCK],al

		mov	byte ptr CALLTYPE[bp],0AAh
		F000_call	Read_Cmos_To_Stack

		call	Reset_Drive_CMOS_If_Hidden

ifndef	DATE_ALARM_SUPPORT
ifdef	ALi514x
DATE_ALARM_SUPPORT	EQU	1
endif;	ALi514x
endif;	DATE_ALARM_SUPPORT

ifdef	DATE_ALARM_SUPPORT
		mov	al,CMOS_STATUS[bp]
		test	al,CKSM_STATUS		; CMOS checksum bad?
		jnz	Clear_Alarm_Date_Yes	; Yes!

		mov	al,0bh + 80h
		call	F000_Get_Cmos
		test	al,00100000b		;alarm interrupt enabled?
		jnz	short No_Clear_Alarm_Date

Clear_Alarm_Date_Yes:

		mov	al,BATTERY_POWER + 80h
		call	F000_Get_Cmos
		and	al,0c0h			;clear date alarm
		mov	ah,al
		mov	al,BATTERY_POWER + 80h
		call	F000_Set_Cmos

No_Clear_Alarm_Date:
endif;	DATE_ALARM_SUPPORT

ifdef	Support_1_FDD
		mov	al,CMOS10[bp]
		and	al,0F0h				;Clear Drive B
		mov	CMOS10[bp],al
endif	;Support_1_FDD

		mov	al,CMOS10
		mov	ah,CMOS10[bp]
		call	F000_Set_Cmos

		pop	ds
		ret

POST_28S	ENDP
;R279 - ends

;[]==============================================================[]
; POST_29S:
;ENTRY: NONE
;EXIT:	NONE
;[]==============================================================[]
POST_29S 	PROC	NEAR
ifdef	PM_SUPPORT
ifdef	MP_SUPPORT
		call	If_MP_PLUGGED
		jnc	short Two_Cpu_Plug
endif;	MP_SUPPORT
		CALL	EARLY_PM_INIT
Two_Cpu_Plug:
endif	;PM_SUPPORT
		ret
POST_29S ENDP

POST_30S:
		ret

⌨️ 快捷键说明

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