我正在研究一种打印多位整数的方法,方法是反复将整数除以 10 并收集余数,然后打印它们。这是有问题的代码段:
Divide:
; initial division
mov ax, 111 ; number we want to print
mov ch, 10 ; we divide by ten to siphon digits
div ch ; divide our number by 10
; al now has 11, ah has 1
mov dh, ah ; save the remainder in dh
1 mov bx, al ; these lines refill ax with the number to
mov ax, bx ; divide
mov ch, 10 ; refill ch with the divisor
div ch ; al now has 1, ah now has 1
标有 1 的行有问题。我需要将 8 位寄存器 AL 中的值移动到 16 位寄存器 AX 中。我怎样才能在那里得到这个值以便我可以分割它?
只需清除ah
改为注册。这ax
寄存器由高位和低位部分组成 -ah:al
这同样适用于bx
(bh,bl)cx
(ch,cl) 和dx
(dh,dl) 寄存器
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)