Prev: 9135 Up: Map Next: 923A
921B: Flip a switch in a Kong Beast cavern if Willy is touching it
Used by the routine at 9135. Returns with the zero flag set if Willy flips the switch.
Input
HL Address of the switch's location in the attribute buffer at 5C00
921B LD A,($806C) Pick up the LSB of the address of Willy's location in the attribute buffer at 5C00 from 806C
921E INC A Is it equal to or one less than the LSB of the address of the switch's location?
921F AND $FE
9221 CP L
9222 RET NZ Return (with the zero flag reset) if not
9223 LD A,($806D) Pick up the MSB of the address of Willy's location in the attribute buffer at 5C00 from 806D
9226 CP H Does it match the MSB of the address of the switch's location?
9227 RET NZ Return (with the zero flag reset) if not
9228 LD A,($8065) Pick up the sixth byte of the graphic data for the switch tile from 8065
922B LD H,$75 Point HL at the sixth row of pixels of the switch tile in the screen buffer at 7000
922D CP (HL) Has the switch already been flipped?
922E RET NZ Return (with the zero flag reset) if so
Willy is flipping the switch.
922F LD (HL),$08 Update the sixth, seventh and eighth rows of pixels of the switch tile in the screen buffer at 7000 to make it appear flipped
9231 INC H
9232 LD (HL),$06
9234 INC H
9235 LD (HL),$06
9237 XOR A Set the zero flag: Willy has flipped the switch
9238 OR A This instruction is redundant
9239 RET
Prev: 9135 Up: Map Next: 923A