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

📄 npostdim.asm

📁 <BIOS研发技术剖析>书的源代码,包括完整的BIOS汇编语言源程序.
💻 ASM
📖 第 1 页 / 共 5 页
字号:
; Output: EBX bit11-9 = init info                                              ;
;                       00/01/02/03 => 386/486/586/686                         ;
; Destroys: ALL registers                                                      ;
;------------------------------------------------------------------------------;
        public  get_processor_info_far
get_processor_info_far  proc    near
        db      9ah                     ; CALL FAR F000:EEC6
        dw      0eec6h
        dw      0f000h
        ret
get_processor_info_far  endp
~
;==============================================================================;
;                                                                              ;
;                      ISA Device Initializer Hooks                            ;
;                                                                              ;
;==============================================================================;

ifdef ISA

;---------------------------------------;
; dih_isa_func_0 (Reset,Detect,Disable) ;
;---------------------------------------;--------------------------------------;
; This function is called by the ISA Initializer (DI-ISA.ASM)                  ;
; during function 0 (Reset, Detect, and Disable).                              ;
;                                                                              ;
; Input: SI = Offset of the NVRam workspace (in _dimdata seg)                  ;
;        DS = ES = _dimdata Segment                                            ;
;                                                                              ;
; Output: CF = Set if error, cleared otherwise                                 ;
;                                                                              ;
; Preserves: DS, ES, BP (all other registers are destroyed)                    ;
;------------------------------------------------------------------------------;
dih_isa_func_0  proc near
        clc
        ret
dih_isa_func_0  endp


;---------------------------------------;
; dih_isa_func_1 (Static Device Init)   ;
;---------------------------------------;--------------------------------------;
; This function is called by the ISA Initializer (DI-ISA.ASM)                  ;
; during function 1 (Static Device Init).                                      ;
;                                                                              ;
; Input: SI = Offset of the NVRam workspace (in _dimdata seg)                  ;
;        DS = ES = _dimdata Segment                                            ;
;                                                                              ;
; Output: CF = Set if error, cleared otherwise                                 ;
;                                                                              ;
; Preserves: DS, ES, BP (all other registers are destroyed)                    ;
;------------------------------------------------------------------------------;
dih_isa_func_1  proc near
        mov     al,Q_CLEAR_NVRAM
        call    check_cmos_data_far
        jz      no_reset_nvram
        or      SysStatus, STAT_SYS_NVRAM_CKSUM
no_reset_nvram:
        clc
        ret
dih_isa_func_1  endp


;---------------------------------------;
; dih_isa_func_2 (Output Device Init)   ;
;---------------------------------------;--------------------------------------;
; This function is called by the ISA Initializer (DI-ISA.ASM)                  ;
; during function 2 (Output Device Init).                                      ;
;                                                                              ;
; Input: SI = Offset of the NVRam workspace (in _dimdata seg)                  ;
;        DS = ES = _dimdata Segment                                            ;
;                                                                              ;
; Output: CF = Cleared if boot output device was found, set if not found.      ;
;                                                                              ;
; Preserves: DS, ES, BP (all other registers are destroyed)                    ;
;------------------------------------------------------------------------------;
dih_isa_func_2  proc near
        stc                             ;Indicate no device found
        ret
dih_isa_func_2  endp


;---------------------------------------;
; dih_isa_func_3 (Input Device Init)    ;
;---------------------------------------;--------------------------------------;
; This function is called by the ISA Initializer (DI-ISA.ASM)                  ;
; during function 3 (Input Device Init).                                       ;
;                                                                              ;
; Input: SI = Offset of the NVRam workspace (in _dimdata seg)                  ;
;        DS = ES = _dimdata Segment                                            ;
;                                                                              ;
; Output: CF = Cleared if a boot input device was found, set if not found.     ;
;                                                                              ;
; Preserves: DS, ES, BP (all other registers are destroyed)                    ;
;------------------------------------------------------------------------------;
dih_isa_func_3  proc near
        stc                             ;Indicate no device found
        ret
dih_isa_func_3  endp


;---------------------------------------;
; dih_isa_func_4 (IPL Device Init)      ;
;---------------------------------------;--------------------------------------;
; This function is called by the ISA Initializer (DI-ISA.ASM)                  ;
; during function 4 (IPL Device Init).                                         ;
;                                                                              ;
; Input: SI = Offset of the NVRam workspace (in _dimdata seg)                  ;
;        DS = ES = _dimdata Segment                                            ;
;                                                                              ;
; Output: CF = Cleared if boot output device was found, set if not found.      ;
;                                                                              ;
; Preserves: DS, ES, BP (all other registers are destroyed)                    ;
;------------------------------------------------------------------------------;
dih_isa_func_4  proc near
        stc                             ;Indicate no device found
        ret
dih_isa_func_4  endp


;---------------------------------------;
; dih_isa_func_5 (General Device Init)  ;
;---------------------------------------;--------------------------------------;
; This function is called by the ISA Initializer (DI-ISA.ASM)                  ;
; during function 5 (General Device Init).                                     ;
;                                                                              ;
; Input: SI = Offset of the NVRam workspace (in _dimdata seg)                  ;
;        DS = ES = _dimdata Segment                                            ;
;                                                                              ;
; Output: CF = Set if error, cleared otherwise                                 ;
;                                                                              ;
; Preserves: DS, ES, BP (all other registers are destroyed)                    ;
;------------------------------------------------------------------------------;
dih_isa_func_5  proc near
        clc
        ret
dih_isa_func_5  endp


