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

📄 gapm12.inc

📁 AMI 主板的BIOS源码。
💻 INC
📖 第 1 页 / 共 5 页
字号:
;	Input : As specified in function			;
;		(DS) PM bios data segment			;
;		(AL) APM_CONNECTION_INFO			;
;	Output: (CY) 00 for no error				;
;		(CY) 01 for error				;
;		Required returned registers are updated in stack;
;	Register destroyed : ALL GENERAL PURPOSE except (EBP)	;
;---------------------------------------------------------------;

int_15_ah53_al0f	proc	near

	call	check_apm_dev			; check validity of device and interface
	jnc	short int_15_ah53_al0f_01	; no error...
	ret					; error...(ah) already has error code updated in stack

;-----------------------------------------------;

int_15_ah53_al0f_01:
	mov	dl,not pm_engaged_by_apm	; clear power management engaged bit

	mov	dh,00000000b			; disengage power management
	mov	al,off_disengage_pm_fn		; execute disengage power management
	cmp	cx,disengage_power_management	; disengage power management ?
	jz	short int_15_ah53_al0f_08	; yes...
	cmp	cx,engage_power_management	; engage power management ?
	jnz	short int_15_ah53_al0f_05	; no...error
	mov	dh,pm_engaged_by_apm		; engage power management
	mov	al,off_engage_pm_fn		; execute engage power management

int_15_ah53_al0f_08:
	jmp	exec_apm_common			; execute the function

int_15_ah53_al0f	endp

;---------------------------------------------------------------;
;		  FN# 10H ... GET CAPABILITIES			;
;---------------------------------------------------------------;
;	Input : As specified in function			;
;		(DS) PM bios data segment			;
;		(AL) APM_CONNECTION_INFO			;
;	Output: (CY) 00 for no error				;
;		(CY) 01 for error				;
;		Required returned registers are updated in stack;
;	Register destroyed : ALL GENERAL PURPOSE except (EBP)	;
;---------------------------------------------------------------;

int_15_ah53_al10	proc	near

	cmp	bx,system_bios_device_id	; power device ID for APM BIOS ?
	jnz	int_15_ah53_al10_03		; no...invalid device ID

	call	get_pm_capabilities		; OEM HOOK HOOK HOOK...return power management capabilities in (BL) & (CX)

	mov	ds:apm_no_of_battery_units,bl	;
	mov	ds:apm_pm_capabilities,cx	;

	mov	[ebp+off_bl_apm],bl		; return (bl)
	mov	[ebp+off_cx_apm],cx		; return (cx)

	clc					; (CF) = (NC) for no error
	ret

int_15_ah53_al10	endp

;---------------------------------------------------------------;
;	     FN# 11H ... GET/SET/DISABLE RESUME TIMER		;
;---------------------------------------------------------------;
;	Input : As specified in function			;
;		(DS) PM bios data segment			;
;		(AL) APM_CONNECTION_INFO			;
;	Output: (CY) 00 for no error				;
;		(CY) 01 for error				;
;		Required returned registers are updated in stack;
;	Register destroyed : ALL GENERAL PURPOSE except (EBP)	;
;---------------------------------------------------------------;

int_15_ah53_al11	proc	near

	call	check_apm_connection		; is proper APM connection done ?
	jc	short int_15_ah53_al11_00	; no...

	cmp	bx,system_bios_device_id	; power device ID for APM BIOS ?
	jnz	short int_15_ah53_al11_03	; no...invalid device ID

	test	word ptr ds:apm_pm_capabilities,apm_resume_timer_standby or apm_resume_timer_suspend
	jz	short int_15_ah53_al11_04	; resume timer not supported

	cmp	cl,set_resume_timer		; valid request ?
	ja	short int_15_ah53_al11_05	; error...invalid request
	jz	short int_15_ah53_al11_10	; set resume timer

	cmp	cl,disable_resume_timer		; disable resume timer ?
	jz	short int_15_ah53_al11_20	; yes...

	test	byte ptr ds:apm_misc_info,resume_timer_enabled_by_apm; resume timer enabled ?
	jz	short int_15_ah53_al11_07	; no...disabled...(CF) = (NC)

	mov	ch,ds:apm_12_resume_sec_bcd	; get seconds
	mov	dx,word ptr ds:apm_12_resume_min_bcd; get mins & hours
	mov	si,word ptr ds:apm_12_resume_day_bcd; get day & month
	mov	di,word ptr ds:apm_12_resume_year_bcd; get year & century

	mov	[ebp+off_ch_apm],ch		; return (ch)
	mov	[ebp+off_dx_apm],dx		; return (dx)
	mov	[ebp+off_si_apm],si		; return (si)
	mov	[ebp+off_di_apm],di		; return (di)

;;	clc					; set (CF) = (NC) for no error
int_15_ah53_al11_00:
	ret

;-----------------------------------------------;

