How it works...
Let's assign the two numbers to be divided to the two variables var1 and var2. Assign the dividend to var1 and the divisor to var2. Thereafter, we will load the dividend from the var1 variable into the eax register and the divisor from the var2 variable into the ebx register.
The edx register has to be initialized to zero. To do this, we will initialize a var3 variable to zero. From var3, the zero value is loaded into the edx register. Then, we will execute the divl assembly statement to divide the content of the eax register by the content of the ebx register. By doing this division, the quotient will be assigned to any available register and the remainder will be assigned to the ebx register.
The quotient from the available ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access