Prev: 11713 Up: Map Next: 11747
11733: THE 'FLOATING-POINT TO A' SUBROUTINE
Used by the routines at TWO_PARAM, FIND_INT1, STK_TO_A, CD_PRMS1, DEC_TO_FP, PRINT_FP, chrs and exp.
The routine at LOG_2_A continues here.
This short but vital subroutine is called at least 8 times for various purposes. It uses FP_TO_BC to get the 'last value' into the A register where this is possible. It therefore tests whether the modulus of the number rounds to more than 255 and if it does the subroutine returns with the carry flag set. Otherwise it returns with the modulus of the number, rounded to the nearest integer, in the A register, and the zero flag set to imply that the number was positive, or reset to imply that it was negative.
Output
A Last value from the calculator stack
F Carry flag set on overflow
F Zero flag set if the value is positive, reset if negative
FP_TO_A 11733 CALL FP_TO_BC Compress the 'last value' into BC.
11736 RET C Return if out of range already.
11737 PUSH AF Save the result and the flags.
11738 DEC B Again it will be out of range if the B register does not hold zero.
11739 INC B
11740 JR Z,FP_A_END Jump if in range.
11742 POP AF Fetch the result and the flags.
11743 SCF Signal the result is out of range.
11744 RET Finished - unsuccessful.
FP_A_END 11745 POP AF Fetch the result and the flags.
11746 RET Finished - successful.
Prev: 11713 Up: Map Next: 11747