;把AX中的16进制数转换为ASCII码,放入MEM数组中的四个字节中。 ;当(AX)=2A49H时,程序执行完后,MEM中的4个字节内容为39H, ;34H,41H,32H。 data segment org 1000h buf dw 2A49H mem db 4 dup(?) data ends stack segment stack db 100 dup(?) stack ends code segment assume cs:code,ds:data start: mov ax,data mov ds,ax mov ax,buf lea si,mem mov bl,al and al,0fh call z1 mov al,bl mov cl,4 shr al,cl inc si call z1 mov bh,ah and ah,0fh mov al,ah inc si call z1 mov ah,bh shr ah,cl mov al,ah inc si call z1 mov ah,4ch int 21h z1 proc push ax push bx push cx push dx cmp al,9 jbe j1 add al,7 j1: add al,30h mov [si],al pop dx pop cx pop bx pop ax ret z1 endp code ends end start