How can I divide two numbers in Assembly without using DIV instruction but by using shift and add method?
I did that with multiplication and here is my code:
mov bl, 56H ;For example
mov dl, 79H
;start
mov bh, 00H
mov dh, 00H
xor di, di
mov cx, 08H
L1:
shr dx, 1 ;shifting the multiplier
jnc nxt
add di, bx ;adding the multiplicand to the result register di
nxt:
shl bx, 1 ;shifting the multiplicand
loop L1
Secondary question: My teacher told us that there is an instruction called MOVZE to do what I did in lines 4 and 5, but it didn't work? I use emu8086 emulator.