Jet Set Willy: Routine at 9584

| Routines

9584: Check whether Willy has reached the toilet

Called by the routine at 89AD when Willy is on his way to the toilet.
9584 | LD A,($8420) | Pick up the number of the current room from 8420
9587 | CP $21 | Are we in The Bathroom?
9589 | RET NZ | Return if not
958A | LD A,($85D3) | Pick up the LSB of Willy's attribute buffer location from 85D3
958D | CP $BC | Is Willy's screen x-coordinate 28 (where the toilet is)?
958F | RET NZ | Return if not
Willy has reached the toilet.
9590 | XOR A | Reset the minute counter at 85CB to 0 (so that we get to see Willy's head down the toilet for at least a whole game minute)
9591 | LD ($85CB),A
9594 | LD A,$03 | Update the game mode indicator at 85DF to 3 (Willy's head is down the toilet)
9596 | LD ($85DF),A
9599 | RET |