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

📄 e0post.asm

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

		PAGE

EGROUP		GROUP	ECODE
DGROUP		GROUP	FCODE
ECODE		SEGMENT USE16 PARA PUBLIC 'ECODE'
		ASSUME	CS:EGROUP,DS:G_RAM,ES:EGROUP

;R26 ;Clock detection is different from P6 CPU and the other CPUs
;R26 ifdef	P6_BIOS_ONLY
;R26
;R26 		ALIGN	16
;R26 MOV_SHAD_OFF	EQU	00000H
;R26 ;R22 MOV_SHAD_SEG	EQU	02000H
;R26 MOV_SHAD_SEG	EQU	8000H 			;R22
;R26 Measure_CPU_Speed	proc	near
;R26
;R26 ;--------------------------------------
;R26 ;Copy code into RAM for speed detection
;R26 ;--------------------------------------
;R26
;R26 		mov	ax,cs			;GET THE SEGMENT
;R26 		mov	ds,ax			;AND SET UP SOURCE
;R26 		mov	ax,MOV_SHAD_SEG 	;SET THE SEGMENT FOR DEST
;R26 		mov	es,ax
;R26 		lea	si,S_Cpu		;GET THE OFFSET FOR SOURCE
;R26 		mov	di,MOV_SHAD_OFF 	;MOVE OFFSET IN FOR DEST
;R26 		lea	cx,LAST_S_Cpu		;GET SETUP FOR THE LENGTH
;R26 		sub	cx,si			;GET THE LENGTH OF THE CODE
;R26
;R26 		push	cx
;R26 		push	es
;R26 		push	di
;R26
;R26 		rep	movsb			;MOVE THE COPY CODE
;R26 		push	0f000h
;R26 		pop	ds
;R26
;R26 		in	al,PORT61
;R26 		IODELAY
;R26 		push	ax
;R26
;R26 		push	cs
;R26 		push	offset SHAD_ret_off
;R26 		push	MOV_SHAD_SEG
;R26 		push	MOV_SHAD_OFF
;R26 		retf
;R26 SHAD_ret_off:
;R26 	;write CPU_INTERNAL_CLOCK[bp] with tested value
;R26
;R26 		mov	CPU_INT_CLOCK[bp],al	;actual internal CPU clock
;R26
;R26 		pop	ax
;R26 		out	PORT61,al
;R26 		IODELAY
;R26
;R26 		mov	al,CPU_INT_CLOCK[bp]	;actual internal CPU clock
;R26 		mov	si,offset P6_Int_Clock_Tbl
;R26
;R26 	;far call Round_Off_Clock
;R26 		FAR_CALL <offset Round_Off_Clock>,0E000h
;R26
;R26 		mov	CPU_INT_CLOCK[bp],bl	;actual internal CPU clock
;R26 		push	G_RAM
;R26 		pop	es
;R26 		mov	bl,cs:[si+2]			;SI+2 = system clock
;R26 		mov	byte ptr es:[CPU_CLOCK],bl
;R26 ;-------------------
;R26 ;Clear temporary RAM
;R26 ;-------------------
;R26
;R26 		pop	di
;R26 		pop	es
;R26 		pop	cx
;R26 		xor	ax,ax
;R26 		rep	stosw			;clear ram
;R26
;R26 		clc
;R26 		ret
;R26 Measure_CPU_Speed	endp
;R26 DIVID		MACRO
;R26 		mov	ax,di
;R26 		div	bx
;R26 		endm
;R26 PORT61		EQU	61H
;R26 PORT8254	EQU	42H
;R26 DATA8254	EQU	43H
;R26 COUNT		EQU	3EH
;R26
;R26 ;-----------------------------------------------------------------
;R26 ;Input	:	None
;R26 ;Output :	BH : System Clock in interger
;R26 ;		BL : System Clock i.e. 10h = 16MHz
;R26 ;				       20h = 20MHz
;R26 ;				       30h = 25MHz
;R26 ;				       40h = 33MHz
;R26 ;				       50h = 40MHz
;R26 ;				       60h = 50MHz
;R26 ;				       60h = 60MHz
;R26 ;				       60h = 66MHz
;R26 ;		DH : Actual CPU clock index found
;R26 ;		DL : Single/Double/Trible
;R26 ;-----------------------------------------------------------------
;R26 		ALIGN	16
;R26 S_Cpu		proc	far
;R26
;R26 		cli
;R26 		mov	al,0fch 	;disable counter 2
;R26 		out	PORT61,al
;R26 		SIODELAY
;R26 		mov	al,0b4h 	;program counter 2
;R26 		out	DATA8254,al
;R26 		IODELAY
;R26 		xor	al,al
;R26 		out	PORT8254,al
;R26 		IODELAY
;R26 		out	PORT8254,al
;R26 		IODELAY
;R26
;R26 		mov	di,7aaah	;dividend
;R26 		mov	bx,5555h	;divisor
;R26 		xor	dx,dx
;R26 		mov	cx,COUNT	;count
;R26 		mov	al,0fdh 	;enable counter
;R26 		out	PORT61,al
;R26 		SIODELAY
;R26 		ALIGN	4
;R26 Divid_33:
;R26 		DIVID			;divide 1
;R26 		DIVID			;divide 2
;R26 		DIVID			;divide 3
;R26 		DIVID			;divide 4
;R26 		DIVID			;divide 5
;R26 		DIVID			;divide 6
;R26 		DIVID			;divide 7
;R26 		DIVID			;divide 8
;R26 		DIVID			;divide 9
;R26 		DIVID			;divide 10
;R26 		DIVID			;divide 11
;R26 		DIVID			;divide 12
;R26 		DIVID			;divide 13
;R26 		DIVID			;divide 14
;R26 		DIVID			;divide 15
;R26 		DIVID			;divide 16
;R26 		DIVID			;divide 17
;R26 		DIVID			;divide 18
;R26 		DIVID			;divide 19
;R26 		DIVID			;divide 20
;R26 		DIVID			;divide 21
;R26 		DIVID			;divide 22
;R26 		DIVID			;divide 23
;R26 		DIVID			;divide 24
;R26 		DIVID			;divide 25
;R26 		DIVID			;divide 26
;R26 		DIVID			;divide 27
;R26 		DIVID			;divide 28
;R26 		DIVID			;divide 29
;R26 		DIVID			;divide 30
;R26 		DIVID			;divide 31
;R26 		DIVID			;divide 32
;R26 		DIVID			;divide 33
;R26 		dec	cx
;R26 		jz	short Finish
;R26 		jmp	Divid_33
;R26 Finish:
;R26 		mov	al,0fch 	;stop counter 2
;R26 		out	61h,al
;R26 		SIODELAY
;R26 		in	al,PORT8254	;read counter 2 low byte
;R26 		IODELAY
;R26 		mov	ah,al
;R26 		in	al,PORT8254	;read counter 2 high byte
;R26 		IODELAY
;R26 		xchg	ah,al
;R26 		mov	si,ax		;store result
;R26
;R26 		xor	dx,dx
;R26 		mov	cx,COUNT	;count
;R26 		mov	al,0fdh 	;enable counter
;R26 		out	PORT61,al
;R26 		SIODELAY
;R26 		ALIGN	4
;R26 Divid_1:
;R26 		DIVID			;divide 1
;R26 		dec	cx
;R26 		jz	short Finish1
;R26 		jmp	short Divid_1
;R26 Finish1:
;R26 		mov	al,0fch 	;stop counter 2
;R26 		out	61h,al
;R26 		SIODELAY
;R26 		in	al,PORT8254	;read counter 2 low byte
;R26 		IODELAY
;R26 		mov	ah,al
;R26 		in	al,PORT8254	;read counter 2 high byte
;R26 		IODELAY
;R26 		xchg	ah,al
;R26 		mov	cx,ax
;R26 		sub	cx,si		;result 2 - result 1
;R26
;R26 ;factor for P6 CPU
;R26 		xor	ax,ax
;R26 		mov	dx,0052h	;dividend high word
;R26
;R26 		div	cx
;R26
;R26 		xor	bl,bl
;R26 Sub_1:
;R26 		inc	bl
;R26 		sub	ax,100
;R26 		jc	short Fin_0
;R26 		jz	short No_Carry
;R26 		jmp	short Sub_1
;R26 Fin_0:
;R26 		add	ax,100
;R26
;R26 		cmp	al,50
;R26 		jae	short No_Carry
;R26 		dec	bl
;R26 No_Carry:
;R26
;R26 		mov	al,bl
;R26 		add	al,3	       ;tolerance
;R26
;R26 		ret
;R26
;R26
;R26 		even
;R26 Last_S_Cpu:
;R26 S_Cpu		endp
;R26
;R26
;R26 ;[]--------------------------------------------------------------[]
;R26 ;Input	:	AL = Clock to be compared
;R26 ;		SI = table offset
;R26 ;		     (format: reference System_Clock_Table)
;R26 ;		CX = no of entries
;R26 ;
;R26 ;Output :	BH = reference value (see System_Clock_Table)
;R26 ;		BL = round-offed value
;R26 ;		SI = offset which round-offed value locates
;R26 ;[]--------------------------------------------------------------[]
;R26 Round_Off_Clock Proc	Far
;R26 Next_Clk_Tbl:
;R26 		mov	bx,cs:[si]
;R26 		cmp	al,bh
;R26 		jae	short @F
;R26 		cmp	byte ptr cs:[si+3],0	;last table ?
;R26 		je	short @F
;R26 		add	si,3			;next table
;R26 		jmp	short Next_Clk_Tbl
;R26 @@:
;R26 		retf
;R26 Round_Off_Clock Endp
;R26
;R26 ;--------------------------------------------------------------------
;R26 ;			round	  value 	value
;R26 ;			offed	  for		to be put
;R26 ;			output	  reference	into G_RAM:CPU_CLOCK
;R26 ;--------------------------------------------------------------------
;R26 P6_Int_Clock_Tbl:
;R26 		db	200,	195,	CPU66		;66x3
;R26 		db	180,	175,	CPU60		;60x3
;R26 		db	167,	163,	CPU66		;66x2.5
;R26 		db	150,	145,	CPU60		;60x2.5
;R26
;R26 		db	133,	127,	CPU66		;66x2
;R26 		db	120,	110,	CPU60		;60x2
;R26 		db	100,   	95,	CPU50		;50x2
;R26 		db	 80,   	75,	CPU40		;40x2
;R26 		db	0		;end of table
;R26 else;	P6_BIOS_ONLY

