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

📄 extfunc.wcc

📁 <BIOS研发技术剖析>书的源代码,包括完整的BIOS汇编语言源程序.
💻 WCC
📖 第 1 页 / 共 2 页
字号:
        jbe     @f
        mov     al,bl
        or      dh,dh
        jns     @f
        mov     al,bh
@@:
        mov     dh,al

        mov     ax,dx
        call    set_cmos_buffer_item
        mov     bx,offset _temp_buffer
        cmp     ax,Q_RESUME_BY_RTC_DATE
        jnz     everyday_done
        mov     si,offset cgroup:everyday
        mov     cx,5
        mov     di,bx
        db      02eh
        rep     movsw
        jmp     short skip_number

everyday_done:
        xchg    al,ah
        aam
        or      ax,3030h
        xchg    al,ah
        mov     ds:[bx],ax
skip_number:
        mov     al,Q_RESUME_BY_RTC
        call    get_cmos_buffer_item
        xor     al,01
        mov     ah,al
        mov     dx,ds
        pop     es
        ret
show_decimal    endp

clear_temp_buffer       proc    near
        push    ax
        mov     cx,05
        xor     ax,ax
        mov     di,offset _temp_buffer
        rep     stosw
        pop     ax
        ret
clear_temp_buffer       endp

conv_ax  proc    near
        mov     cx,10
lop5:   xor     dx,dx
        div     cx
        or      ax,ax
        jz      lab5
        push    dx
        call    lop5
        pop     dx
lab5:   mov     al,dl
        add     al,30h
        stosb
        ret
conv_ax  endp

sys_temp_proc   proc    far
        push    es
        push    ds
        pop     es
        call    clear_temp_buffer
        mov     ax,27h
        call    read_lm78_reg
        jnz     lm78_absent
        mov     di,offset _temp_buffer
        mov     bx,di
; Jeff, Wed 09-30-1998 >>>
        test    al,80h          ;temp(C)=(reading*140+8792)/168.7
        pushf
        jz      positive_value1
        neg     al
positive_value1:
        mov     ah,140
        mul     ah
        mov     cx,8792
        popf
        jz      positive_value2
        sub     cx,ax
        mov     ax,cx
        jmp     process_div
positive_value2:
        add     ax,cx
process_div:
        mov     cx,10
        mul     cx
        mov     cx,1687
        div     cx
; Jeff, Wed 09-30-1998 <<<
        push    ax
        call    conv_ax
        mov     eax,2f43f8h
        stosd
        dec     di
        pop     ax
        mov     ah,9
        mul     ah
        xor     dx,dx
        mov     cx,5
        div     cx
        add     ax,32
        call    conv_ax
        mov     ax,046f8h
        stosw
lm78_absent:
        mov     ah,1
        mov     dx,ds
        pop     es
        retf
sys_temp_proc   endp

cpu_fan_proc    proc    far
        mov     ax,0828h
        call    common_fan
        retf
cpu_fan_proc    endp

sys_fan_proc    proc    far
        mov     ax,0429h
        call    common_fan
        retf
sys_fan_proc    endp

common_fan      proc    near
        push    es
        push    ds
        pop     es
        call    clear_temp_buffer
        call    read_lm78_reg
        jnz     fan_lm78_absent
        mov     bx,ax
        cmp     al, 0feh                               ; Check if FAN take out!
        mov     ax,0
        jae     short no_cpu_fan
        mov     ax,bx
        mul     ah
        mov     bx,ax
        cmp     bx,15h
        jb      short no_cpu_fan
        mov     dx,14h
        mov     ax,05265h
        div     bx
no_cpu_fan:
        mov     di,offset _temp_buffer
        mov     bx,di
        call    conv_ax
        mov     eax,'MPR '
        stosd
fan_lm78_absent:
        mov     ah,1
        mov     dx,ds
        pop     es
        ret
common_fan      endp

in0_proc        proc    far
        mov     al,020h
        mov     bx,595
        call    common_in
        retf
in0_proc        endp

in1_proc        proc    far
        mov     al,021h
        mov     bx,1000
        call    common_in
        retf
in1_proc        endp

in2_proc        proc    far
        mov     al,022h
        mov     bx,1000
        call    common_in
        retf
in2_proc        endp

