| Routines

37471: Check and set the attribute byte for a cell occupied by Willy's sprite

Used by the routine at 37434.
Input
C | 15 or Willy's y-coordinate
HL | Address of the cell in the attribute buffer at 23552
37471 | LD A,(32800) | Pick up the attribute byte of the background tile for the current cavern from 32800
37474 | CP (HL) | Does this cell contain a background tile?
37475 | JR NZ,37488 | Jump if not
37477 | LD A,C | Set the zero flag if we are going to retain the INK colour in this cell; this happens only if the cell is in the bottom row and Willy's sprite is confined to the top two rows
37478 | AND 15
37480 | JR Z,37488 | Jump if we are going to retain the current INK colour in this cell
37482 | LD A,(32800) | Pick up the attribute byte of the background tile for the current cavern from 32800
37485 | OR 7 | Set bits 0-2, making the INK white
37487 | LD (HL),A | Set the attribute byte for this cell in the buffer at 23552
37488 | LD A,(32845) | Pick up the attribute byte of the first nasty tile for the current cavern from 32845
37491 | CP (HL) | Has Willy hit a nasty of the first kind?
37492 | JP Z,36101 | Kill Willy if so
37495 | LD A,(32854) | Pick up the attribute byte of the second nasty tile for the current cavern from 32854
37498 | CP (HL) | Has Willy hit a nasty of the second kind?
37499 | JP Z,36101 | Kill Willy if so
37502 | RET |