Apple II User Manual

Page of 257
FADD subroutine (address $F46E)
Purpose: To add two numbers in floating point form.
Entry: The two addends are in FP1 and FP2 respectively.  For maximum
precision, both should be normalized.
Uses: SWPALGN, ADD, NORM, RTLOG.
Exit: The normalized sum is left in FP1.  FP2 contains the addend of
greatest magnitude.  E is altered but sign is not.  The A-REG is altered
and the X-REG is cleared.  The sum mantissa is truncated to 24 bits.
Caution: Overflow may result if the sum is less that -2^128 or greater than
+2^128-1.  If so, a jump to location $3F5 is executed leaving 0 in X1, and
twice the proper sum in the mantissa M1.  The sign bit is left in the
carry, 0 for positive, 1 for negative.
      _____    __________
     |     |  |          |
FP1: |  0  |  | X.YYY... |
     |_____|  |__________|
       X1       M1
(For carry=0, true sum=+X.YYY x 2^128)
Example: Prior to calling FADD, FP1 contains +12 and FP2 contains -5.
      _____    _____    _____    _____
     |     |  |     |  |     |  |     |
FP1: | $83 |  | $60 |  |  0  |  |  0  |   (+12)
     |_____|  |_____|  |_____|  |_____|
       X1       M1
      _____    _____    _____    _____
     |     |  |     |  |     |  |     |
FP2: | $82 |  | $B0 |  |  0  |  |  0  |   (-5)
     |_____|  |_____|  |_____|  |_____|
       X2       M2
After calling FADD, FP1 contains +7 (FP2 contains +12).
      _____    _____    _____    _____
     |     |  |     |  |     |  |     |
FP1  | $82 |  | $70 |  |  0  |  |  0  |   (+7)
     |_____|  |_____|  |_____|  |_____|
       X1       M1