Jet Set Willy: Routine at 959A

| Routines

959A: Animate the toilet in The Bathroom

Used by the routine at 9534.
959A | LD A,($8420) | Pick up the number of the current room from 8420
959D | CP $21 | Are we in The Bathroom?
959F | RET NZ | Return if not
95A0 | LD A,($85CB) | Pick up the minute counter from 85CB; this will determine the animation frame to use for the toilet
95A3 | AND $01 | Keep only bit 0 and move it to bit 5
95A5 | RRCA
95A6 | RRCA
95A7 | RRCA
95A8 | LD E,A | Now E=0x00 or 0x20
95A9 | LD A,($85DF) | Pick up the game mode indicator from 85DF
95AC | CP $03 | Is Willy's head down the toilet?
95AE | JR NZ,$95B2 | Jump if not
95B0 | SET 6,E | Now E=0x40 or 0x60
95B2 | LD D,$A6 | Point DE at the toilet sprite to use (A600, A620, A640 or A660)
95B4 | LD IX,$82D0 | Draw the toilet at (13,28) in the screen buffer at 6000
95B8 | LD BC,$101C
95BB | CALL $9668
95BE | LD HL,$0707 | H=L=0x07 (INK 7: PAPER 0)
95C1 | LD ($5DBC),HL | Set the attribute bytes for the toilet in the buffer at 5C00
95C4 | LD ($5DDC),HL
95C7 | RET |