Skip to navigation

Elite on the BBC Micro and NES

Dashboard: WPSHPS

[NES version, Bank 0]

Name: WPSHPS [Show more] Type: Subroutine Category: Dashboard Summary: Set all ships to be hidden from the screen
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * NWSTARS calls WPSHPS * RES2 calls WPSHPS
.WPSHPS LDX #0 ; Set up a counter in X to work our way through all the ; ship slots in FRIN .WSL1 SETUP_PPU_FOR_ICON_BAR ; If the PPU has started drawing the icon bar, configure ; the PPU to use nametable 0 and pattern table 0 LDA FRIN,X ; Fetch the ship type in slot X BEQ WS2 ; If the slot contains 0 then it is empty and we have ; checked all the slots (as they are always shuffled ; down in the main loop to close up and gaps), so jump ; to WS2 as we are done BMI WS1 ; If the slot contains a ship type with bit 7 set, then ; it contains the planet or the sun, so jump down to WS1 ; to skip this slot, as the planet and sun don't appear ; on the scanner STA TYPE ; Store the ship type in TYPE JSR GINF ; Call GINF to get the address of the data block for ; ship slot X and store it in INF LDY #31 ; Clear bits 3 and 6 in the ship's byte #31, which stops LDA (INF),Y ; drawing the ship on-screen (bit 3), and denotes that AND #%10110111 ; the explosion has not been drawn and there are no STA (INF),Y ; lasers firing (bit 6) .WS1 INX ; Increment X to point to the next ship slot BNE WSL1 ; Loop back up to process the next slot (this BNE is ; effectively a JMP as X will never be zero) .WS2 LDX #0 ; Set X = 0 (though this appears not to be used) RTS ; Return from the subroutine