Manic Miner: Routine at 8FC5

| Routines

8FC5: Draw the portal, or move to the next cavern if Willy has entered it

Used by the routine at 870E. First check whether Willy has entered the portal.
8FC5 | LD HL,($80B0) | Pick up the address of the portal's location in the attribute buffer at 5C00 from 80B0
8FC8 | LD A,($806C) | Pick up the LSB of the address of Willy's location in the attribute buffer at 5C00 from 806C
8FCB | CP L | Does it match that of the portal?
8FCC | JR NZ,$8FDF | Jump if not
8FCE | LD A,($806D) | Pick up the MSB of the address of Willy's location in the attribute buffer at 5C00 from 806D
8FD1 | CP H | Does it match that of the portal?
8FD2 | JR NZ,$8FDF | Jump if not
8FD4 | LD A,($808F) | Pick up the portal's attribute byte from 808F
8FD7 | BIT 7,A | Is the portal flashing?
8FD9 | JR Z,$8FDF | Jump if not
8FDB | POP HL | Drop the return address from the stack
8FDC | JP $9028 | Move Willy to the next cavern
Willy has not entered the portal, or it's not flashing, so just draw it.
8FDF | LD A,($808F) | Pick up the portal's attribute byte from 808F
8FE2 | LD (HL),A | Set the attribute bytes for the portal in the buffer at 5C00
8FE3 | INC HL
8FE4 | LD (HL),A
8FE5 | LD DE,$001F
8FE8 | ADD HL,DE
8FE9 | LD (HL),A
8FEA | INC HL
8FEB | LD (HL),A
8FEC | LD DE,$8090 | Point DE at the graphic data for the portal at 8090
8FEF | LD HL,($80B2) | Pick up the address of the portal's location in the screen buffer at 6000 from 80B2
8FF2 | LD C,$00 | C=0: overwrite mode
This routine continues into the one at 8FF4.