Prev: 2FDD Up: Map Next: 300F
3004: THE 'ADD-BACK' SUBROUTINE
Used by the routines at SHIFT_FP and multiply.
This subroutine adds back into the number any carry which has overflowed to the right. In the extreme case, the carry ripples right back to the left of the number.
When this subroutine is called during addition, this ripple means that a mantissa of 0.5 was shifted a full 32 places right, and the addend will now be set to zero; when called from multiply, it means that the exponent must be incremented, and this may result in overflow.
Input
D'E'DE Mantissa of number shifted right
Output
F Zero flag set on overflow (mantissa was FFFFFFFF)
ADD_BACK 3004 INC E Add carry to rightmost byte.
3005 RET NZ Return if no overflow to left.
3006 INC D Continue to the next byte.
3007 RET NZ Return if no overflow to left.
3008 EXX Get the next byte.
3009 INC E Increment it too.
300A JR NZ,ALL_ADDED Jump if no overflow.
300C INC D Increment the last byte.
ALL_ADDED 300D EXX Restore the original registers.
300E RET Finished.
Prev: 2FDD Up: Map Next: 300F