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

📄 extfunc.asm

📁 <BIOS研发技术剖析>书的源代码,包括完整的BIOS汇编语言源程序.
💻 ASM
📖 第 1 页 / 共 2 页
字号:

everyday db     "Every Day",0
;-----------------------------------------------------------------------;
rtc_resmue_date_ef      proc near
        mov     ah,Q_RESUME_BY_RTC_DATE
        mov     bx,1f00h                ; BH=High Limit/BL=Low limit
        call    show_decimal
        retf
rtc_resmue_date_ef      endp
rtc_resmue_hour_ef      proc near
        mov     ah,Q_RESUME_BY_RTC_HOUR
        mov     bx,1700h                ; BH=High Limit/BL=Low limit
        call    show_decimal
        retf
rtc_resmue_hour_ef      endp
rtc_resmue_minute_ef    proc near
        mov     ah,Q_RESUME_BY_RTC_MINUTE
        mov     bx,3B00h                ; BH=High Limit/BL=Low limit
        call    show_decimal
        retf
rtc_resmue_minute_ef    endp
rtc_resmue_second_ef    proc near
        mov     ah,Q_RESUME_BY_RTC_SECOND
        mov     bx,3B00h                ; BH=High Limit/BL=Low limit
        call    show_decimal
        retf
rtc_resmue_second_ef    endp
        public  show_decimal
show_decimal    proc    near
        push    es
        push    ds
        pop     es

        call    clear_temp_buffer

        xchg    al,ah                   ; AH=+/-1 AL=Question
        push    ax
        call    get_cmos_buffer_item
        pop     dx
        add     al,dh

        cmp     al,bl
        jae     @f
        mov     al,bh
@@:     cmp     al,bh
        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.     **;
;**                                                             **;
;*****************************************************************;
;*****************************************************************;
;-----------------------------------------------------------------------;
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 + -