例如我有数字 6C0000h = 7077888d
在这种情况下,将每个字除以 10,然后将余数保存在堆栈中是行不通的,因为双字的下半部分是 0000。
任何提示表示赞赏。
谢谢
例如..
;number = 6c0000h
mov ax,word ptr number
;after this mov ax is 0000
;dividing by ten will mean dx = 0 and ax = 0 and 0 is saved on the stack
mov cx,0
repeat:
mov dx,0
div ten ;ten = 10
inc cx
push dx
cmp ax,0
ja repeat
mov ax,word ptr number+2
;after this ax is 6Ch
;i think this part is alright
repeat2:
mov dx,0
div ten
inc cx
push dx
cmp ax,0
ja repeat2
display:
pop dx
add dl,'0'
mov ah,02h
int 21h
loop display
此代码显示:1080 而不是 7077888,这将是预期结果
108 = 6Ch,结尾 0 来自 0000 div 10..
注意:我必须使用 16 位寄存器