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

📄 oemrun.asm

📁 AMI 主板的BIOS源码
💻 ASM
📖 第 1 页 / 共 3 页
字号:
        dw      34300,          333
	dw	36000,		350
        dw      41000,          400
	dw	46000,		450
	dw	51000,		500
	dw	56000,		550
	dw	61000,		600
cpu_freq_table_end	label	byte
;-----------------------------------------------------------------------;
;				CHANGE_SPEED				;
;-----------------------------------------------------------------------;
;  this is called from INT-9 ISR. this is in INT-9.ASM.			;
;  input :								;
;	ds	0040H							;
;	stack	available						;
;  register usage : do not destroy any register				;
;=================== NOTE ==== NOTE ==== NOTE =========================	;
;  this routine is moved here from NRUNTIME.ASM file. The generic code	;
;  of this routine takes much space so we decided to disable the generic;
;  code. If any OEM needs this generic code, then activate the generic	;
;  code.								;
;  Default implementation : <CTRL><ALT> keystrokes are not supported.	;
;  To support <CTRL><ALT> : Activate the generic code.			;
;-----------------------------------------------------------------------;
IF	MKF_CTRL_ALT			; generic code for <CTRL><ALT>
	public	change_speed		; change CPU speed/cache etc
change_speed:
	cli
	cmp	al,cgroup:_ctrl_alt_minus
	jnz	cs_1
	test	ds:byte ptr [17h],00000011b
	jz	cs_3
	call	cache_off		; <ctrl><alt><shift><->
	jmp	short cs_2
cs_3:
	call	frequency_low		; <ctrl><alt><->
	jmp	short cs_2
cs_1:
	cmp	al,cgroup:_ctrl_alt_plus
	jnz	cs_5
	test	ds:byte ptr [17h],00000011b
	jz	cs_4
	call	cache_on		; <ctrl><alt><shift><+>
	jmp	short cs_2
cs_4:
	call	frequency_high		; <ctrl><alt><->
	jmp	short cs_2
cs_5:
;---------------------------------------;
COMMENT !
;  if hot-key setup is needed, activate the following code..
	cmp	al,cgroup:_ctrl_alt_setup; hot key setup
	jnz	cs_2			; no
	test	cgroup:misc_info,hot_key_setup_bit; hot key setup enabled ?
	jz	cs_2			; no
;  verify that lower 32k of rom is present..
	push	ax
	push	es
	push	di
	push	si
	push	cx
	push	cs
	pop	es
	mov	di,offset cgroup:_bios_name; ES:DI = ptr to normal bios name
	xor	si,si			; CS:SI = ptr to name present at CS:0000h
	mov	cx,0008h		; 8bytes name
	push	si
	push	cx
	db	2eh			; segcs
	repz	cmpsb
	pop	cx
	pop	si
;;;;	jz	cs_7			; setup present in lower 32k
;;;;	mov	di,offset cgroup:_setup_name; ES:DI = ptr to compressed setup name
;;;;	db	2eh			; segcs
;;;;	repz	cmpsb
;;;;cs_7:
	pop	cx
	pop	si
	pop	di
	pop	es
	jnz	cs_0			; not present
	mov	ax,ds:word ptr [72h]
	cmp	al,'S'			; in setup ?
	jz	cs_0			; yes
	cmp	al,'H'			; in hot-key setup ?
	jz	cs_0			; yes
	cmp	ah,'P'			; in password checking ?
	jz	cs_0			; yes
	or	ax,ax
	jnz	cs_0
	mov	ds:byte ptr [72h],'h'	; indicate to invoke hot-key setup
cs_0:
	pop	ax
!
;---------------------------------------;
cs_2:
	sti
	ret
;-----------------------------------------------------------------------;
; all registers must be saved except CX. (ds) = 40h always set, this	;
; routine is also called from INT-8, INT-16, be careful about registers.;
;-----------------------------------------------------------------------;
	public	frequency_low
frequency_low:
	push	si
	push	dx
	push	ax
	mov	si,offset cgroup:_low_speed_chipset
	mov	dx,offset cgroup:low_speed
	mov	ax,2000h		; AL = 00 for low speed
					; AH = OR value, bit-5 = 1..low speed
freq_cache_common:
	call	freq_low_high_cache_on_off
freq_cache_common_exit:
	pop	ax
	pop	dx
	pop	si
	ret
;-----------------------------------------------------------------------;
	public	frequency_high
frequency_high:
	push	si
	push	dx
	push	ax
	mov	si,offset cgroup:_high_speed_chipset
	mov	dx,offset cgroup:high_speed
	mov	ax,0df01h		; AL = 01 for high speed
					; AH = AND value, bit-5 = 0..high speed
	jmp	short freq_cache_common
;-----------------------------------------------------------------------;
	public	cache_on
cache_on:
	pushad
	call	enable_l1_cache
	popad
	push	si
	push	dx
	push	ax
	mov	si,offset cgroup:_cache_on_chipset
	mov	dx,offset cgroup:enable_l2_cache
	mov	ax,1002h		; AL = 02 for cache on
					; AH = OR value, bit-4 = 1..cache on
	jmp	short freq_cache_common
;-----------------------------------------------------------------------;
	public	cache_off
