| Routines

12480: THE 'PREPARE TO MULTIPLY OR DIVIDE' SUBROUTINE

Used by the routines at multiply and division. This subroutine prepares a floating-point number for multiplication or division, returning with carry set if the number is zero, getting the sign of the result into the A register, and replacing the sign bit in the number by the true numeric bit, 1.
Input
A | Bit 7 holds 0 on the first call, or the sign bit of the first number
HL | Address of the first byte of the number
Output
A | Bit 7 holds the sign bit of the first number, or the sign bit of the product/quotient
F | Carry flag set if the number is zero
PREP_M_D | 12480 | CALL TEST_ZERO | If the number is zero, return with the carry flag set.
| 12483 | RET C
| 12484 | INC HL | Point to the sign byte.
| 12485 | XOR (HL) | Get sign for result into A (like signs give plus, unlike give minus); also reset the carry flag.
| 12486 | SET 7,(HL) | Set the true numeric bit.
| 12488 | DEC HL | Point to the exponent again.
| 12489 | RET | Return with carry flag reset.