int_15_ah53_al11_20:
	and	byte ptr ds:apm_misc_info,not resume_timer_enabled_by_apm; disable resume timer
						; (CF) = (NC)
	ret

;-----------------------------------------------;

int_15_ah53_al11_10:
	mov	di,[ebp+off_di_apm]		; get on entry (di) from stack
	call	check_resume_timer_data		; valid data ?
	jc	short int_15_ah53_al11_05	; error...invalid request
	mov	ds:apm_12_resume_sec_bcd,ch	; set seconds
	mov	word ptr ds:apm_12_resume_min_bcd,dx; set mins & hours
	mov	word ptr ds:apm_12_resume_day_bcd,si; set day & month
	mov	word ptr ds:apm_12_resume_year_bcd,di; set year & century
	or	byte ptr ds:apm_misc_info,resume_timer_enabled_by_apm; enable resume timer
						; (CF) = (NC)
	ret

;-----------------------------------------------;
int_15_ah53_al11_07:
	mov	ah,apm_resume_timer_disabled	; APM resume timer disabled
	jmp	apm_error_exit			;

int_15_ah53_al11_04:
int_15_ah53_al12_04::
	mov	ah,apm_12_func_not_supported	; APM special function not supported
	jmp	apm_error_exit			;

int_15_ah53_al10_03::
int_15_ah53_al11_03:
int_15_ah53_al12_03::
int_15_ah53_al13_03::
	jmp	short apm_err_code_09		; unrecognized device ID

int_15_ah53_al11_05:
int_15_ah53_al12_05::
int_15_ah53_al13_05::
	jmp	apm_err_code_0a			; parameter value out of range

int_15_ah53_al11	endp

;---------------------------------------------------------------;
;	FN# 12H ... ENABLE/DISABLE RESUME ON RING INDICATOR	;
;---------------------------------------------------------------;
;	Input : As specified in function			;
;		(DS) PM bios data segment			;
;		(AL) APM_CONNECTION_INFO			;
;	Output: (CY) 00 for no error				;
;		(CY) 01 for error				;
;		Required returned registers are updated in stack;
;	Register destroyed : ALL GENERAL PURPOSE except (EBP)	;
;---------------------------------------------------------------;

int_15_ah53_al12	proc	near

	call	check_apm_connection		; is proper APM connection done ?
	jc	short int_15_ah53_al12_00	; no...

	cmp	bx,system_bios_device_id	; power device ID for APM BIOS ?
	jnz	short int_15_ah53_al12_03	; no...invalid device ID

	test	word ptr ds:apm_pm_capabilities,apm_resume_ring_standby or apm_resume_ring_suspend or apm_resume_pcmcia_ring_standby or apm_resume_pcmcia_ring_suspend
	jz	short int_15_ah53_al12_04	; resume on ring indicator not supported

	cmp	cx,get_status_resume_on_ring	; valid request ?
	ja	short int_15_ah53_al12_05	; error...invalid request
	jz	short int_15_ah53_al12_10	; get status request

	and	byte ptr ds:apm_misc_info,not resume_on_ring_enabled_by_apm; disable resume on ring indicator
	cmp	cx,disable_resume_on_ring	; disable resume on ring indicator ?
	jz	short int_15_ah53_al12_20	; yes...
	or	byte ptr ds:apm_misc_info,resume_on_ring_enabled_by_apm; enable resume on ring indicator
int_15_ah53_al12_20:
	call	enable_disable_resume_on_ring_indicator; OEM HOOK HOOK HOOK...enable/disable resume on ring indicator

	clc					; set (CF) = (NC) for no error
int_15_ah53_al12_00:
	ret

;-----------------------------------------------;

int_15_ah53_al12_10:
	xor	cx,cx				; set for currently disabled status
	test	byte ptr ds:apm_misc_info,resume_on_ring_enabled_by_apm; resume on ring enabled by APM ?
	jz	short int_15_ah53_al12_11	; no...(CF) = (NC)
	or	cl,00000001b			; set for currently enabled state
						; (CF) = (NC)
int_15_ah53_al12_11:
	mov	[ebp+off_cx_apm],cx		; return (cx)
	ret

int_15_ah53_al12	endp

;---------------------------------------------------------------;
;	FN# 13H ... ENABLE/DISABLE TIMER BASED REQUESTS		;
;---------------------------------------------------------------;
;	Input : As specified in function			;
;		(DS) PM bios data segment			;
;		(AL) APM_CONNECTION_INFO			;
;	Output: (CY) 00 for no error				;
;		(CY) 01 for error				;
;		Required returned registers are updated in stack;
;	Register destroyed : ALL GENERAL PURPOSE except (EBP)	;
;---------------------------------------------------------------;

