Prev: 7377 Up: Map Next: 739D
738A: Check whether Sam or a gangster is inside a region
Used by the routines at 739D and 7A82. On entry, HL points at the first or second entry in a table of region definitions (at FD0C, FD26, FD44, FD64 or FD7C) used by a gangster who is on the lookout for Sam. On exit, the carry flag is set if Sam or the gangster is outside the region.
Input
D Gangster's character number (0xD7-0xE0), or 0xE6 (Sam)
HL Address of a region definition
738A LD E,$01 A=Sam's or the gangster's x-coordinate
738C LD A,(DE)
738D CP (HL) Is Sam or the gangster to the left of the region?
738E RET C Return with the carry flag set if so
738F INC HL Point HL at the upper x-coordinate
7390 CP (HL) Is Sam or the gangster to the right of the region?
7391 CCF Return with the carry flag set if so
7392 RET C
7393 INC HL Point HL at the lower y-coordinate
7394 INC E A=Sam's or the gangster's y-coordinate
7395 LD A,(DE)
7396 CP (HL) Is Sam or the gangster above the region?
7397 RET C Return with the carry flag set if so
7398 INC HL Point HL at the upper y-coordinate
7399 CP (HL) Compare it with Sam's or the gangster's y-coordinate
739A INC HL Point HL at either the disguise ID, or the first byte of the second entry in the table of region definitions
739B CCF Set the carry flag if Sam or the gangster is below the region
739C RET
Prev: 7377 Up: Map Next: 739D