Apple II User Manual

Page of 257
ABSWAP Subroutine (address $F437)
Purpose: To take the absolute value of FP1 and then swap FP1 with FP2.
Note that two sequential calls to ABSWAP will take the absolute values of
both FP1 and FP2 in preparation for a multiply or divide.
Entry: FP1 and FP2 contain floating point values.
Exit: The absolute value of the original FP1 contents are in FP2 and the
original FP2 contents are in FP1.  The least significant bit of SIGN is
complemented if a negation takes place (if the original FP1 contents are
negative) by means of an increment.  SCR and E are used.  The A-REG
contains a copy of X2, the X-REG is cleared, and the Y-REG is not altered.
RTAR Subroutine (address $F47D)
Purpose: To shift M1 right one bit position while incrementing X1 to
compensate for scale.  This is roughly the opposite of the NORM subroutine.
Entry: A normalized or unnormalized floating point value is in FP1.
Exit: The 6-byte field MANT1 and E is shifted right one bit arithmetically
and X1 is incremented by 1 to retain proper scale.  The sign bit of MANT1
(MSB of M1) is unchanged.  FP2, SIGN, and SCR are not disturbed.  The A-REG
contains the least significant byte of E (E+2), the X-REG is cleared, and
the Y-REG is not disturbed.
Caution: If X1 increments of 0 (overflow) then an exit to location $3F5 is
taken, the A-REG contains the high-order MANT1 byte, M1 and X1 is cleared.
FP2, SIGN, SCR, and the X- and Y-REGs are not disturbed.
Uses: RTLOG
Example: Prior to calling RTAR, FP1 contains the normalized value -7.
      _____    _____    _____    _____
     |     |  |     |  |     |  |     |
FP1  | $83 |  | $A0 |  |  0  |  |  0  |   (-7)
     |_____|  |_____|  |_____|  |_____|
       X1       M1
After calling RTAR, FP1 contains the unnormalized value -7 (note that
precision is lost off the low-order end of M1).
      _____    _____    _____    _____
     |     |  |     |  |     |  |     |
FP1  | $84 |  | $D0 |  |  0  |  |  0  |   (-7)
     |_____|  |_____|  |_____|  |_____|
       X1       M1