Skip to navigation


Universe: KS4

[NES version, Bank 0]

Name: KS4 [Show more] Type: Subroutine Category: Universe Summary: Remove the space station and replace it with the sun
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * KILLSHP calls KS4
.KS4 JSR ZINF ; Call ZINF to reset the INWK ship workspace LDA #0 ; Set A = 0 so we can zero the following flags STA FRIN+1 ; Set the second slot in the FRIN table to 0, which ; sets this slot to empty, so when we call NWSHP below ; the new sun that gets created will go into FRIN+1 STA SSPR ; Set the "space station present" flag to 0, as we are ; no longer in the space station's safe zone LDA #6 ; Set the sun's y_sign to 6 STA INWK+5 LDA #129 ; Set A = 129, the ship type for the sun JSR NWSHP ; Call NWSHP to set up the sun's data block and add it ; to FRIN, where it will get put in the second slot as ; we just cleared out the second slot, and the first ; slot is already taken by the planet JMP UpdateIconBar_b3 ; Update the icon bar so the docking computer icon gets ; removed to reflect that we are no longer in the safe ; zone, returning from the subroutine using a tail call