;R26 - starts
;R85 ;[]==============================================================[]
;R85 ;
;R85 ;CpuClk_Int08:
;R85 ;
;R85 ;	Temporary interrupt service routine for caculating CPU clock
;R85 ;
;R85 ;Saves: NONE
;R85 ;
;R85 ;Entry: NONE
;R85 ;Exit:	NONE
;R85 ;
;R85 ;[]==============================================================[]
;R85 		ALIGN	4
;R85 CpuClk_Int08	PROC	NEAR
;R85
;R85 		push	edx
;R85
;R85 		db	0fh,31h			;ReaD Time Stamp Counter
;R85 		cmp	dword ptr ds:[4fch],-1	;high 32 bit value
;R85 		je	short First_Int
;R85
;R85 		cmp	byte ptr ds:[4f0h],0aaH	;second INT ?
;R85 		je	short Finish_Int
;R85
;R85 		mov	edi,dword ptr ds:[4fch]	;high 32 bit value
;R85 		mov	esi,dword ptr ds:[4f8h]	;low 32 bit value
;R85
;R85 		sub	edx,edi			;high 32-bit value
;R85 		sub	eax,esi			;low 32-bit value
;R85 		jnc	short No_Dec_High32
;R85 		dec	edx
;R85 No_Dec_High32:
;R85 		mov	dword ptr ds:[4fch],edx	;high 32 bit value
;R85 		mov	dword ptr ds:[4f8h],eax	;low 32 bit value
;R85
;R85
;R85 		mov	byte ptr ds:[4f0h],0aaH;mark for second INT
;R85 		jmp	short Finish_Int
;R85
;R85
;R85 First_Int:
;R85 		mov	dword ptr ds:[4fch],edx	;high 32 bit value
;R85 		mov	dword ptr ds:[4f8h],eax	;low 32 bit value
;R85
;R85 Finish_Int:
;R85 		pop	edx
;R85
;R85 		NEWIODELAY
;R85 		mov	al,END_OF_INT		; eoi command
;R85 		out	a8259,al		; tell controller
;R85 		NEWIODELAY
;R85
;R85 		iret
;R85 CpuClk_Int08	ENDP
;R85
;R85 ;-----------------------------------------------------------------
;R85 ;Input	:	None
;R85 ;Output :	carry set - this CPU don't have instruction RDTSC
;R85 ;		carry clear - this CPU have instruction RDTSC and
;R85 ;		BX : CPU clock detected (0-65535Mhz) return
;R85 ;Destroy:	use 0:4f8H - 0:4ffH as temporary memory
;R85 ;-----------------------------------------------------------------
;R85 ;
;R85 New_CpuClk_Detection	proc	near
;R85 ;use RDTSC to check CPU clock if 586 level CPU
;R85 		cli
;R85 		cmp	byte ptr CPU_LEVEL[bp], LEVEL_686
;R85 		je	short Yes_Rdtsc
;R85 		cmp	byte ptr CPU_LEVEL[bp], LEVEL_586
;R85 		stc				;assume CPU no counter
;R85 		jne	No_Rdtsc
;R85
;R85 Yes_Rdtsc:
;R85 		xor	edx,edx
;R85 		xor	eax,eax			;input value = 1
;R85 		mov	ds,ax
;R85 		push	dword ptr ds:[4*6]	;save int 06h vector
;R85 		mov	word ptr ds:[4*6],offset Temp_Int06
;R85 		mov	word ptr ds:[4*6+2], cs
;R85
;R85 		db	0fh,31h			;ReaD Time Stamp Counter
;R85
;R85 		pop	dword ptr ds:[4*6]	;restore int 06h vector
;R85
;R85 		or	eax,edx			;counter changed ?
;R85 		stc				;assume CPU no counter
;R85 		jz	short No_Rdtsc		;no , this CPU don't have
;R85 						;counter
;R85
;R85 		mov	ax,G_RAM		; seg_0
;R85 		mov	ds,ax
;R85 		assume	ds:G_RAM
;R85
;R85 		mov	byte ptr ds:[4f8h],0	;init flag
;R85 		mov	dword ptr ds:[4f8h],0	;init low dword value
;R85 		mov	dword ptr ds:[4fch],-1	;init high dword value
;R85
;R85 ;
;R85 ;	Move INT 08h vector to a temporary routine
;R85 ;
;R85
;R85 		mov	dx,word ptr [int08]	; save vector
;R85 		mov	bx,word ptr [int08+2]
;R85
;R85 		mov	word ptr [int08],offset CpuClk_Int08; tmr isr entry
;R85 		mov	word ptr [int08+2],cs	; code segment
;R85
;R85 ;
;R85 ;	Enable just the timer interrupt
;R85 ;

⌨️ 快捷键说明

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