Skip to navigation


Flight: LOOK1

[NES version, Bank 0]

Name: LOOK1 [Show more] Type: Subroutine Category: Flight Summary: Initialise the space view
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * TT102 calls LOOK1 * TT110 calls LOOK1 * WARP calls LOOK1

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 JSR SendSpaceViewToPPU ; Set a new space view, clear the screen, copy the ; nametable buffers and configure the PPU for the new ; view 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) JSR SetSpaceViewInNMI ; Change the current space view to X and configure the ; NMI to send both bitplanes to the PPU during VBlank JSR FLIP ; Swap the x- and y-coordinates of all the stardust ; particles and redraw the stardust field JMP WaitForNMI ; Wait until the next NMI interrupt has passed (i.e. the ; next VBlank) and return from the subroutine using a ; tail call