This code appears in the following versions (click to see it in the source code):
Code variations between these versions are shown below.
Name: HFS2 Type: Subroutine Category: Drawing circles Summary: Draw the launch or hyperspace tunnel
The animation gets drawn like this. First, we draw a circle of radius 8 at the centre, and then double the radius, draw another circle, double the radius again and draw a circle, and we keep doing this until the radius is bigger than 160 (which goes beyond the edge of the screen, which is 256 pixels wide, equivalent to a radius of 128). We then repeat this whole process for an initial circle of radius 9, then radius 10, all the way up to radius 15. This has the effect of making the tunnel appear to be racing towards us as we hurtle out into hyperspace or through the space station's docking tunnel.
This variation is blank in the Electron version.
Tap on a block to expand it, and tap it again to revert.
Arguments: A The step size of the straight lines making up the rings (4 for launch, 8 for hyperspace)
Other entry points: HFS1 Don't clear the screen, and draw 8 concentric rings with the step size in STP
.HFS2 STA STP \ Store the step size in A
The original versions of Elite draw 16 concentric rings for hyperspace, while the advanced versions draw 8.
This variation is blank in the Disc (flight), 6502 Second Processor and Master versions.
JSR HFS1 \ Call HFS1 below and then fall through into the same \ routine, so this effectively runs HFS1 twice, and as \ HFS1 draws 8 concentric rings, this means we draw 16 \ of them in all
.HFS1
LDX #Y \ Set K4 = #Y (the y-coordinate of the centre of the STX K4 \ screen)
.HFL5 JSR HFL1 \ Call HFL1 below to draw a set of rings, with each one \ twice the radius of the previous one, until they won't \ fit on-screen INC XX4 \ Increment the counter and fetch it into X LDX XX4 CPX #8 \ If we haven't drawn 8 sets of rings yet, loop back to BNE HFL5 \ HFL5 to draw the next ring RTS \ Return from the subroutine .HFL1 LDA XX4 \ Set K to the ring number in XX4 (0-7) + 8, so K has AND #7 \ a value of 8 to 15, which we will use as the starting CLC \ radius for our next set of rings ADC #8 STA K .HFL2 LDA #1 \ Set LSP = 1 to reset the ball line heap STA LSP JSR CIRCLE2 \ Call CIRCLE2 to draw a circle with the centre at \ (K3(1 0), K4(1 0)) and radius K ASL K \ Double the radius in K BCS HF8 \ If the radius had a 1 in bit 7 before the above shift, \ then doubling K will means the circle will no longer \ fit on the screen (which is width 256), so jump to \ HF8 to stop drawing circles LDA K \ If the radius in K <= 160, loop back to HFL2 to draw CMP #160 \ another one BCC HFL2 .HF8 RTS \ Return from the subroutine