Z80 Assembly 78: Software Floating Point Division
The Complexity of Division While multiplication (Part 16) is complex, floating-point division is arguably the most difficult operation to implement in Z80 assembly. It combines the complexity of multi-byte arithmetic with the iterative processes of long division, applied across three components: Sign, Exponent, and Mantissa. The Formula (Conceptual): $$\text{Result}_{\text{Sign}} = \text{Operand}_A.\text{Sign} \text{ XOR } \text{Operand}B.\text{Sign}$$ $$\text{Result}{\text{Exponent}} = \text{Operand}_A.\text{Exponent} - \text{Operand}B.\text{Exponent}$$ $$\text{Result}{\text{Mantissa}} = \text{Operand}_A.\text{Mantissa} / \text{Operand}_B.\text{Mantissa}$$ Step 1: Sign and Exponent Calculation The sign of the result is determined by a simple XOR operation on the two input sign bits (Part 8). ...