Skip to navigation

Elite on the BBC Micro and NES

Version analysis of MVEIT (Part 9 of 9)

This code appears in the following versions (click to see it in the source code):

Code variations between these versions are shown below.

Name: MVEIT (Part 9 of 9) Type: Subroutine Category: Moving Summary: Move current ship: Redraw on scanner, if it hasn't been destroyed
This routine has multiple stages. This stage does the following: * If the ship is exploding or being removed, hide it on the scanner * Otherwise redraw the ship on the scanner, now that it's been moved
.MV5 LDA INWK+31 \ Fetch the ship's exploding/killed state from byte #31

Code variation 1 of 2Specific to an individual platform

Tap on a block to expand it, and tap it again to revert.

AND #%10100000 \ If we are exploding or removing this ship then jump to BNE MVD1 \ MVD1 to remove it from the scanner permanently
AND #%00100000 \ If we are exploding then jump to MVD1 to remove it BNE MVD1 \ from the scanner permanently
 LDA INWK+31            \ Set bit 4 to keep the ship visible on the scanner
 ORA #%00010000
 STA INWK+31

Code variation 2 of 2Specific to an individual platform

This variation is blank in the Disc (docked) version.

JMP SCAN \ Display the ship on the scanner, returning from the \ subroutine using a tail call
.MVD1

 LDA INWK+31            \ Clear bit 4 to hide the ship on the scanner
 AND #%11101111
 STA INWK+31

 RTS                    \ Return from the subroutine