![]() |
Routines |
| Prev: 60720 | Up: Map | Next: 60810 |
|
Used by the routine at 31808. Returns with A=255 if the character's z-coordinate is 2 or 4, and his y-coordinate is less than 31 (meaning he is on the fire escape of the apartment building next to no. 19, or falling from the roof of a building); with A=0 if he's on the sidewalk or the road; or with certain bits of A set or reset depending on the location:
The region ID in bits 4-7 corresponds to a certain shop or other building in the play area:
In addition, on return E holds the x-coordinate of the bottom of the staircase going up to the floor above, and D holds the x-coordinate of the top of the staircase going down to the floor below.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60726 | LD L,1 | E=character's x-coordinate | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60728 | LD E,(HL) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60729 | INC L | D=character's y-coordinate | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60730 | LD D,(HL) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60731 | LD L,4 | C=character's z-coordinate | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60733 | LD C,(HL) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
This entry point is used by the routine at 29072.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60734 | BIT 0,C | Is the z-coordinate 1 (indoors)? | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60736 | JR NZ,60743 | Jump if so | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60738 | LD A,D | A=y-coordinate | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60739 | CP 31 | A=255 if the y-coordinate is less than 31, 0 otherwise | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60741 | SBC A,A | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60742 | RET C | Return with A=255 if the y-coordinate is less than 31, and the z-coordinate is 2 or 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60743 | CALL 60159 | Check whether the character is on the sidewalk or road | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60746 | LD A,0 | Return with A=0 if the character is on the sidewalk or road | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60748 | RET NC | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
At this point we have determined that the character is on the front steps of or inside a building.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60749 | PUSH HL | Save the character number | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60750 | LD A,37 | L=10 (if 31<D), 11 (25<D<=31), 12 (19<D<=25), 13 (13<D<=19), 14 (7<D<=13) or 15 (1<D<=7) | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60752 | LD L,9 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60754 | INC L | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60755 | SUB 6 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60757 | CP D | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60758 | JR NC,60754 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60760 | SUB D | Set the zero flag if D=7, 13, 19, 25 or 31 (corresponding to the floor of a building) | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60761 | ADD A,6 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60763 | PUSH AF | Save A and the zero flag | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60764 | LD H,239 | The region identifier tables are in page 239 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60766 | LD A,E | A=x-coordinate | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60767 | LD L,(HL) | Point HL at one of the tables at 61200, 61256, 61296, 61336, 61376 and 61416 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60768 | CP (HL) | Find the first entry whose first byte is greater than A (the target x-coordinate) | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60769 | INC HL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60770 | INC HL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60771 | INC HL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60772 | INC HL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60773 | JR NC,60768 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60775 | DEC HL | E=fourth byte of the entry (x-coordinate of the bottom of the staircase going up to the floor above) | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60776 | LD E,(HL) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60777 | DEC HL | D=third byte of the entry (x-coordinate of the top of the staircase going down to the floor below) | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60778 | LD D,(HL) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60779 | DEC HL | A=second byte of the entry (location identifier) | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60780 | LD A,(HL) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60781 | CP 80 | Is the second byte of the entry less than 80? | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60783 | JR NC,60794 | Jump if not | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The second byte of the entry is less than 80, which is true only for the four entries in the region identifier table at 61200 that correspond to the shops.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60785 | POP AF | Restore A and the zero flag (though the values are ignored at this point) | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60786 | LD A,(HL) | A=location identifier | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60787 | BIT 0,C | Set the zero flag if the z-coordinate is 1 (indoors) | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60789 | POP HL | Restore the character number to H | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60790 | RET NZ | Return if the z-coordinate is 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60791 | SUB 2 | Reset bit 2 of A, and set bit 1 (to indicate that the character is standing outside the door of a shop or house) | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60793 | RET | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The second byte of the entry (held in A) is at least 80, which means it corresponds to a location other than one of the four shops.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60794 | AND 15 | Keep only bits 0-3 of the location identifier | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60796 | CP 4 | Is this location on the first floor of a building? | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60798 | JR NZ,60804 | Jump if not | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60800 | POP AF | Restore A and the zero flag | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60801 | JR Z,60786 | Jump if the y-coordinate corresponds to a floor of a building | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60803 | PUSH AF | Save A and the zero flag again | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60804 | POP AF | Restore A and the zero flag | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60805 | LD A,(HL) | A=location identifier | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60806 | POP HL | Restore the character number to H | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60807 | RET Z | Return if the y-coordinate corresponds to a floor of a building | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60808 | INC A | Set bit 0 of A to indicate that the character is on a staircase between two floors of a building, or on the front steps of a building below the first floor, or on the rim of a roof | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60809 | RET | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Prev: 60720 | Up: Map | Next: 60810 |