![]() |
Routines |
| Prev: 64C7 | Up: Map | Next: 6518 |
|
Used by the routine at PlaceObject.
Prints the name of a place on the bottom line of the screen. Nothing happens unless bit 6 of the sprite ID of the map entry is set, which marks it as a place name. Bits 0-5 are then the number of the name in PlaceNames. The number plus one is written to CurrentPlaceID so that HandlerPlayer knows a place name is being shown.
|
||||||||||||
| DisplayPlaceName | 64F0 | BIT 6,A | Return if bit 6 of A is not set (i.e. not a place name). | |||||||||
| 64F2 | RET Z | |||||||||||
|
Strip out the bit which indicates the need to display the place name.
|
||||||||||||
| 64F3 | AND %00111111 | Keep only bits 0-5. | ||||||||||
| 64F5 | LD DE,$0005 | Set the minimum length of a place name without the "end-of-string" bit (e.g. "TUCSO(N)"), 0005. | ||||||||||
| 64F8 | LD HL,$722F | Point HL at the table of place names (PlaceNames). | ||||||||||
| 64FB | INC A | Write the number of the place name plus one to CurrentPlaceID. | ||||||||||
| 64FC | LD ($5E39),A | |||||||||||
| 64FF | DEC A | Set the place name counter to the number of the place name. | ||||||||||
| 6500 | LD B,A | |||||||||||
| 6501 | JR Z,DisplayPlaceName_Print | If it is the first place name then there is no need to search, so jump to DisplayPlaceName_Print. | ||||||||||
|
Speed up (slightly) searching through place names by adding DE (0005) to the start address.
|
||||||||||||
| DisplayPlaceName_Search | 6503 | ADD HL,DE | Add the minimum length of a place name to the pointer. | |||||||||
|
Search for the end of the current place name.
|
||||||||||||
| DisplayPlaceName_Loop | 6504 | BIT 7,(HL) | If bit 7 (the "end-of-string" flag) is not set... | |||||||||
| 6506 | INC HL | Increment HL by one. | ||||||||||
| 6507 | JR Z,DisplayPlaceName_Loop | ...then jump to DisplayPlaceName_Loop. | ||||||||||
|
B stores the entry number of the place name, so keep going until we find it.
|
||||||||||||
| 6509 | DJNZ DisplayPlaceName_Search | Decrease the place name counter by one and loop back to DisplayPlaceName_Search until the right place name has been reached. | ||||||||||
|
Output the place name to the screen.
|
||||||||||||
| DisplayPlaceName_Print | 650B | EX DE,HL | Swap the registers, so that DE points at the place name. | |||||||||
| 650C | LD HL,$B868 | HL=B868 (pixel co-ordinates: H is the Y position and L is the X position). | ||||||||||
| 650F | PUSH HL | Stash the pixel co-ordinates on the stack. | ||||||||||
| 6510 | CALL ScreenAddress | Convert them to a screen address using ScreenAddress. | ||||||||||
| 6513 | LD A,$70 | Set the attribute of the place name to INK:BLACK, PAPER:YELLOW (BRIGHT). | ||||||||||
| 6515 | EX AF,AF' | Keep the attribute in the shadow AF register. | ||||||||||
| 6516 | JR PrintStringColour_UseAttribute | Jump to PrintStringColour_UseAttribute. | ||||||||||
| Prev: 64C7 | Up: Map | Next: 6518 |