Prev: 39400 Up: Map Next: 39572
39531: OxygenTick — the oxygen clock
A countdown whose period is 2 x the number of live actors: the fewer are left to run the ship, the faster the oxygen drains. Each expiry knocks one off the 4-digit ASCII oxygen counter ("7500" at the start), with the borrow rippling left; when the borrow runs past the digits into the label, the air is gone (see OxygenCheckRedraw).
Used by the routine at 38379.
39531 LD HL,38357 tick the oxygen countdown
39534 DEC (HL)
39535 RET NZ
39536 LD HL,29573 expired: count the live actors
39539 LD DE,8 (status +7 = 0, alien included)
39542 LD BC,2048 over all 8 slots
39545 XOR A
39546 CP (HL)
39547 JR Z,39550
39549 INC C
39550 ADD HL,DE
39551 DJNZ 39546
39553 LD A,C reload period = 2 x live count
39554 ADD A,A
39555 LD (38357),A
39558 LD A,47 multi-digit ASCII decrement:
39560 LD HL,38377 units digit first,
39563 DEC (HL)
39564 CP (HL) on '0'-1 ('/')
39565 JR NZ,39572
39567 LD (HL),57 wrap to '9' and
39569 DEC HL borrow one digit left
39570 JR 39563
Prev: 39400 Up: Map Next: 39572