| Routines

13545: 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 | 13545 | PUSH HL | Save HL on the stack.
| 13546 | PUSH BC | Save BC on the stack.
| 13547 | LD B,A | Save the value of A in B.
| 13548 | LD A,(HL) | Get the first byte.
| 13549 | INC HL | Point to the second byte.
| 13550 | OR (HL) | 'OR' the first byte with the second.
| 13551 | INC HL | Point to the third byte.
| 13552 | OR (HL) | 'OR' the result with the third byte.
| 13553 | INC HL | Point to the fourth byte.
| 13554 | OR (HL) | 'OR' the result with the fourth byte.
| 13555 | LD A,B | Restore the original value of A.
| 13556 | POP BC | And of BC.
| 13557 | POP HL | Restore the pointer to the number to HL.
| 13558 | RET NZ | Return with carry reset if any of the four bytes was non-zero.
| 13559 | SCF | Set the carry flag to indicate that the number was zero, and return.
| 13560 | RET