Skip to navigation

Elite on the BBC Micro and NES

Version analysis of PL2

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

Code variations between these versions are shown below.

Name: PL2 Type: Subroutine Category: Drawing planets

Code variation 1 of 4A variation in the comments only

Tap on a block to expand it, and tap it again to revert.

Summary: Remove the planet or sun from the screen
Summary: Remove the planet from the screen

Other entry points: PL2-1 Contains an RTS
.PL2

Code variation 2 of 4Specific to an individual platform

This variation is blank in the Electron version.

LDA TYPE \ Shift bit 0 of the planet/sun's type into the C flag LSR A

Code variation 3 of 4Related to Elite's use of the Tube

Tap on a block to expand it, and tap it again to revert.

BCS P%+5 \ If the planet/sun's type has bit 0 clear, then it's \ either 128 or 130, which is a planet; meanwhile, the \ sun has type 129, which has bit 0 set. So if this is \ the sun, skip the following instruction JMP WPLS2 \ This is the planet, so jump to WPLS2 to remove it from \ screen, returning from the subroutine using a tail \ call
BCS PL57 \ If the planet/sun's type has bit 0 clear, then it's \ either 128 or 130, which is a planet; meanwhile, the \ sun has type 129, which has bit 0 set. So if this is \ the sun, jump to PL57 to skip the following \ instructions JSR LS2FL \ Call LS2FL to send the ball line heap to the I/O \ processor for drawing on-screen, which redraws the \ planet and this removes it from the screen STZ LSP \ Reset the ball line heap by setting the ball line heap \ pointer to 0 RTS \ Return from the subroutine .PL57
JMP WPLS2 \ This is the planet, so jump to WPLS2 to remove it from \ screen, returning from the subroutine using a tail \ call

Code variation 4 of 4Specific to an individual platform

This variation is blank in the Electron version.

JMP WPLS \ This is the sun, so jump to WPLS to remove it from \ screen, returning from the subroutine using a tail \ call