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

📄 test1.asm

📁 bios开发培训涉及例子。可以给大家参考。请在dos下运行。用masm6.0编译。
💻 ASM
字号:
.model small
.586
.stack  100
.stack
.data
                dec_flag        db      0
                test1           db      0fh,00h,01h,02h

.code

.startup	
 
                mov     eax,1234h
                call    show_eax
                call    show_eax
	
.exit



show_eax_asc    proc

                push    dx
                push    eax
                mov     dh,ah
                mov     dl,al
                mov     ah,2
                int     21h             ;show al
                mov     dl,dh
                int     21h             ;show ah
                pop     eax
                shr     eax,16
                mov     dh,ah
                mov     dl,al                
                mov     ah,2
                int     21h             ;high 
                mov     dl,dh
                int     21h             ;high 
                pop     dx
                ret
show_eax_asc    endp

showinfo	proc	far		;;;input:cx:ax  ,  output:ax

		push	ax
		push	cx
		and	al,0fh
		shl	ah,4
		or	al,ah
		and	cl,0fh
		shl	ch,4
		or	cl,ch
		mov	ah,cl
                push    ax
                mov     al,ah
                call    show_al
                pop     ax
                call    show_al
                
                pop     cx
                pop     cx
                

		ret
showinfo	endp

show_ax_dec     proc                    ;show ax in dec
                push    cx
                push    dx
                
                mov     dx,0
                mov     cx,1000
                div     cx

                push    dx                
                cmp     ax,0
                je      @f
                mov     dec_flag,1
                add     al,30h
                mov     dl,al
                mov     ah,2
                int     21h             ;show x000
@@:             pop     dx
                mov     ax,dx
                mov     cl,100
                div     cl
                mov     dh,ah
                cmp     al,0
                jne     @f
                cmp     dec_flag,0
                je      to_ff
@@:             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



show_ax         proc 
                push    ax
                mov     al,ah
                call    show_al
                pop     ax
                call    show_al
                ret
show_ax         endp   

show_eax        proc
                push    eax
                shr     eax,16
                call    show_ax
                pop     eax
                call    show_ax
                ret
show_eax        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 + -