Prev: 25799 Up: Map Next: 25880
25840: Display Place Name
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.
Before After
place-name-before place-name-after
Input
A Bits 0-6 of ActiveObject
DisplayPlaceName 25840 BIT 6,A Return if bit 6 of A is not set (i.e. not a place name).
25842 RET Z
Strip out the bit which indicates the need to display the place name.
25843 AND %00111111 Keep only bits 0-5.
25845 LD DE,5 Set the minimum length of a place name without the "end-of-string" bit (e.g. "TUCSO(N)"), 0005.
25848 LD HL,29231 Point HL at the table of place names (PlaceNames).
25851 INC A Write the number of the place name plus one to CurrentPlaceID.
25852 LD (24121),A
25855 DEC A Set the place name counter to the number of the place name.
25856 LD B,A
25857 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 25859 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 25860 BIT 7,(HL) If bit 7 (the "end-of-string" flag) is not set...
25862 INC HL Increment HL by one.
25863 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.
25865 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 25867 EX DE,HL Swap the registers, so that DE points at the place name.
25868 LD HL,47208 HL=47208 (pixel co-ordinates: H is the Y position and L is the X position).
25871 PUSH HL Stash the pixel co-ordinates on the stack.
25872 CALL ScreenAddress Convert them to a screen address using ScreenAddress.
25875 LD A,112 Set the attribute of the place name to INK:BLACK, PAPER:YELLOW (BRIGHT).
25877 EX AF,AF' Keep the attribute in the shadow AF register.
25878 JR PrintStringColour_UseAttribute Jump to PrintStringColour_UseAttribute.
Prev: 25799 Up: Map Next: 25880