Skip to navigation

Elite on the BBC Micro and NES

Version analysis of LOOK1

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

Code variations between these versions are shown below.

Name: LOOK1 Type: Subroutine Category: Flight Summary: Initialise the space view
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

Code variation 1 of 3Related to the Master version

The Master has a unique lightning bolt effect for the energy bomb.

See below for more variations related to this code.

This variation is blank in the Cassette, Disc (flight), 6502 Second Processor and Electron versions.

LDA BOMB \ If our energy bomb has been set off, then BOMB will be BPL P%+5 \ negative, so this skips the following instruction if \ our energy bomb is not going off JSR BOMBOFF \ Our energy bomb is going off, so call BOMBOFF to draw \ the zig-zag lightning bolt
 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

Code variation 2 of 3Related to the screen mode

This variation is blank in the Cassette, Disc (flight) and Electron versions.

JSR DOVDU19 \ Send a #SETVDU19 0 command to the I/O processor to \ switch to the mode 1 palette for the space view, \ which is yellow (colour 1), red (colour 2) and cyan \ (colour 3)
 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

Code variation 3 of 3Related to the Master version

See variation 1 above for details.

This variation is blank in the Cassette, Disc (flight), 6502 Second Processor and Electron versions.

LDA BOMB \ If our energy bomb has been set off, then BOMB will be BPL P%+5 \ negative, so this skips the following instruction if \ our energy bomb is not going off JSR BOMBOFF \ Our energy bomb is going off, so call BOMBOFF to draw \ the zig-zag lightning bolt
 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