例如,我有數量6C0000h = 7077888d打印雙字數目爲10進制
除以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位寄存器
作業我想! – 2010-12-05 15:52:50