Prev: 13422 Up: Map Next: 13477
13458: THE 'SIGNUM' FUNCTION (offset 41)
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.
Input
HL Address of the first byte of the number
sgn 13458 CALL TEST_ZERO If X is zero, just return with zero as the 'last value'.
13461 RET C
13462 PUSH DE Save the pointer to STKEND.
13463 LD DE,1 Store 1 in DE.
13466 INC HL Point to the second byte of X.
13467 RL (HL) Rotate bit 7 into the carry flag.
13469 DEC HL Point to the destination again.
13470 SBC A,A Set C to zero for positive X and to 255 for negative X.
13471 LD C,A
13472 CALL INT_STORE Stack 1 or -1 as required.
13475 POP DE Restore the pointer to STKEND.
13476 RET Finished.
Prev: 13422 Up: Map Next: 13477