Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>As already stated <code>DIV</code> performs an integer division. Since it is an integer division, the resulting quotient and remainder are available in separate register pairs, the exact registers depends on the size of the divisor.</p> <p><strong>1 Byte Divisor</strong></p> <pre><code>AX - Dividend AH - Remainder AL - Quotient </code></pre> <p><strong>2 Byte Divisor</strong></p> <pre><code>DX:AX - Dividend DX - Remainder AX - Quotient </code></pre> <p><strong>4 Byte Divisor</strong></p> <pre><code>EDX:EAX - Dividend EDX - Remainder EAX - Quotient </code></pre> <p>Since you are using a 1 byte divisor 'BL' the remainder will be in the AH register. In your case of <code>32/5</code> the <code>AL</code> register will contain the value <code>6</code> and the <code>AH</code> register the value <code>2</code> which means there is a remainder of <code>2/5</code> which is <code>0.4</code> giving you your answer of <code>6.4</code>.</p> <p>If you decide you use FPU operations you will need to load the two values <code>32</code> and <code>5</code> onto the FPU stack using the <code>FLD</code> instruction, once for each value, after which you call <code>FDIV</code> which will pop the two values off the FPU stack, divide them and push the result onto the FPU stack. </p> <p>The result can then be move off the stack to a memory address using the <code>FSTP</code> instruction. Once you have the result you will need to convert that from the binary IEEE floating-point representation to a string representation which can be displayed on the screen.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload