在 8086(tasm) 中,我试图将数字打印到屏幕上。下面的代码适用于大多数数字,但对 15876 无效。我的问题是如何反复划分 16876 并获取其数字作为提醒?还是有更好的打印 15876?
谢谢你。
lea si,answerst ;holds output
add si,5 ;max length of ans
;add a $ at the end
mov bh,24h
mov [si],bh
dec si ;decrements si
mov bx,15876 ;the number to print
mov ax,bx ;put it in ax because div uses ax
mov cx,10 ;10 is the dividend
spctostring:
cmp al,0 ;if the quotient is zero you have reached the end of the num
je stringme ;if you have reached the end of the num print it out
div cl ;divide by 10
mov bh,ah ;put the reminder in bh
mov ah,0 ;resets ah
add bh,30h ;add 30 hex to get ascii value
mov [si],bh ;place the char in the output string
dec si ;decrements si
jmp spctostring
stringme:
;---------------Output-------------------
mov ah,09h ;print string cmd
lea dx,numone ;string to print
int 21h ;print interrupt