将16进制化为10进制数显示输出的方法
= 问题 =
请问如何把16进制数转化为10进制数显示输出?谢谢!
--------------------------------------------------------------------------------
16进制数在内存INPUT处,使用大写字母,结果在OUTPUT中
最大为双字
大致如下:
inputdb"23AF",0
w1dw1
w2dw0
outputdb20dup(0)
xorax,ax
movsi,offsetinput
callh_to_b
movdi,offsetoutput
movcx,10
callb_to_d
xorax,ax
stosb
h_to_b:
lodsb
pushax
orax,ax
jzb03
callh_to_b
popcx
cmpcl,"9"
jab01
subcx,"0"
jmpb02
b01:subcx,"A"
b02:movax,w2
mulcx
movw2,ax
movax,w1
mulcx
movw1,ax
addw2,dx
b03:ret
b_to_d:
movax,w2
xordx,dx
divcx
movw2,dx
movdx,ax
movax,w1
divcx
movw1,ax
orax,dx
jzw11
pushdx
callb_to_d
popax
addax,030h
stosb
w11:
ret
本文地址:http://www.45fan.com/a/question/72778.html