Prev: 34BC Up: Map Next: 34F9
34E9: THE 'TEST-ZERO' SUBROUTINE
Used by the routines at IF_CMD, PREP_M_D, negate, sgn, greater_0, f_not, no_or_no, no_and_no and str_no.
This subroutine is called at least nine times to test whether a floating-point number is zero. This test requires that the first four bytes of the number should each be zero. The subroutine returns with the carry flag set if the number was in fact zero.
Input
HL Address of the first byte of the number
Output
F Carry flag set if the number is zero
TEST_ZERO 34E9 PUSH HL Save HL on the stack.
34EA PUSH BC Save BC on the stack.
34EB LD B,A Save the value of A in B.
34EC LD A,(HL) Get the first byte.
34ED INC HL Point to the second byte.
34EE OR (HL) 'OR' the first byte with the second.
34EF INC HL Point to the third byte.
34F0 OR (HL) 'OR' the result with the third byte.
34F1 INC HL Point to the fourth byte.
34F2 OR (HL) 'OR' the result with the fourth byte.
34F3 LD A,B Restore the original value of A.
34F4 POP BC And of BC.
34F5 POP HL Restore the pointer to the number to HL.
34F6 RET NZ Return with carry reset if any of the four bytes was non-zero.
34F7 SCF Set the carry flag to indicate that the number was zero, and return.
34F8 RET
Prev: 34BC Up: Map Next: 34F9