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

📄 spd.asm

📁 bios开发培训涉及例子。可以给大家参考。请在dos下运行。用masm6.0编译。
💻 ASM
📖 第 1 页 / 共 2 页
字号:
@@:             mov     dec_flag,1
                add     al,30h
                mov     dl,al
                mov     ah,2
                int     21h             ;show x00
to_ff:          mov     al,dh
                mov     ah,0
                mov     cl,10
                div     cl
                mov     dh,ah
                cmp     al,0
                jne     @f
                cmp     dec_flag,0
                je      to_fff
@@:             mov     dec_flag,1
                add     al,30h
                mov     dl,al
                mov     ah,2
                int     21h             ;show x0
to_fff:         mov     al,dh
                add     al,30h
                mov     dl,al
                mov     ah,2
                int     21h             ;show  x
                
                mov     dec_flag,0 
                pop     dx
                pop     cx
                ret
show_ax_dec     endp

cal_rank        proc            ; input al
                and     al,07h
                cmp     al,0
                je      single_rank
                inc     al
                mov     rankvalue,al
                call    show_al
                printstr        rank2
                jmp     end6
single_rank:    mov     rankvalue,1
                printstr        rank1

end6:           ret

cal_rank        endp

cal_ddrsize     proc                    ;output :ax
                push    si
                push    cx
                
                lea     si,spd_data
                mov     al,[si+3]
                add     al,[si+4]
                add     al,3
                sub     al,20
                mov     cl,al
                mov     size1,1
                shl     size1,cl
                mov     al,[si+17]
                mov     ah,0
                mov     cl,rankvalue
                mul     cl
                mov     cl,al                
                mov     ax,size1
                mov     ch,0
                mul     cx              
                
                pop     cx
                pop     si
                ret
cal_ddrsize     endp



cal_tRAS        proc                    ;output: ax
                push    dx
                push    si                
                
                lea     si,spd_data
                mov     dx,0
                mov     al,[si+30]
                mov     ah,0
                mov     cx,100
                mul     cx
                mov     cx,fvalue
                div     cx
                cmp     dx,0
                je      @f
                inc     ax

@@:             pop     si
                pop     dx
                ret
cal_tRAS        endp        

cal_tcl         proc    far                            ;
                mov     al,[si+18]
@@:             test    al,tcl_f
                jnz     @f
                shr     tcl_f,1
                dec     tcl_v
                jmp     @b
                ret                
@@:             
                ret                
cal_tcl         endp

cal_tRCD        proc                    ;output:ax
                push    di
                push    bx
                push    cx
                
                lea     si,spd_data
                lea     di,tablec
                mov     al,[si+29]
                mov     bl,al
                and     al,0fch
                shr     al,2
                mov     ah,0
                mov     cx,100
                mul     cx
                mov     al,bl
                and     al,03h
                mov     bl,al
                mov     bh,0
                mov     bx,[di+bx]
                add     ax,bx
                jnc      @f
                inc     dx
@@:             mov     cx,fvalue
                div     cx
                cmp     dx,0
                je      @f
                inc     ax
@@:             pop     cx
                pop     bx
                pop     di
                ret

cal_tRCD        endp

cal_tRP        proc
                push    di
                push    bx
                push    cx
                
                lea     si,spd_data
                lea     di,tablec
                mov     al,[si+27]
                mov     bl,al
                and     al,0fch
                shr     al,2
                mov     ah,0
                mov     cx,100
                mul     cx
                mov     al,bl
                and     al,03h
                mov     bl,al
                mov     bh,0
                mov     bx,[di+bx]
                add     ax,bx
                jnc      @f
                inc     dx
@@:             mov     cx,fvalue
                div     cx
                cmp     dx,0
                je      @f
                inc     ax
@@:             pop     cx
                pop     bx
                pop     di
                ret

cal_tRP        endp        

cal_BL        proc
                lea     si,spd_data
                mov     al,[si+16]
                test    al,bit3
                jnz      bl_8
                mov     al,4
                jmp     end5
bl_8:           mov     al,8
end5:                ret
cal_BL        endp        
	

read_spd    proc    far     public
                
                push    cx
                mov     dx,smb_base
                mov     al,01eh
                out     dx,al
                mov     cx,count1
@@:             in      al,dx
                test    al,bit0
                jnz     @b                     
                add     dx,03           ;index
                mov     al,spd_index
                out     dx,al
                inc     dx              ;address
                mov     al,spd_addr
                out     dx,al
                mov     dx,smb_base+02h ;command
                mov     al,48h
                out     dx,al
                
                mov     cx,count1
                mov     dx,smb_base
@@:             in      al,dx
                test    al,bit0         ;busy?
                jnz     @b
@@:             in      al,dx
                test    al,bit1
                jz      @b              ;intr?
                in      al,dx
                test    al,bit2+bit3+bit4
                jnz     failed1                
                mov     dx,smb_base+05h
                in      al,dx
                pop     cx
                jmp     @f
                
failed1:        printstr        enters
                printstr        error1
                jmp     $

@@:	        ret
read_spd    endp	



write_spd    proc    far     public
                
                push    cx
                push    ax
                mov     dx,smb_base
                mov     al,01eh
                out     dx,al
                mov     cx,count1
@@:             in      al,dx
                test    al,bit0
                jnz     @b                     
                add     dx,03           ;index
                mov     al,spd_index
                out     dx,al
                inc     dx              ;address
                mov     al,spd_addr
                out     dx,al
                mov     dx,smb_base+02h ;command
                mov     al,48h
                out     dx,al
                                
                mov     cx,count1
                mov     dx,smb_base
@@:             in      al,dx
                test    al,bit0
                jnz     @b
@@:             in      al,dx
                test    al,bit1
                jz      @b
                in      al,dx
                test    al,bit2+bit3+bit4
                jnz     failed2                
                mov     dx,smb_base+05h
                pop     ax
                out     dx,al
                pop     cx
                jmp     @f
                
failed2:        printstr        enters
                printstr        error1
                jmp     $

@@:	        ret
write_spd    endp	

	
show_al         proc    far     public

                push    ax
                push    dx
                mov     dh,al
                and     al,0f0h
                shr     al,4
                add     al,30h
                cmp     al,3ah
                jb      doing
                add     al,7
doing:          mov     dl,al
                mov     ah,2
                int     21h                                   
	
	        mov     al,dh
                and     al,0fh
                add     al,30h
                cmp     al,3ah
                jb      doing1
                add     al,7
doing1:         mov     dl,al
                mov     ah,2
                int     21h  	
                pop     dx
                pop     ax
                ret
show_al		endp

              
                
end
	

⌨️ 快捷键说明

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