int_15_ah53_al13	proc	near

	call	check_apm_connection		; is proper APM connection done ?
	jc	short int_15_ah53_al13_00	; no...

	cmp	bx,system_bios_device_id	; power device ID for APM BIOS ?
	jnz	short int_15_ah53_al13_03	; no...invalid device ID

	cmp	cx,get_status_timer_based_req	; valid request ?
	ja	short int_15_ah53_al13_05	; error...invalid request
	jz	short int_15_ah53_al13_10	; get status request

	and	byte ptr ds:apm_misc_info,not timer_based_req_enabled_by_apm; disable timer based req
	cmp	cx,disable_timer_based_req	; disable timer based request ?
	jz	short int_15_ah53_al13_20	; yes...
	or	byte ptr ds:apm_misc_info,timer_based_req_enabled_by_apm; enable timer based request
int_15_ah53_al13_20:
	call	enable_disable_timer_based_req	; OEM HOOK HOOK HOOK...enable/disable timer based request

	clc					; set (CF) = (NC) for no error
int_15_ah53_al13_00:
	ret

;-----------------------------------------------;

int_15_ah53_al13_10:
	xor	cx,cx				; set for currently disabled status
	test	byte ptr ds:apm_misc_info,timer_based_req_enabled_by_apm; timer based request enabled by APM ?
	jz	short int_15_ah53_al13_11	; no...(CF) = (NC)
	or	cl,00000001b			; set for currently enabled state
						; (CF) = (NC)
int_15_ah53_al13_11:
	mov	[ebp+off_cx_apm],cx		; return (cx)
	ret

int_15_ah53_al13	endp

;---------------------------------------------------------------;
;		   SUBROUTINES USED BY APM BIOS			;
;---------------------------------------------------------------;
;			     APM_ERROR				;
;	Input : NONE						;
;	Output: Error code in (AH) updated in stack		;
;	Register destroyed : (AH)				;
;---------------------------------------------------------------;

apm_error	proc	near

;-----------------------------------------------;
;	DUMMY PROCEDURE TO SUBSTITUTE '::'	;
;-----------------------------------------------;

apm_err_code_01	proc	near

	mov	ah,power_management_disabled	; power management functionality disabled
	jmp	short apm_error_exit		;

;-----------------------------------------------;
;	DUMMY PROCEDURE TO SUBSTITUTE '::'	;
;-----------------------------------------------;

apm_err_code_03	proc	near

	mov	ah,interface_not_connected	; APM driver interface not connected
	jmp	short apm_error_exit		;

;-----------------------------------------------;
;	DUMMY PROCEDURE TO SUBSTITUTE '::'	;
;-----------------------------------------------;

apm_err_code_09	proc	near

	mov	ah,invalid_device_id		; unrecognized device ID
	jmp	short apm_error_exit		;

;-----------------------------------------------;
;	DUMMY PROCEDURE TO SUBSTITUTE '::'	;
;-----------------------------------------------;

apm_err_code_0a	proc	near

	mov	ah,parameter_out_of_range	; parameter value out of range
	jmp	short apm_error_exit		;

;-----------------------------------------------;
;	DUMMY PROCEDURE TO SUBSTITUTE '::'	;
;-----------------------------------------------;

apm_err_code_0b	proc	near

	mov	ah,interface_not_engaged	; APM interface not engaged

;-----------------------------------------------;
;	DUMMY PROCEDURE TO SUBSTITUTE '::'	;
;-----------------------------------------------;

apm_error_exit	proc	near

	mov	[ebp+off_ah_apm],ah		; return (ah)
	stc					; (CY) = 01 for error
	ret

apm_error_exit	endp
apm_err_code_0b	endp
apm_err_code_0a	endp
apm_err_code_09	endp
apm_err_code_03	endp
apm_err_code_01	endp
apm_error	endp

;---------------------------------------------------------------;
;			APM_CONNECT_LOCAL			;
;---------------------------------------------------------------;
;	Input : NONE						;
;	Output: NONE						;
;	Register destroyed : (AX),(CX),(DI)			;
;---------------------------------------------------------------;

apm_connect_local	proc	near

	mov	al,not pm_engaged_by_apm	; clear power management engaged by APM info
	mov	ah,pm_engaged_by_apm		; set power management engaged by APM
	jmp	short apm_con_discon		;

apm_connect_local	endp

;---------------------------------------------------------------;
;		      APM_DISCONNECT_LOCAL			;
;---------------------------------------------------------------;
;	Input : NONE						;
;	Output: NONE						;
;	Register destroyed : (AX),(CX),(DI)			;
;---------------------------------------------------------------;

apm_disconnect_local	proc	near

	test	byte ptr ds:apm_connection_info,apm_bios_active_ver_above_v10; APM v1.0 ?
	jnz	short apm_disconnect_local_00	; no...
	ret

apm_disconnect_local_00:
	mov	al,not pm_engaged_by_apm	; clear power management engaged by APM info

⌨️ 快捷键说明

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