Sorry for all the assembly! I already hate coding in it.
When I go to divide, it gives me some out of this world answers. This works:
1 2 3 4
|
mov ax, 11
mov bl, 37
div bl
mov [bAns16], ah
|
And will give me the correct remainder of 11. But as soon as I switch those numbers to variables, the whole thing breaks:
1 2 3 4 5 6 7 8
|
mov ax, [bNum1]
mov bl, [bNum4]
div bl
mov [bAns16], ah
;bNum1 = 11
;bNum4 = 37
|
The answer should be 0 with a remainder of 11. But the answer ends up 104 and with a remainder of 3 somehow.
Moreover, I'm having issues with using imul - makes no sense at all. Same as with div:
1 2 3 4
|
mov ax, 33
mov bx, -17
imul ax, bx
mov [wAns15], ax
|
Will give me the correct answer, but won't as soon as I put variables in there:
1 2 3 4 5 6 7
|
mov ax, [bNum5]
mov bx, [bNum6]
imul ax, bx
mov [wAns15], ax
;bNum5 = 33
;bNum6 = -17
|
So it should equal -561, but gives me -32049 instead consistently.
What am I doing wrong? Assembly hurts me internally.