Prev: 653E Up: Map Next: 6588
6557: Flash Player Marker
Used by the routines at HandlerExplosion and HandlerPlayer.
Shows the player's position on the map in the sidebar as a pixel which flashes on and off every 08 frames. When the marker moves, the screen byte it was covering is put back, using the copy saved in PlayerMarker_Byte. The address of that byte is held in PlayerMarker_Address.
Marker on Marker off
flash-marker-on flash-marker-off
FlashPlayerMarker 6557 CALL LocatePlayerMarker Work out the pixel co-ordinates of the marker using LocatePlayerMarker.
Has the marker moved? The saved value is a screen address, whereas HL holds pixel co-ordinates, so these are only equal by coincidence.
655A PUSH HL Stash the pixel co-ordinates on the stack.
655B LD DE,($5E36) Fetch the screen address saved for the marker (PlayerMarker_Address).
655F AND A Reset the carry flag.
6560 SBC HL,DE Compare the pixel co-ordinates with the saved screen address.
6562 POP HL Restore the pixel co-ordinates from the stack.
6563 JR Z,FlashPlayerMarker_Flash Jump to FlashPlayerMarker_Flash if the result was zero.
Put back the screen byte that was covered by the marker.
6565 PUSH HL Stash the pixel co-ordinates on the stack.
6566 LD HL,($5E36) Fetch the screen address of the byte the marker covered (PlayerMarker_Address).
6569 LD A,($5E38) Fetch the screen byte that the marker covered (PlayerMarker_Byte).
656C LD (HL),A Put the screen byte back.
656D POP HL Restore the pixel co-ordinates from the stack.
This entry point is used by the routine at NewGame.
Save the screen byte at the position of the marker.
FlashPlayerMarker_SaveByte 656E PUSH HL Stash the pixel co-ordinates on the stack.
656F CALL ScreenAddress Convert the pixel co-ordinates to a screen address using ScreenAddress.
6572 LD ($5E36),HL Save the screen address of the marker at PlayerMarker_Address.
6575 LD A,(HL) Fetch the screen byte at the marker.
6576 LD ($5E38),A Save the screen byte at PlayerMarker_Byte.
6579 POP HL Restore the pixel co-ordinates from the stack.
Flash the marker, setting the pixel on one phase and clearing it on the other.
FlashPlayerMarker_Flash 657A LD BC,$0101 Set the size of the marker, a single pixel (0101).
657D LD A,($5E29) Fetch the game timer from GameTimer.
6580 AND %00001000 Keep only bit 3, which changes every 08 frames.
6582 JP NZ,SetPixels If the bit is set then jump to SetPixels to draw the marker.
6585 JP ClearPixels Else jump to ClearPixels to remove the marker.
Prev: 653E Up: Map Next: 6588