📄 gapm12.inc
字号:
; Required returned registers are updated in stack;
; Register destroyed : ALL GENERAL PURPOSE except (EBP) ;
;---------------------------------------------------------------;
apm_connect_common proc near
call check_real_mode_call ; called in real mode & valid device ID ?
jc short apm_connect_common_00 ; no...error
;-----------------------------------------------;
test al,apm_real_mode_connect_est ; APM real mode connection already established ?
jnz short apm_connect_common_02 ; yes...error
test al,apm_16bit_mode_connect_est ; APM 16 bit protected mode connection already established ?
jnz short apm_connect_common_04 ; yes...
test al,apm_32bit_mode_connect_est ; APM 32 bit protected mode connection already established ?
jnz short apm_connect_common_05 ; yes...
;-----------------------------------------------;
or al,dl ;
mov ds:apm_connection_info,al ; set APM_CONNECTION_INFO
call set_rom_apm_connection_info ; set ROM_APM_CONNECTION_INFO
mov al,process_apm_connect ;
call css_entry_std ; call chipset specific module
call apm_connect_local ; do any local data area updation for APM connect
;-----------------------------------------------;
; FOLLOWING CODE HAS BEEN ADDED TO HANDLE A ;
; BUG IN DOS POWER.EXE. THE BUG RELATED TO ;
; SWITCHING BETWEEN POWER ON/OFF SETTINGS. ;
;-----------------------------------------------;
push ebp ;
mov ax,53h*256+apm_func_08 ; enable/disable power management call
mov bx,all_pm_device_id_v10 ; all devices power managed by APM BIOS
mov cx,enable_power_management ; enable power management
mov bp,00000001b ; set for called in real mode
call apm_call_near ;
pop ebp ;
;-----------------------------------------------;
mov al,dl ; (al) = bit 0/1/2 set APM real/16 bit/32 bit mode connection request
test al,00000001b ; APM real mode connect request ?
jnz short apm_connect_common_10 ; yes...
;-----------------------------------------------;
; REMOVED TO SUPPORT 'CHICAGO' ;
;-----------------------------------------------;
; test byte ptr ds:apm_connection_info,apm_bios_active_ver_above_v10; APM BIOS active v1.0 ?
; jz short apm_connect_common_07 ; yes...v1.0
;-----------------------------------------------;
test byte ptr ds:apm_connection_info,apm_bios_active_ver_v12; active APM v1.2 ?
jz short apm_connect_common_15 ; no...
mov word ptr [ebp+off_si_apm+2],apm_bios_code_seg_len; (si+) = APM BIOS 16 bit code segment length
; currently 16 bit/32 bit code segment length same
apm_connect_common_15:
call get_apm_bios_data_seg_len ; (di) = APM BIOS data segment length
mov [ebp+off_di_apm],di ; return (di)
;-----------------------------------------------;
apm_connect_common_07:
call get_apm_16_32_bit_code_seg ; (bx) = APM BIOS 16 bit/32 bit protected mode code segment
mov [ebp+off_ax_apm],bx ; return (ax)
call get_apm_16_32_bit_data_seg ; (dx) = APM BIOS 16 bit/32 bit protected mode data segment
test al,00000010b ; APM 16 bit protected mode connect request ?
jnz short apm_connect_common_11 ; yes...
mov [ebp+off_cx_apm],bx ; return (cx)
mov [ebp+off_dx_apm],dx ; return (dx)
call get_apm_32_bit_entry_point ; NON-SMI CORE BIOS ENTRY POINT...(ebx) = APM bios 32 bit protected mode entry point
mov [ebp+off_ebx_apm],ebx ; return (ebx)
clc ; set (CY) = 00 for no error
apm_connect_common_00:
ret
apm_connect_common_11:
mov [ebp+off_cx_apm],dx ; return (cx)
call get_apm_16_bit_entry_point ; NON-SMI CORE BIOS ENTRY POINT...(bx) = APM bios 16 bit protected mode entry point
mov [ebp+off_bx_apm],bx ; return (bx)
apm_connect_common_10:
clc ; set (CY) = 00 for no error
ret
;-----------------------------------------------;
apm_connect_common_02:
mov ah,real_mode_connect_present ; real mode interface connection already established
jmp short apm_connect_common_exit ;
apm_connect_common_04:
mov ah,prot_mode_16bit_connect_present; 16 bit protected mode interface already established
jmp short apm_connect_common_exit ;
apm_connect_common_05:
mov ah,prot_mode_32bit_connect_present; 32 bit protected mode interface already established
apm_connect_common_exit:
jmp apm_error_exit ;
apm_connect_common endp
;---------------------------------------------------------------;
; CHECK_REAL_MODE_CALL ;
;---------------------------------------------------------------;
; Input : (DS) PM bios data segment ;
; (BX) device ID ;
; (AL) APM_CONNECTION_INFO ;
; Output: (CY) 00 for no error ;
; (CY) 01 for error...invalid function ;
; ...unrecognized device ID ;
; Register destroyed : (AH) for error ;
;---------------------------------------------------------------;
check_real_mode_call proc near
test byte ptr [ebp+off_bp_apm],00000001b; called in real mode ?
jz short check_real_mode_call_00 ; no...invalid function
cmp bx,system_bios_device_id ; power device ID for APM BIOS ?
jnz short check_real_mode_call_01 ; no...error
ret
;-----------------------------------------------;
check_real_mode_call_00::
mov ah,unsupported_func ; function not supported
jmp apm_error_exit ;
check_real_mode_call_01:
int_15_ah53_al04_01::
jmp apm_err_code_09 ; unrecognized device ID
check_real_mode_call endp
;---------------------------------------------------------------;
; FN# 04H ... APM INTERFACE DISCONNECT ;
;---------------------------------------------------------------;
; 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_al04 proc near
test al,(apm_real_mode_connect_est or apm_16bit_mode_connect_est or apm_32bit_mode_connect_est); is proper APM connection done ?
jz short int_15_ah53_al04_00 ; no...
cmp bx,system_bios_device_id ; power device ID for APM BIOS ?
jnz short int_15_ah53_al04_01 ; no...error
and al,not (apm_real_mode_connect_est or apm_16bit_mode_connect_est or apm_32bit_mode_connect_est); set APM is disconnected
mov ds:apm_connection_info,al ; set APM_CONNECTION_INFO
call set_rom_apm_connection_info ; set ROM_APM_CONNECTION_INFO
mov al,process_apm_disconnect ;
call css_entry_std ; call chipset specific module
call apm_disconnect_local ; do any local data area updation for APM disconnect
clc ; (CY) = 00 for no error
ret
;-----------------------------------------------;
int_15_ah53_al04_00:
check_apm_connection_00::
jmp apm_err_code_03 ; ser error APM not connected
int_15_ah53_al04 endp
;---------------------------------------------------------------;
; CHECK_APM_CONNECTION ;
;---------------------------------------------------------------;
; Input : (DS) PM bios data segment ;
; (AL) APM_CONNECTION_INFO ;
; Output: (CY) 00 for no error ;
; (CY) 01 for error...APM not connected ;
; ...APM not engaged ;
; Register destroyed : (AH) for error ;
;---------------------------------------------------------------;
check_apm_connection proc near
test al,[ebp+off_bp_apm] ; is proper APM connection done ?
jz short check_apm_connection_00 ; no...
test al,apm_bios_active_ver_above_v10; APM v1.0 ?
jz short check_apm_connection_01 ; yes...(CY) = 00
test byte ptr ds:apm_state,pm_engaged_by_apm ; power management engaged by APM ?
jz short check_apm_connection_06 ; no...(CY) = 00
check_apm_connection_01:
ret
;-----------------------------------------------;
check_apm_connection_06:
jmp apm_err_code_0b ; interface not engaged
check_apm_connection endp
;---------------------------------------------------------------;
; FN# 05H ... CPU IDLE ;
;---------------------------------------------------------------;
; 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_al05 proc near
call check_apm_connection ; is proper APM connection done ?
jc short int_15_ah53_al05_00 ; no...
mov al,set_pre_cpu_idle_environment ; setup before going for cpu slow/stop clock
call css_entry_std ;
mov al,apm_cpu_idle_call ; set stop clock/slow clock
call css_entry_std ;
mov al,set_post_cpu_idle_environment; setup after coming out of stop clock
call css_entry_std ;
clc ; set (CY) = 00 for no error
int_15_ah53_al05_00:
ret
int_15_ah53_al05 endp
;---------------------------------------------------------------;
; FN# 06H ... APM CPU BUSY ;
;---------------------------------------------------------------;
; 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_al06 proc near
call check_apm_connection ; is proper APM connection done ?
jc short int_15_ah53_al06_00 ; no...
mov al,apm_cpu_busy_call ; set to full processor clock speed
call css_entry_std ;
clc ; set (CY) = 00 for no error
int_15_ah53_al06_00:
ret
int_15_ah53_al06 endp
;---------------------------------------------------------------;
; FN# 07H ... SET POWER STATE ;
;---------------------------------------------------------------;
; 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_al07 proc near
call check_apm_dev ; check validity of device and interface
jc short int_15_ah53_al07_50 ; error...(ah) already has error code updated in stack
test al,apm_bios_active_ver_above_v10; APM BIOS active v1.0 ?
jz short int_15_ah53_al07_11 ; yes...
mov al,processing_last_pm_req_notify;
cmp cx,apm_last_req_processing_notify; last APM BIOS request is being processed notification ?
jz short int_15_ah53_al07_20 ; yes...
mov al,last_pm_req_rejected ;
cmp cx,apm_last_req_rejected ; last APM BIOS request rejected notification ?
jnz short int_15_ah53_al07_11 ; no...
;-----------------------------------------------;
int_15_ah53_al07_20:
cmp bx,all_power_managed_device_id ; all devices power managed by APM BIOS ?
jnz short int_15_ah53_al07_09 ; no...invalid device ID
test byte ptr ds:apm_state,pm_engaged_by_apm ; power management engaged by APM ?
jz short int_15_ah53_al07_24 ; no...
call css_entry_std ; process in chipset specific module
clc ; (cy) = 00 for no error
int_15_ah53_al07_50:
ret
;-----------------------------------------------;
int_15_ah53_al07_11:
mov dl,not (apm_on_state or apm_fn0c_enabled); clear APM state & func 0Ch enabled
cmp cx,apm_suspend ; set APM suspend state ?
jz short int_15_ah53_al07_02 ; yes...
mov dh,apm_standby_state or apm_fn0c_enabled
mov al,off_set_apm_standby_fn ; set APM standby state
cmp cx,apm_standby ; set APM standby state ?
jz short int_15_ah53_al07_08 ; yes...
mov dh,apm_enabled_state or apm_fn0c_enabled
mov al,off_set_apm_enabled_fn ; set APM enabled state
cmp cx,apm_enabled ; set APM enabled state ?
jz short int_15_ah53_al07_04 ; yes...
mov dh,apm_off_state or apm_fn0c_enabled
mov al,off_set_apm_off_fn ; set APM off state
cmp cx,apm_off ; set APM off state ?
jnz short int_15_ah53_al07_05 ; no...error
test byte ptr ds:apm_connection_info,apm_bios_active_ver_above_v10; APM BIOS active v1.0 ?
jnz short int_15_ah53_al07_08 ; no...
int_15_ah53_al07_04:
cmp bx,all_power_managed_device_id ; all devices power managed by APM BIOS ?
jz short int_15_ah53_al07_10 ; yes...unable to enter requested state
jmp short int_15_ah53_al07_08 ;
int_15_ah53_al07_02:
;-----------------------------------------------;
; AS FOR SYSTEM SUSPEND CALL, WHILE ;
; IT RETURNS TO CALLER, THE SYSTEM ;
; SHOULD RESUME FROM SUSPEND, SO ;
; THE SYSTEM STATE SHOULD BE PLACED ;
; IN 'apm_enabled' STATE ;
;-----------------------------------------------;
mov dh,apm_enabled_state or apm_fn0c_enabled
mov al,off_set_apm_suspend_fn ; set APM suspend state
cmp bh,system_device_id ; is request for system ?
jz short int_15_ah53_al07_08 ; yes...
mov dh,apm_suspend_state or apm_fn0c_enabled
int_15_ah53_al07_08:
jmp exec_apm_common ; execute the function
;-----------------------------------------------;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -