Prev: 6518 Up: Map Next: 6557
653E: Locate Player Marker
Used by the routines at NewGame and FlashPlayerMarker.
Works out where the player's marker belongs on the map in the sidebar, where one pixel is 80 units of the player's position. The marker is at H=47 - the Y position / 80 and L=08 + the X position / 80.
Output
HL Pixel co-ordinates of the marker (H is the Y position and L is the X position)
LocatePlayerMarker 653E LD DE,($5E08) Fetch the player's Y position on the map (PlayerMapPositionY).
6542 SLA E Double it, so that D holds the Y position / 80.
6544 RL D
6546 LD A,$47 Start from 47 the bottom of the map.
6548 SUB D Take the Y position away, as the map counts up from the bottom.
6549 LD D,A Keep the Y position of the marker in D.
654A LD HL,($5E05) Fetch the player's X position on the map (PlayerMapPosition).
654D SLA L Double it, so that H holds the X position / 80.
654F RL H
6551 LD A,H Fetch the X position / 80.
6552 ADD A,$08 Add 08 the X position of the left edge of the map.
6554 LD L,A Set the X position of the marker in L.
6555 LD H,D Set the Y position of the marker in H.
6556 RET Return.
Prev: 6518 Up: Map Next: 6557