.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
[X]
Subroutine GINF (category: Universe)
Fetch the address of a ship's data block into INF
[X]
Macro SETUP_PPU_FOR_ICON_BAR (category: PPU)
If the PPU has started drawing the icon bar, configure the PPU to use nametable 0 and pattern table 0
[X]
Label WS1 is local to this routine
[X]
Label WS2 is local to this routine
[X]
Label WSL1 is local to this routine