Prev: 35140 Up: Map Next: 35445
35388: Decrease the air remaining in the current cavern
Used by the routines at 34574, 36211 and 36904. Returns with the zero flag set if there is no air remaining.
35388 LD A,(32957) Update the game clock at 32957
35391 SUB 4
35393 LD (32957),A
35396 CP 252 Was it just decreased from zero?
35398 JR NZ,35413 Jump if not
35400 LD A,(32956) Pick up the value of the remaining air supply from 32956
35403 CP 36 Has the air supply run out?
35405 RET Z Return (with the zero flag set) if so
35406 DEC A Decrement the air supply at 32956
35407 LD (32956),A
35410 LD A,(32957) Pick up the value of the game clock at 32957
35413 AND 224 A=INT(A/32); this value specifies how many pixels to draw from left to right in the cell at the right end of the air bar
35415 RLCA
35416 RLCA
35417 RLCA
35418 LD E,0 Initialise E to 0 (all bits reset)
35420 OR A Do we need to draw any pixels in the cell at the right end of the air bar?
35421 JR Z,35430 Jump if not
35423 LD B,A Copy the number of pixels to draw (1-7) to B
35424 RRC E Set this many bits in E (from bit 7 towards bit 0)
35426 SET 7,E
35428 DJNZ 35424
35430 LD A,(32956) Pick up the value of the remaining air supply from 32956
35433 LD L,A Set HL to the display file address at which to draw the top row of pixels in the cell at the right end of the air bar
35434 LD H,82
35436 LD B,4 There are four rows of pixels to draw
35438 LD (HL),E Draw the four rows of pixels at the right end of the air bar
35439 INC H
35440 DJNZ 35438
35442 XOR A Reset the zero flag to indicate that there is still some air remaining; these instructions are redundant, since the zero flag is already reset at this point
35443 INC A
35444 RET
Prev: 35140 Up: Map Next: 35445