Prev: 346E Up: Map Next: 34A5
3492: THE 'SIGNUM' FUNCTION (offset +29)
The address of this routine is found in the table of addresses. It is called indirectly via fp_calc_2.
This subroutine handles the function SGN X and therefore returns a 'last value' of 1 if X is positive, zero if X is zero and -1 if X is negative.
HL Address of the first byte of the number
sgn 3492 CALL TEST_ZERO If X is zero, just return with zero as the 'last value'.
3495 RET C
3496 PUSH DE Save the pointer to STKEND.
3497 LD DE,$0001 Store 1 in DE.
349A INC HL Point to the second byte of X.
349B RL (HL) Rotate bit 7 into the carry flag.
349D DEC HL Point to the destination again.
349E SBC A,A Set C to zero for positive X and to +FF for negative X.
349F LD C,A
34A0 CALL INT_STORE Stack 1 or -1 as required.
34A3 POP DE Restore the pointer to STKEND.
34A4 RET Finished.
Prev: 346E Up: Map Next: 34A5