| Routines

71AC: Send a policeman to Sam's last known whereabouts

Continues from the routine at 7377. The policeman recently spotted Sam while he was wearing a disguise unknown to the police; this routine sends that policeman back to where he first spotted Sam when the disguise becomes known.
Input
H | 0xDE or 0xDF (policeman)
71AC | LD L,$1F | Pick up byte 0x1F of the policeman's buffer
71AE | LD A,(HL)
71AF | AND $3F | D=Sam's y-coordinate when he was spotted by the policeman while wearing a disguise unknown to the police
71B1 | LD D,A
71B2 | LD A,(HL) | Pick up byte 0x1F again
71B3 | LD C,$04 | Initialise the destination z-coordinate to 4
71B5 | AND $C0 | Was Sam's z-coordinate 4 (on the sidewalk or road) when he was spotted?
71B7 | JR Z,$71BC | Jump if so
71B9 | RLCA | Move bits 6 and 7 of A into bits 0 and 1
71BA | RLCA
71BB | LD C,A | C=Sam's z-coordinate when he was spotted
71BC | DEC L | L=0x1E
71BD | LD E,(HL) | E=Sam's x-coordinate when he was spotted
71BE | CALL $7194 | Set the policeman's destination coordinates to (E,D)
71C1 | CALL $71A3 | Copy the destination coordinates and location identifier to 7FDB
71C4 | LD L,$1D | Point HL at byte 0x1D of the policeman's buffer
This entry point is used by the routine at 7222.
71C6 | LD A,(HL) | Pick up byte 0x1D of the policeman's buffer
71C7 | LD (HL),$00 | Set byte 0x1D of the policeman's buffer to 0 now that the disguise Sam was wearing is known to the police
71C9 | RLCA | Move bits 5-7 of A (which hold the ID of the disguise that Sam was wearing) into bits 0-2
71CA | RLCA
71CB | RLCA
71CC | AND $07 | Keep only bits 0-2
71CE | ADD A,$A0 | Now A=0x40, 0x20, 0x10, 0x08, 0x04, 0x02, or 0x01, with the set bit corresponding to the disguise that Sam was wearing
71D0 | LD D,A
71D1 | LD E,$15
71D3 | LD A,(DE)
71D4 | LD DE,$7FE8 | 7FE8 holds the disguise status flags
71D7 | EX DE,HL | Set the appropriate bit at 7FE8, making the disguise known to the police
71D8 | OR (HL)
71D9 | LD (HL),A
71DA | JP $7D09 | Set the attribute bytes for Sam's current disguise in the bottom right corner of the screen