Division.
Clarify the terms Divisor, Dividend, Quotient and Remainder:
Like I explained in multiplication, division is nothing but repeated subtraction. However, the programming is handled differently. In multiplication, the loop continued n number of times (for multiplication m x n). This was done by decrementing the register holding the value n and a condition when it would become zero. (JNZ).
In division however, we need to count the number of possible subtractions/deductions that can take place and therefore we increment a register to record the quotient. And this should be in an unconditional loop(JMP), broken only when the divisor is smaller than the divident. We'll use the accumulator as the dividend which will later hold the remainder once the loop is over.
We need 3 registers in this case.
A for storing the divident, which later holds the remainder.
B for storing the divisor
C for storing the quotient
PROGRAM:
