THis is supposed to be simple I know, but I have even tried
copying an example line for line and I keep getting divide overflow.
I probably am not understanding something about addresses
or something.... here is my program:
bits 16
org 0x100
jmp main
outputbuf: db ' ','$'
;------------------------
main: mov ax,60h ; the numer 6 that i want to display
mov di,outputbuf
add di,4 ; point to end of outputbuf
mov bx,10 ; divide by 10
loop1: idiv bx ; divide DX:AX by BX
; result in AX, rem in DX
add dx,30h ; convert rem to ASCII
mov [di],dl ; move digit to out string
cmp ax,0
je finis
dec di
xor dx,dx
jmp loop1
finis:
mov dx,outputbuf
mov ah,09h
int 21h
int 20h
ANY ADVICE greatly appreciated
THanks!
copying an example line for line and I keep getting divide overflow.
I probably am not understanding something about addresses
or something.... here is my program:
bits 16
org 0x100
jmp main
outputbuf: db ' ','$'
;------------------------
main: mov ax,60h ; the numer 6 that i want to display
mov di,outputbuf
add di,4 ; point to end of outputbuf
mov bx,10 ; divide by 10
loop1: idiv bx ; divide DX:AX by BX
; result in AX, rem in DX
add dx,30h ; convert rem to ASCII
mov [di],dl ; move digit to out string
cmp ax,0
je finis
dec di
xor dx,dx
jmp loop1
finis:
mov dx,outputbuf
mov ah,09h
int 21h
int 20h
ANY ADVICE greatly appreciated
THanks!