Prev: 95C8 Up: Map Next: 9637
961E: Check and set the attribute byte for a cell occupied by Willy's sprite
Used by the routine at 95C8. Sets the attribute byte in the buffer at 5C00 for one of the six cells (in three rows of two) occupied by or under Willy's sprite, or kills Willy if the cell contains a nasty. On entry, C holds either 0x0F if the cell is in the top two rows, or Willy's y-coordinate if the cell is in the bottom row.
Input
C 0x0F or Willy's y-coordinate
HL Address of the attribute byte in the buffer at 5C00
961E LD A,($80A0) Pick up the attribute byte of the background tile in the current room from 80A0
9621 CP (HL) Does this cell contain a background tile?
9622 JR NZ,$962F Jump if not
9624 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
9625 AND $0F
9627 JR Z,$962F Jump if we are going to retain the current INK colour in this cell
9629 LD A,($80A0) Pick up the attribute byte of the background tile in the current room from 80A0
962C OR $07 Set bits 0-2, making the INK white
962E LD (HL),A Set the attribute byte for this cell in the buffer at 5C00
962F LD A,($80BB) Pick up the attribute byte of the nasty tile in the current room from 80BB
9632 CP (HL) Has Willy hit a nasty?
9633 JP Z,$90B6 Kill Willy if so
9636 RET
Prev: 95C8 Up: Map Next: 9637