汇编语言输出ax时为什么要把值放在一个变量里才能正确输出?
汇编语言输出ax时为什么要把值放在一个变量里才能正确输出?
如果把 输出结果 那行的 result 替换成 al, result+1 ah 就不能正确输出,为什么?
data segment
result db ?,?
data ends
code segment
assume cs:code,ds:data
main proc far
start:
push ds
xor ax,ax
push ax
mov ax,data
mov ds,ax
L:
;初始化数据
mov bh,1
mov bl,1
L1:
mov dl,bh
call output
call mulfun
mov dl,bl
call output
call deng
mov al,bh
mul bl
aam
mov result,al
mov result+1,ah
;输出结果
mov dl,result+1
call output
mov dl,result
call output
call space
inc bl
cmp bl,bh
jna L1
call retxx
mov bl,1
inc bh
cmp bh,9
jna L1
ret
main endp
;输出数
output proc near ;输出
add dl,30h
mov ah,02h
int 21h
ret
output endp
;输出乘号
mulfun proc near
push dx
mov dl,'*'
mov ah,02h
int 21h
pop dx
ret
mulfun endp
;输出等于号
deng proc near
push dx
mov dl,'='
mov ah,02h
int 21h
pop dx
ret
deng endp
;换行
retxx proc near
push dx
mov dl,0ah
int 21h
mov dl,0dh
int 21h
pop dx
ret
retxx endp
;输出空格
space proc near
push dx
mov dl,' '
mov ah,02h
int 21h
pop dx
ret
space endp
code ends
end start
如果把 输出结果 那行的 result 替换成 al, result+1 ah 就不能正确输出,为什么?