这是宏:
macro print number
pusha
mov word ptr ax,number
xor dx,dx ;repetitions
analyse: ;pushes the digits into stack
mov cx,16 ;divisor
div cx ;divide number by 16
movsx cx,[al] ;remainder into the stack
push cx
movsx ax,[ah] ;prepare quotient for next loop
inc dx
cmp ax,0 ;break condition
jne analyse
begin1: ;print character stored in the stack
pop dx ;pop to DL
cmp dl,10d ;is DL digit or char
jb digit
ja char ;convert to ASCII
digit:
add dl,87d
char:
add dl,'0'
mov ah,2 ;print character converted to ASCII
int 21h
loop begin1
popa
endm print
我尝试使用它:
mov ax,9
print ax
我不知道如何让它发挥作用。
我不确定指令movsx ax,啊