📄 gpmmisc.inc
字号:
Subttl. Include file for GREEN PC support MISCELLANEOUS subroutines...GPMMISC.INC
;-----------------------------------------------;
; FOLLOWING ROUTINES USED FROM OTHER MODULES ;
;-----------------------------------------------;
;; public smi_cmos_data_in_x ;
;; public smi_cmos_data_out_x ;
;; public smi_cmos_data_in ;
;; public smi_cmos_data_out ;
;; public read_8259_irr_reg ;
;; public save_and_mask_intr ;
;; public mask_all_8259 ;
;; public restore_and_unmask_intr ;
;; public enquire_intr_pending_system ;
;; public irq_apm_save_and_mask_intr ;
;; public irq_apm_restore_and_unmask_intr ;
;; public disable_video_display_3c0 ;
;; public enable_video_display_3c0 ;
;; public disable_video_display_3c4 ;
;; public enable_video_display_3c4 ;
;; public disable_horz_vert_retrace ;
;; public enable_horz_vert_retrace ;
;; public get_ebp_for_stack_usage ;
;; public check_irq_pm ;
;; public check_irq_apm ;
;; public pm_fixed_delay ;
;; public single_sht_beep ;
;; public bcd_to_binary ;
;; public hr_min_sec_to_sec ;
;; public sec_to_hr_min_sec ;
;; public date_to_binary ;
;; public binary_to_bcd ;
;; public get_rtc_date ;
;; public get_rtc_time ;
;; public read_rtc_alarm ;
;; public wait_for_update_complete ;
;; public cmos_stat_reg_b_read ;
;; public cmos_stat_reg_c_read ;
;-----------------------------------------------;
;*****************************************************************;
;*****************************************************************;
;** **;
;** (C)Copyright 1985-1996, American Megatrends Inc. **;
;** **;
;** All Rights Reserved. **;
;** **;
;** 6145-F, Northbelt Parkway, Norcross, **;
;** **;
;** Georgia - 30071, USA. Phone-(770)-246-8600. **;
;** **;
;*****************************************************************;
;*****************************************************************;
;---------------------------------------------------------------;
; SUPPORTIVE ROUTINES PROVIDED BY GRREN PC CORE BIOS ;
; SUPPORTIVE ROUTINES PROVIDED BY GRREN PC CORE BIOS ;
; SUPPORTIVE ROUTINES PROVIDED BY GRREN PC CORE BIOS ;
; SUPPORTIVE ROUTINES PROVIDED BY GRREN PC CORE BIOS ;
;---------------------------------------------------------------;
; SMI_CMOS_DATA_IN_X ;
;---------------------------------------------------------------;
; Input : (AL) index to read ;
; Output: (AL) data ;
; Register destroyed : NONE except (AL) ;
;---------------------------------------------------------------;
smi_cmos_data_in_x proc near
pushf ; save current interrupt status
cli ; disable interrupts
out cmos_address_port,al ; select the index
smi_io_delay ;
in al,cmos_data_port ; (al) = read the data
popf ; restore interrupt status
ret
smi_cmos_data_in_x endp
;---------------------------------------------------------------;
; SMI_CMOS_DATA_OUT_X ;
;---------------------------------------------------------------;
; Input : (AL) index to write ;
; (AH) data ;
; Output: NONE ;
; Register destroyed : NONE ;
;---------------------------------------------------------------;
smi_cmos_data_out_x proc near
pushf ; save interrupt status
cli ; disable interrupts
out cmos_address_port,al ; select the index
smi_io_delay ;
xchg al,ah ; (al) = data
out cmos_data_port,al ; write the data
popf ; restore interrupt status
xchg al,ah ;
ret
smi_cmos_data_out_x endp
;---------------------------------------------------------------;
; SMI_CMOS_DATA_IN ;
;---------------------------------------------------------------;
; Input : (AL) index to read ;
; Output: (AL) data ;
; Register destroyed : NONE except (AL) ;
;---------------------------------------------------------------;
smi_cmos_data_in proc near
pushf ; save current interrupt status
cli ; disable interrupts
push bx ;
mov bl,al ; (bl) msb has NMI on/off status
or al,10000000b ; make NMI off
call smi_cmos_data_in_x ; (al) = read the data
push ax ; save the data
;-----------------------------------------------;
smi_cmos_data_inout_00::
mov al,cmos_stat_reg_d ; default CMOS I/O reg
test bl,10000000b ; NMI off on entry ?
jz short smi_cmos_data_in_01 ; no...on
or al,10000000b ; make NMI off
smi_cmos_data_in_01:
call smi_cmos_data_in_x ; dummy read
pop ax ;
pop bx ;
popf ;
ret
smi_cmos_data_in endp
;---------------------------------------------------------------;
; SMI_CMOS_DATA_OUT ;
;---------------------------------------------------------------;
; Input : (AL) index to write ;
; (AH) data ;
; Output: NONE ;
; Register destroyed : NONE ;
;---------------------------------------------------------------;
smi_cmos_data_out proc near
pushf ; save current interrupt status
cli ; disable interrupts
push bx ;
push ax ;
mov bl,al ; (bl) msb has NMI on/off status
or al,10000000b ; make NMI off
call smi_cmos_data_out_x ; write the data
jmp short smi_cmos_data_inout_00 ;
smi_cmos_data_out endp
;---------------------------------------------------------------;
;*****************************************************************;
;*****************************************************************;
;** **;
;** (C)Copyright 1985-1996, American Megatrends Inc. **;
;** **;
;** All Rights Reserved. **;
;** **;
;** 6145-F, Northbelt Parkway, Norcross, **;
;** **;
;** Georgia - 30071, USA. Phone-(770)-246-8600. **;
;** **;
;*****************************************************************;
;*****************************************************************;
;---------------------------------------------------------------;
; READ_8259_IRR_REG ;
;---------------------------------------------------------------;
; Input : (AH) IRR bit(s) to be checked ;
; (DX) 8259 master/slave control reg i/o port ;
; STACK PRESENT ;
; Output: (ZF) 01 (ZR) if input IRR bit(s) are clear ;
; (ZF) 00 (NZ) if any of the IRR bit(s) are set ;
; (CY) 00 (NC) ;
; (AL) IRR read value ;
; Register destroyed : (AL) ;
; ;
; This subroutine is called to read the interrupt request reg of;
; the specified 8259 control register, and test to see if the ;
; specified interrupt request bit(s) are set. ;
;---------------------------------------------------------------;
read_8259_irr_reg proc near
pushf ; save current interrupt status
cli ; disable interrupts
mov al, irr_reg_read_cmd ;
out dx, al ; send IRR read command to 8259
smi_io_delay ; i/o delay
in al, dx ; (al) = read current IRR status
popf ; restore original interrupt status
test al, ah ; check for proper IRQ set
; (CF) cleared
ret
read_8259_irr_reg endp
;---------------------------------------------------------------;
; SAVE_AND_MASK_INTR ;
;---------------------------------------------------------------;
; Input : (DS) PM BIOS data segment ;
; Output: NONE ;
; Register destroyed : NONE ;
; ;
; This hook is called whenever the system wants to save the ;
; master and slave interrupt controller masks, and mask all ;
; hardware interrupts. System finally will be in CLI mode ;
;---------------------------------------------------------------;
save_and_mask_intr proc near
cli ; disable interrupts
push ax ;
in al,mask_8259_master ; (al) = current master mask
smi_io_delay ; i/o delay
mov ah,al ;
in al, mask_8259_slave ; (al) = current slave mask
mov ds:smi_intr_mask_save_area,ax ; save for later restore
;-----------------------------------------------;
save_and_mask_intr_10::
smi_io_delay ; i/o delay
pop ax ;
;---------------------------------------------------------------;
; MASK_ALL_8259 ;
;---------------------------------------------------------------;
; Input : (DS) PM BIOS data segment ;
; Output: NONE ;
; Register destroyed : NONE ;
; ;
; This hook is called whenever the system wants to mask all ;
; hardware interrupts. System finally will be in CLI mode ;
;---------------------------------------------------------------;
mask_all_8259 proc near
cli ; disable interrupts
push ax ;
mov al,0ffh ; mask all interrupt levels
out mask_8259_master,al ; mask all master interrupt levels
smi_io_delay ; i/o delay
out mask_8259_slave,al ; mask all slave interrupt levels
pop ax ;
ret
mask_all_8259 endp
save_and_mask_intr endp
;---------------------------------------------------------------;
; RESTORE_AND_UNMASK_INTR ;
;---------------------------------------------------------------;
; Input : (DS) PM BIOS data segment ;
; Output: NONE ;
; Register destroyed : NONE ;
; ;
; This hook is called whenever the system wants to restore the ;
; master and slave interrupt controller masks. System is placed ;
; in CLI mode. ;
;---------------------------------------------------------------;
restore_and_unmask_intr proc near
cli ; disable interrupts
push ax ;
mov ax,ds:smi_intr_mask_save_area ; (ax) = saved mask for master & slave
;-----------------------------------------------;
restore_and_unmask_intr_10::
out mask_8259_slave,al ; restore slave mask
smi_io_delay ; i/o delay
mov al,ah ;
out mask_8259_master,al ; restore master mask
pop ax ;
ret
restore_and_unmask_intr endp
;---------------------------------------------------------------;
IF IRQ_HANDLING_SUPPORT
;---------------------------------------------------------------;
; IRQ_APM_SAVE_AND_MASK_INTR ;
;---------------------------------------------------------------;
; Input : (DS) PM BIOS data segment ;
; Output: NONE ;
; Register destroyed : NONE ;
; ;
; This hook is called whenever the system wants to save the ;
; master and slave interrupt controller masks, and mask all ;
; hardware interrupts. System finally will be in CLI mode ;
;---------------------------------------------------------------;
irq_apm_save_and_mask_intr proc near
cli ; disable interrupts
push ax ;
in al,mask_8259_master ; (al) = current master mask
smi_io_delay ; i/o delay
mov ah,al ;
in al, mask_8259_slave ; (al) = current slave mask
mov ds:irq_apm_intr_mask_save_area,ax; save for later restore
jmp short save_and_mask_intr_10 ;
irq_apm_save_and_mask_intr endp
;---------------------------------------------------------------;
; IRQ_APM_RESTORE_AND_UNMASK_INTR ;
;---------------------------------------------------------------;
; Input : (DS) PM BIOS data segment ;
; Output: NONE ;
; Register destroyed : NONE ;
; ;
; This hook is called whenever the system wants to restore the ;
; master and slave interrupt controller masks. System is placed ;
; in CLI mode. ;
;---------------------------------------------------------------;
irq_apm_restore_and_unmask_intr proc near
cli ; disable interrupts
push ax ;
mov ax,ds:irq_apm_intr_mask_save_area; (ax) = saved mask for master & slave
jmp short restore_and_unmask_intr_10;
irq_apm_restore_and_unmask_intr endp
;---------------------------------------------------------------;
ENDIF
;---------------------------------------------------------------;
; ENQUIRE_INTR_PENDING_SYSTEM ;
;---------------------------------------------------------------;
; Input : NONE ;
; Output: (ZF) set means no interrupt pending. ;
; (ZF) clear means interrupt pending & ;
; (AL) has master pending interrupts info ;
; (AH) has slave pending interrupts info ;
; Register destroyed : (AX),(DX) ;
;---------------------------------------------------------------;
enquire_intr_pending_system proc near
mov dx,control_8259_slave ;
call read_8259_irr_reg ; (al) = interrupt pending status for slave
mov ah,al ; (ah) = interrupt pending status for slave
mov dx,control_8259_master ;
call read_8259_irr_reg ; (al) = interrupt pending status for master
mov dx,ax ; (dl) = (al) = interrupt pending status for master
; (dh) = (ah) = interrupt pending status for slave
or dl,dh ; set/clear (ZF)
ret
enquire_intr_pending_system endp
;---------------------------------------------------------------;
;*****************************************************************;
;*****************************************************************;
;** **;
;** (C)Copyright 1985-1996, American Megatrends Inc. **;
;** **;
;** All Rights Reserved. **;
;** **;
;** 6145-F, Northbelt Parkway, Norcross, **;
;** **;
;** Georgia - 30071, USA. Phone-(770)-246-8600. **;
;** **;
;*****************************************************************;
;*****************************************************************;
;---------------------------------------------------------------;
; DISABLE_VIDEO_DISPLAY_3C0 ;
;---------------------------------------------------------------;
; Input : NONE ;
; Output: NONE ;
; Register destroyed : NONE ;
;---------------------------------------------------------------;
disable_video_display_3c0 proc near
push ax ;
mov ah,00000000b ; screen off
jmp short enable_display_3c0_00 ;
disable_video_display_3c0 endp
;---------------------------------------------------------------;
; ENABLE_VIDEO_DISPLAY_3C0 ;
;---------------------------------------------------------------;
; Input : NONE ;
; Output: NONE ;
; Register destroyed : NONE ;
;---------------------------------------------------------------;
enable_video_display_3c0 proc near
push ax ;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -