Skip to navigation

Elite on the BBC Micro and NES

Flight: LOOK1

[BBC Micro cassette version]

Name: LOOK1 [Show more] Type: Subroutine Category: Flight Summary: Initialise the space view
Context: See this subroutine in context in the source code Variations: See code variations for this subroutine in the different versions References: This subroutine is called as follows: * MJP calls LOOK1 * TT102 calls LOOK1 * TT110 calls LOOK1 * WARP calls LOOK1 * SIGHT calls via LO2

Initialise the space view, with the direction of view given in X. This clears the upper screen and draws the laser crosshairs, if the view in X has lasers fitted. It also wipes all the ships from the scanner, so we can recalculate ship positions for the new view (they get put back in the main flight loop).
Arguments: X The space view to set: * 0 = front * 1 = rear * 2 = left * 3 = right
Other entry points: LO2 Contains an RTS
.LO2 RTS \ Return from the subroutine .LQ STX VIEW \ Set the current space view to X JSR TT66 \ Clear the top part of the screen, draw a white border, \ and set the current view type in QQ11 to 0 (space \ view) JSR SIGHT \ Draw the laser crosshairs JMP NWSTARS \ Set up a new stardust field and return from the \ subroutine using a tail call .LOOK1 LDA #0 \ Set A = 0, the type number of a space view LDY QQ11 \ If the current view is not a space view, jump up to LQ BNE LQ \ to set up a new space view CPX VIEW \ If the current view is already of type X, jump to LO2 BEQ LO2 \ to return from the subroutine (as LO2 contains an RTS) STX VIEW \ Change the current space view to X JSR TT66 \ Clear the top part of the screen, draw a white border, \ and set the current view type in QQ11 to 0 (space \ view) JSR FLIP \ Swap the x- and y-coordinates of all the stardust \ particles and redraw the stardust field JSR WPSHPS \ Wipe all the ships from the scanner and mark them all \ as not being shown on-screen \ And fall through into SIGHT to draw the laser \ crosshairs