GetLCM PROC
tryAgain:
mov bx, 0
inc Multiple
mov ax, UserInputNum1 ;Move UserInputNum1 to the 16 bit Register
mov bx, Multiple
div bx ;<-------Error here
cmp dx,0 ;If dx is not zero then there is a remainder
jne tryAgain ;If not equal jump
ret
GetLCM ENDP
I keep getting a integer overflow error when trying to div these two numbers. It breaks when i try to use div.
I am trying to find the least common multiple of two numbers entered by the user. I decided to try to divide each number to find prime numbers first then compare each time one is found to the other number the user entered. Of course I would be doing both numbers at the same time, but as of now I am trying to just get past this error.
This is only my fifth week in ASM so I am a little confuse why this is happening.
Also I would like to add that I would also like to make this work for 32bit numbers as well. My idea is to use pointers. Is this a good way to do this?
Thanks for any help!
Read up on the
divinstruction again. What is divided by what? You are missing to set one of the operands to some sensible value.