;---------------------------------------;
; dih_isa_reserve_irq_mem               ;
;---------------------------------------;--------------------------------------;
; This function allows DMAs, IRQs, a memory block to be reserved for standard  ;
; ISA cards.  If this function is used, setup should contain some questions    ;
; such as:  IRQ  9 used by ISA: Yes/No                                         ;
;           IRQ 10 used by ISA: Yes/No                                         ;
;           IRQ 11 used by ISA: Yes/No                                         ;
;           ...                 ...                                            ;
;           ISA memory block base address: Disabled/C800/CC00/.../DC00         ;
;           ISA memory block size: 8k/16k/32k/64k                              ;
; These setup questions are very useful for users who are mixing ISA, PCI, and ;
; Plug-and-Play ISA cards in the same system and do not want to run the ICU.   ;
; These questions are MANDATORY for systems that have no NVRam and therefore   ;
; cannot run the ICU.  Any IRQs and/or memory block returned by this function  ;
; will not be allocated to any PCI or PnP ISA device.                          ;
;                                                                              ;
; Input: Nothing                                                               ;
;                                                                              ;
; Output: AX = Bitmap of DMA channels that should be reserved for standard ISA ;
;              cards, these DMA channels will not be assigned to any PnP device;
;                 Bit   0: If set, DMA 0 is reserved for ISA cards             ;
;                 Bit   1: If set, DMA 1 is reserved for ISA cards             ;
;                 ...     ...                                                  ;
;                 Bit   6: If set, DMA 6 is reserved for ISA cards             ;
;                 Bit   7: If set, DMA 7 is reserved for ISA cards             ;
;                 Bit15-8: Not Used (initlaized to 0)                          ;
;         CX = Bitmap of IRQs that should be reserved for standard ISA cards,  ;
;              these IRQs will not be assigned to any PCI or PnP ISA device.   ;
;                 Bit  0: If set, IRQ 0 is reserved for ISA cards              ;
;                 Bit  1: If set, IRQ 1 is reserved for ISA cards              ;
;                 ...     ...                                                  ;
;                 Bit 14: If set, IRQ 14 is reserved for ISA cards             ;
;                 Bit 15: If set, IRQ 15 is reserved for ISA cards             ;
;         EBX = Absolute 32 bit base address of memory block that should be    ;
;               reserved for standard ISA cards, the memory block defined by   ;
;               EBX and EDX will not be assigned to any PCI or PnP ISA device. ;
;               For example: To reserve a 16k block of memory at D000:0 for    ;
;                            an ISA card, set EBX=0D0000h and EDX=4000h.       ;
;         EDX = Size of memory block to be reserved for ISA (see above).  Set  ;
;               to 0000h if no ISA memory block is needed.                     ;
;                                                                              ;
; Destroys: AX CX EBX EDX                                                      ;
;------------------------------------------------------------------------------;
isa_dma_table           label   byte
        db      q_dma0_used_by_isa, 0
        db      q_dma1_used_by_isa, 1
        db      q_dma3_used_by_isa, 3
        db      q_dma5_used_by_isa, 5
        db      q_dma6_used_by_isa, 6
        db      q_dma7_used_by_isa, 7
isa_dma_table_end       label   byte

isa_irq_table           label   byte
        db      q_irq3_used_by_isa, 3
        db      q_irq4_used_by_isa, 4
        db      q_irq5_used_by_isa, 5
        db      q_irq7_used_by_isa, 7
        db      q_irq9_used_by_isa, 9
        db      q_irq10_used_by_isa, 10
        db      q_irq11_used_by_isa, 11
        db      q_irq14_used_by_isa, 14
        db      q_irq15_used_by_isa, 15
isa_irq_table_end       label   byte

dih_isa_reserve_irq_mem proc near
        push    si
        mov     si,offset cgroup:isa_irq_table
        mov     cx,(offset cgroup:isa_irq_table_end-offset cgroup:isa_irq_table)/2
        xor     dx,dx
dihirim_00:
        push    cx
        lods    cgroup:byte ptr [si]    ; AL = setup structure#
        call    check_cmos_data_far
        mov     cl,al
        lodsb   cgroup:byte ptr [si]    ; AL = bit posn
        xchg    al,cl
        movzx   ax,al
        shl     ax,cl
        or      dx,ax
        pop     cx
        loop    dihirim_00
;  DX = bit map of IRQs reserved for ISA
        push    dx                      ; save DX = bit map of IRQs reserved for ISA
        mov     si,offset cgroup:isa_dma_table
        mov     cx,(offset cgroup:isa_dma_table_end-offset cgroup:isa_dma_table)/2
        xor     dx,dx
dihirim_02:
        push    cx
        lods    cgroup:byte ptr [si]    ; AL = setup structure#
        call    check_cmos_data_far
        mov     cl,al
        lodsb   cgroup:byte ptr [si]    ; AL = bit posn
        xchg    al,cl
        shl     al,cl
        or      dl,al
        pop     cx
        loop    dihirim_02
;  DL = bit map of DMAs reserved for ISA
        push    dx                      ; save DL = bit map of DMAs reserved for ISA
        xor     edx,edx                 ; ISA mem block size = 0 (disabled)
        mov     ebx,edx
        mov     al,q_mem_size_used_by_isa
        call    check_cmos_data_far
        jz      dihirim_01              ; no mem reserved by ISA
        movzx   eax,al
        add     eax,0dh
        bts     edx,eax                 ; EDX = mem size in bytes
        mov     al,q_mem_base_used_by_isa
        call    check_cmos_data_far
        movzx   ebx,al
        shl     ebx,0eh
        add     ebx,0c0000h             ; EBX = mem base used by isa
dihirim_01:
        pop     ax                      ; AL = bit map of DMAs reserved for ISA
        pop     cx                      ; CX = bit map of IRQs reserved for ISA
        pop     si
        ret
dih_isa_reserve_irq_mem endp

endif ;ISA


⌨️ 快捷键说明

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