Prev: 12253 Up: Map Next: 12303
12292: 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 12292 INC E Add carry to rightmost byte.
12293 RET NZ Return if no overflow to left.
12294 INC D Continue to the next byte.
12295 RET NZ Return if no overflow to left.
12296 EXX Get the next byte.
12297 INC E Increment it too.
12298 JR NZ,ALL_ADDED Jump if no overflow.
12300 INC D Increment the last byte.
ALL_ADDED 12301 EXX Restore the original registers.
12302 RET Finished.
Prev: 12253 Up: Map Next: 12303