![]() |
Routines |
| Prev: 710C | Up: Map | Next: 714B |
|
||||||||
| 710E | LD A,($7FFC) | Collect Sam's status flags from 7FFC | ||||||
| 7111 | DEC A | Now A=0 if Sam's being carried at the moment | ||||||
| 7112 | AND A | Clear the carry flag, and set the zero flag if Sam's being carried | ||||||
| 7113 | RET Z | Return with the carry flag reset if Sam's being carried | ||||||
|
Sam is not being carried at the moment. Compare his x- and y-coordinates with those of the character chasing him.
|
||||||||
| 7114 | LD L,$02 | Point HL at byte 0x02 of the character's buffer | ||||||
| 7116 | CALL $6558 | Collect Sam's x- and y-coordinates in E and D | ||||||
| 7119 | NOP | |||||||
| 711A | LD A,(HL) | A=character's y-coordinate | ||||||
| 711B | INC A | Is the character more than one y-coordinate above or below Sam? | ||||||
| 711C | SUB D | |||||||
| 711D | CP $03 | |||||||
| 711F | RET NC | Return if so | ||||||
| 7120 | DEC L | L=0x01 | ||||||
| 7121 | LD A,(HL) | A=character's x-coordinate | ||||||
| 7122 | DEC L | L=0x00 | ||||||
| 7123 | BIT 7,(HL) | Is the character facing left? | ||||||
| 7125 | JR Z,$7129 | Jump if so | ||||||
| 7127 | ADD A,$02 | A=2+character's x-coordinate | ||||||
| 7129 | SUB E | Is the character facing Sam and no more than two x-coordinates away from him? | ||||||
| 712A | CP $03 | |||||||
| 712C | RET NC | Return if not | ||||||
|
The character is facing Sam, no more than one y-coordinate above or below him, and no more than two x-coordinates to the left or right of him. Now we compare the z-coordinates.
|
||||||||
| 712D | LD A,($E604) | A=Sam's z-coordinate | ||||||
| 7130 | LD L,$04 | Set the zero flag if the character's z-coordinate matches Sam's | ||||||
| 7132 | CP (HL) | |||||||
| 7133 | SCF | Return with the carry flag set if the character can pick up Sam at his current location | ||||||
| 7134 | RET Z | |||||||
|
The z-coordinates don't match. However, the character will still be able to pick up Sam if they are both standing at or near the open entrance to a building (one inside and the other outside).
|
||||||||
| 7135 | PUSH HL | Save the character number briefly | ||||||
| 7136 | LD H,$E6 | 0xE6=Sam | ||||||
| 7138 | CALL $EB13 | Obtain descriptors for Sam's current location | ||||||
| 713B | POP HL | Restore the character number to H | ||||||
| 713C | CP $03 | Is Sam standing at the open entrance to a building? | ||||||
| 713E | JR Z,$7133 | Jump if so (Sam can be picked up here) | ||||||
| 7140 | PUSH HL | Save the character number briefly | ||||||
| 7141 | CALL $EB13 | Obtain descriptors for the character's current location | ||||||
| 7144 | POP HL | Restore the character number to H | ||||||
| 7145 | CP $03 | Is the character standing at the open entrance to a building? | ||||||
| 7147 | JR Z,$7133 | Jump if so (the character can pick Sam up here) | ||||||
| 7149 | AND A | Clear the carry flag (Sam cannot be picked up) | ||||||
| 714A | RET | |||||||
| Prev: 710C | Up: Map | Next: 714B |