| Routines

9534: Deal with special rooms (Master Bedroom, The Bathroom)

Used by the routine at 89AD.
9534 | LD A,($8420) | Pick up the number of the current room from 8420
9537 | CP $23 | Are we in Master Bedroom?
9539 | JR NZ,$959A | Jump if not
953B | LD A,($85DF) | Pick up the game mode indicator from 85DF
953E | OR A | Has Willy collected all the items?
953F | JR NZ,$9576 | Jump if so
Willy hasn't collected all the items yet, so Maria is on guard.
9541 | LD A,($85CB) | Pick up the minute counter from 85CB; this will determine Maria's animation frame
9544 | AND $02 | Keep only bit 1, move it to bit 5, and set bit 7
9546 | RRCA
9547 | RRCA
9548 | RRCA
9549 | RRCA
954A | OR $80
954C | LD E,A | Now E=0x80 (foot down) or 0xA0 (foot raised)
954D | LD A,($85CF) | Pick up Willy's y-coordinate from 85CF
9550 | CP $D0 | Is Willy on the floor below the ramp?
9552 | JR Z,$955C | Jump if so
9554 | LD E,$C0 | E=0xC0 (raising arm)
9556 | CP $C0 | Is Willy 8 or fewer pixels above floor level?
9558 | JR NC,$955C | Jump if so
955A | LD E,$E0 | E=0xE0 (arm raised)
955C | LD D,$9C | Point DE at the sprite graphic data for Maria (9C80, 9CA0, 9CC0 or 9CE0)
955E | LD HL,$686E | Draw Maria at (11,14) in the screen buffer at 6000
9561 | LD C,$01
9563 | CALL $9456
9566 | JP NZ,$90B7 | Kill Willy if Maria collided with him
9569 | LD HL,$4545 | H=L=0x45 (INK 5: PAPER 0: BRIGHT 1)
956C | LD ($5D6E),HL | Set the attribute bytes for the top half of Maria's sprite in the buffer at 5C00
956F | LD HL,$0707 | H=L=0x07 (INK 7: PAPER 0: BRIGHT 0)
9572 | LD ($5D8E),HL | Set the attribute bytes for the bottom half of Maria's sprite in the buffer at 5C00
9575 | RET |
Willy has collected all the items, so Maria is gone.
9576 | LD A,($85D3) | Pick up Willy's screen x-coordinate from 85D3
9579 | AND $1F
957B | CP $06 | Has Willy reached the bed (at x=5) yet?
957D | RET NC | Return if not
957E | LD A,$02 | Update the game mode indicator at 85DF to 2 (Willy is running to the toilet)
9580 | LD ($85DF),A
9583 | RET |