in3_proc        proc    far
        mov     al,023h
        mov     bx,1000
        call    common_in
        retf
in3_proc        endp

common_in       proc    near
        push    es
        push    ds
        pop     es
        call    clear_temp_buffer
        mov     ah,al
        push    bx
        call    read_lm78_reg
        pop     bx
        jnz     in_lm78_absent
        mov     di,offset _temp_buffer
        cmp     ah,25h
        jb      @f
        push    ax
        mov     al,'-'
        stosb
        pop     ax
@@:
        mov     ah,10h
        mul     ah
        xor     dx,dx
        div     bx
        push    dx
        call    conv_ax
        mov     al,'.'
        stosb
        pop     ax
        xor     dx,dx
        mov     si,1000
        mul     si
        div     bx
        mov     dx,ax
        cmp     ax,100
        ja      @f
        mov     al,'0'
        stosb
        cmp     dx,10
        ja      @f
        stosb
@@:
        mov     ax,dx
        call    conv_ax
        mov     ax,'V '
        stosw
in_lm78_absent:
        mov     bx,offset _temp_buffer
        mov     ah,1
        mov     dx,ds
        pop     es
        ret
common_in       endp

read_lm78_reg   proc    near
        push    dx
        mov     dx,cs
        cmp     dx,0f000h
        jnz     not_in_bios
        mov     dx,295h
        out     dx,al
        mov     ch,80h
        loop    $
        inc     dx
        in      al,dx
        mov     ch,80h
        loop    $
        cmp     al,al
not_in_bios:
        mov     bx,offset _temp_buffer
        pop     dx
        ret
read_lm78_reg   endp

;-----------------------------------------------------------------------;
;*****************************************************************;
;*****************************************************************;
;**                                                             **;
;**     (C)Copyright 1985-1996, American Megatrends Inc.        **;
;**                                                             **;
;**                     All Rights Reserved.                    **;
;**                                                             **;
;**             6145-F, Northbelt Parkway, Norcross,            **;
;**                                                             **;
;**             Georgia - 30071, USA. Phone-(770)-246-8600.     **;
;**                                                             **;
;*****************************************************************;
;*****************************************************************;
; copy from IT61FFN.ASM by Vincent Chen

LptAddrStruc    label   byte
        db      STR_IT8661F_AUTO, STR_DISABLED
        db      STR_IT8661F_378, STR_IT8661F_278, STR_IT8661F_3BC, STR_END

LptEPPAddrStruc label   byte
        db      STR_IT8661F_AUTO, STR_DISABLED
        db      STR_IT8661F_378, STR_IT8661F_278, STR_END

IT8661F_Lpt_Addr_Xfn    proc    near
        mov     bx, offset cgroup:LptAddrStruc
        mov     al, Q_IT8661F_LPT_MODE
        call    get_cmos_buffer_item    ;AL = 0/1/2/3 for SPP/EPP/ECP/EPP+ECP
        cmp     al, 1
        jne     common_normal_exit
        
        mov     bx, offset cgroup:LptEPPAddrStruc
        jmp     short common_normal_exit
IT8661F_Lpt_Addr_Xfn    endp


;-----------------------------------------------------------------------;
LptEppEcpModeStruc      label   byte
        db      STR_IT8661F_NORMAL, STR_IT8661F_EPP, STR_IT8661F_ECP, STR_IT8661F_EPPECP

LptEcpModeStruc label   byte
        db      STR_IT8661F_NORMAL, STR_RESERVED, STR_IT8661F_ECP, STR_END
                
IT8661F_Lpt_Mode_Xfn    proc    near
        mov     al, Q_IT8661F_LPT_PORT
        call    get_cmos_buffer_item    ;AL=0/1/2/3/4 for Auto/Disable/378/278/3BC
        dec     al
        jz      common_shaded_NA_exit   ;BR if disabled
        
        mov     bx, offset cgroup:LptEcpModeStruc
        cmp     al, 3                   ;Check for 3BC
        je      common_normal_exit
        
        mov     bx, offset cgroup:LptEppEcpModeStruc
        jmp     short common_normal_exit
IT8661F_Lpt_Mode_Xfn    endp


