Routines
 Prev: 12218 Up: Map Next: 12292
Used by the routines at PRINT_FP and addition.
This subroutine shifts a floating-point number up to 32 places right to line it up properly for addition. The number with the smaller exponent has been put in the addend position before this subroutine is called. Any overflow to the right, into the carry, is added back into the number. If the exponent difference is greater than 32, or the carry ripples right back to the beginning of the number then the number is set to zero so that the addition will not alter the other number (the augend).
Input
A Number of shifts to perform
D'E'DE Mantissa of number to shift right
L' Sign byte of number to shift right (0 or 255)
SHIFT_FP 12253 AND A If the exponent difference is zero, the subroutine returns at once.
12254 RET Z
12255 CP 33 If the difference is greater than 32, jump forward.
12259 PUSH BC Save BC briefly.
12260 LD B,A Transfer the exponent difference to B to count the shifts right.
ONE_SHIFT 12261 EXX Arithmetic shift right for L', preserving the sign marker bits.
12262 SRA L
12264 RR D Rotate right with carry D', E', D and E, thereby shifting the whole five bytes of the number to the right as many times as B counts.
12266 RR E
12268 EXX
12269 RR D
12271 RR E
12273 DJNZ ONE_SHIFT Loop back until B reaches zero.
12275 POP BC Restore the original BC.
12276 RET NC Done if no carry to retrieve.
12280 RET NZ Return unless the carry rippled right back. (In this case there is nothing to add.)
ADDEND_0 12281 EXX Fetch L', D' and E'.
12282 XOR A Clear the A register.
This entry point is used by the routine at multiply.
ZEROS_4_5 12283 LD L,0 Set the addend to zero in D', E', D and E, together with its marker byte (sign indicator) L', which was 0 for a positive number and 255 for a negative number. This produces only 4 zero bytes when called for near underflow by multiply.
12285 LD D,A
12286 LD E,L
12287 EXX
12288 LD DE,0
12291 RET Finished.
 Prev: 12218 Up: Map Next: 12292