cache_off:
	push	si
	push	dx
	push	ax
	mov	si,offset cgroup:_cache_off_chipset
	mov	dx,offset cgroup:disable_l2_cache
	mov	ax,0ef03h		; AL = 03 for cache off
					; AH = AND value, bit-4 = 0..cache off
	call	freq_low_high_cache_on_off
	pushad
	call	disable_l1_cache
	popad
	jmp	short freq_cache_common_exit
;-----------------------------------------------------------------------;
freq_low_high_cache_on_off:
	push	ax
	xor	cx,cx			; func not done
	cmp	cgroup:byte ptr [si],0
	jz	fc_01			; no chipset used
	call	dx
fc_01:
	mov	al,cgroup:[si+1]
	or	al,al
	jz	fc_02			; no 8042 pin used
	out	64h,al
fc_06:
	jcxz	short $+2		; i/o delay
	in	al,64h
	test	al,00000001b		; wait for o/b full
	jz	fc_06
	in	al,60h
	mov	cl,0ffh			; CX <>00..func done
fc_02:
	mov	dx,cgroup:[si+2]
	or	dx,dx
	jz	fc_03			; no external port used
	in	al,dx
	jcxz	short $+2		; i/o delay
	jcxz	short $+2		; i/o delay
	and	al,cgroup:[si+5]
	or	al,cgroup:[si+4]
	out	dx,al
	mov	cl,0ffh			; CX <>00..func done
fc_03:
	pop	ax
	jcxz	fc_04			; CX = 00..func not done
	test	al,1			; bit- 0 = 0/1..OR/AND
	jz	fc_05
	and	ds:byte ptr [0016h],ah
	jmp	short fc_04
fc_05:
	or	ds:byte ptr [0016h],ah
fc_04:
	ret
;-----------------------------------------------------------------------;
ELSE					; <CTRL><ALT> support not needed
;-----------------------------------------------------------------------;
	public	change_speed		; change CPU speed/cache etc
change_speed:
	ret
COMMENT ~
;-----------------------------------------------------------------------;
; all registers must be saved except CX. (ds) = 40h always set, this	;
; routine is also called from INT-8, INT-16, be careful about registers.;
;-----------------------------------------------------------------------;
	public	frequency_low
frequency_low:
	push	dx
	push	ax
	call	low_speed
	mov	ax,0df20h		; AH, AL = AND, OR value
fl_01:
	jcxz	short fl_00		; CX = 00..func not done
fl_02:
	and	ds:byte ptr [0016h],ah
	or	ds:byte ptr [0016h],al
fl_00:
	pop	ax
	pop	dx
	ret
;-----------------------------------------------------------------------;
	public	frequency_high
frequency_high:
	push	dx
	push	ax
	call	high_speed
	mov	ax,0df00h		; AH, AL = AND, OR value
	jmp	short fl_01
;-----------------------------------------------------------------------;
	public	cache_on
cache_on:
	pushad
	call	enable_l1_cache
	popad
	push	dx
	push	ax
	call	enable_l2_cache
	mov	ax,0ef10h		; AH, AL = AND, OR value
					; bit-4 = 1..cache on
	jmp	short fl_02
;-----------------------------------------------------------------------;
	public	cache_off
cache_off:
	push	dx
	push	ax
	call	disable_l2_cache
	mov	ax,0ef00h		; AH, AL = AND, OR value
					; bit-4 = 0..cache off
	pushad
	call	disable_l1_cache
	popad
	jmp	short fl_02
~
	public	frequency_high
	public	frequency_low
frequency_high:
frequency_low:
	ret

;-----------------------------------------------------------------------;
ENDIF
;-----------------------------------------------------------------------;
;			TIMER_INTERRUPT_INT8				;
;-----------------------------------------------------------------------;
; This routine will get control in every timer tick, any special turbo	;
; switch can be done here. this is called from INT-8 ISR in INT8.INC.	;
; input :								;
;	DS	40H							;
;	stack	available						;
; output:								;
;	none								;
; register usage : DO NOT destroy any register				;
; Note: This routine can be used to implement the turbo switch using	;
; OEM specific stuff. The following code uses KB controller pin.	;
;-----------------------------------------------------------------------;
	public	timer_interrupt_int8
	extrn	timer_interrupt_int8_end:near
timer_interrupt_int8:
IF	MKF_TURBO_SWITCH
	extrn	turbo_switch:near
	public	turbo_switch_end
	jmp	turbo_switch
turbo_switch_end:
ENDIF					; No Turbo Switch support
;	push	ax
;	mov	al,0ah
;	call	cmos_data_in_x
;	test	al,080h			; CMOS0A.7=1 (time update in progress) ?
;	jnz	update_in_progress	; yes..

;       mov	al,032h			; Century byte
;	call	cmos_data_in_x
;	mov	ah,al
;	mov	al,009h			; RTC year
;	call	cmos_data_in_x
;	cmp	ax,1900h		; AC1900 ?
;	jne	update_in_progress
;	mov	ax,20h*256+32h
;	call	cmos_data_out_x		; 1900 -> 2000, (06/27/1995)
;update_in_progress:
; 	pop	ax

	jmp	timer_interrupt_int8_end
;-----------------------------------------------------------------------;
	public	_OEM_RUNTIME_ENDS
_OEM_RUNTIME_ENDS	label	 byte	; marks end of module
;---------------------------------------;
_text   ends
	end

⌨️ 快捷键说明

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