;-----------------------------------------------------------------------;
LptDmaStruc     label   byte
        db      STR_IT8661F_0, STR_IT8661F_1, STR_RESERVED, STR_IT8661F_3

IT8661F_Lpt_Dma_Xfn     proc    near
        mov     al, Q_IT8661F_LPT_PORT
        call    get_cmos_buffer_item    ;AL=0/1/2/3/4 for Auto/Disable/378/278/3BC
        mov     bl, al
        dec     al
        jz      common_shaded_NA_exit   ;BR if disabled
        
        mov     al, Q_IT8661F_LPT_MODE
        call    get_cmos_buffer_item    ;AL = 0/1/2/3 for SPP/EPP/ECP/EPP+ECP
        cmp     al, 2
        jb      common_shaded_NA_exit   ;BR if not in ECP mode
        
        dec     bl                      ;BL = -1/0/1/2/3 for
                                        ;     Auto/Disable/378/278/3BC
        jns     @F                      ;BR if not in Auto
        mov     bh, STR_IT8661F_AUTO
        jmp     short common_shaded_exit;BR if in Auto mode
@@:
        mov     bx, offset cgroup:LptDmaStruc
        jmp     short common_normal_exit
IT8661F_Lpt_Dma_Xfn     endp


;-----------------------------------------------------------------------;
LptIrqStruc     label   byte
        db      STR_IT8661F_5, STR_IT8661F_7

IT8661F_Lpt_Irq_Xfn     proc    near
        mov     al, Q_IT8661F_LPT_PORT
        call    get_cmos_buffer_item    ;AL=0/1/2/3/4 for Auto/Disable/378/278/3BC
        dec     al
        jz      common_shaded_NA_exit   ;BR if disabled
        jns     @F                      ;BR if not in Auto
        
        mov     bh, STR_IT8661F_AUTO
        jmp     short common_shaded_exit;BR if in Auto mode
@@:
        mov     bx, offset cgroup:LptIrqStruc
        jmp     short common_normal_exit
IT8661F_Lpt_Irq_Xfn     endp


;-----------------------------------------------------------------------;
common_normal_exit:
        mov     dx, cs                  ;DX:BX -> option Z-structure
        mov     ah, 2                   ;Show structure as normal
                                        ;Composite function
        retf

common_shaded_NA_exit:
        mov     bh, STR_IT8661F_NA
        
common_shaded_exit:
        mov     bl, 2                   ;BL = String Set#, BH = string#
        call    get_setup_$_ptr         ;Get string offset
        mov     bx, ax                  ;DX:BX -> ASCII Z-String for option
        mov     ah, 1                   ;Structure to be shown shadowed
        retf
        

;-----------------------------------------------------------------------;
IrIrqStruc      label   byte
        db      STR_RESERVED, STR_RESERVED, STR_RESERVED        ;IRQ 0,1,2
        db      STR_IT8661F_3, STR_IT8661F_4, STR_IT8661F_5
        db      STR_RESERVED, STR_RESERVED, STR_RESERVED        ;IRQ 6,7,8
        db      STR_IT8661F_9, STR_IT8661F_10, STR_IT8661F_11, STR_IT8661F_12
        db      STR_END ;IRQ 13,14,15

IT8661F_Ir_Irq_Xfn      proc    near
        mov     al, Q_IT8661F_IR_PORT
        call    get_cmos_buffer_item    ;AL = 0/1/2/3/4/5 for
                                        ;     Auto/Disable/3F8/2F8/3E8/2E8
        dec     al
        jz      common_shaded_NA_exit   ;BR if disabled
        jns     @F                      ;BR if not in Auto
        mov     bh, STR_IT8661F_AUTO
        jmp     short common_shaded_exit;BR if in Auto mode
@@:
        mov     bx, offset cgroup:IrIrqStruc
        jmp     short common_normal_exit
IT8661F_Ir_Irq_Xfn      endp

; upper copy from IT61FFN.asm by Vincent Chen
;
;-----------------------------------------------------------------------;
if (MKF_EVENT_LOG)                      ; (CORE0218+)>
        include eventfun.inc
endif                                   ; <(CORE0218+)

        public  _EXTFUNC_ENDS
_EXTFUNC_ENDS   label   byte                    ; marks end of module
;---------------------------------------;
_text   ends
        end

⌨️ 快捷键说明

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