汇编语言输出ax时为什么要把值放在一个变量里才能正确输出?
如果把输出结果那行的result替换成al,result+1ah就不能正确输出,为什么?
datasegment
resultdb?,?
dataends
codesegment
assumecs:code,ds:data
mainprocfar
start:
pushds
xorax,ax
pushax
movax,data
movds,ax
L:
;初始化数据
movbh,1
movbl,1
L1:
movdl,bh
calloutput
callmulfun
movdl,bl
calloutput
calldeng
moval,bh
mulbl
aam
movresult,al
movresult+1,ah
;输出结果
movdl,result+1
calloutput
movdl,result
calloutput
callspace
incbl
cmpbl,bh
jnaL1
callretxx
movbl,1
incbh
cmpbh,9
jnaL1
ret
mainendp
;输出数
outputprocnear;输出
adddl,30h
movah,02h
int21h
ret
outputendp
;输出乘号
mulfunprocnear
pushdx
movdl,'*'
movah,02h
int21h
popdx
ret
mulfunendp
;输出等于号
dengprocnear
pushdx
movdl,'='
movah,02h
int21h
popdx
ret
dengendp
;换行
retxxprocnear
pushdx
movdl,0ah
int21h
movdl,0dh
int21h
popdx
ret
retxxendp
;输出空格
spaceprocnear
pushdx
movdl,''
movah,02h
int21h
popdx
ret
spaceendp
codeends
endstart
如果把输出结果那行的result替换成al,result+1ah就不能正确输出,为什么?
分 -->
|