Skip to navigation

Elite on the BBC Micro and NES

Version analysis of HLOIN2

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

Code variations between these versions are shown below.

Name: HLOIN2 Type: Subroutine Category: Drawing lines Summary: Remove a line from the sun line heap and draw it on-screen
Specifically, this does the following: * Set X1 and X2 to the x-coordinates of the ends of the horizontal line with centre YY(1 0) and length A to the left and right * Set the Y-th byte of the LSO block to 0 (i.e. remove this line from the sun line heap) * Draw a horizontal line from (X1, Y) to (X2, Y)
Arguments: YY(1 0) The x-coordinate of the centre point of the line A The half-width of the line, i.e. the contents of the Y-th byte of the sun line heap Y The number of the entry in the sun line heap (which is also the y-coordinate of the line)
Returns: Y Y is preserved
.HLOIN2 JSR EDGES \ Call EDGES to calculate X1 and X2 for the horizontal \ line centred on YY(1 0) and with half-width A STY Y1 \ Set Y1 = Y LDA #0 \ Set the Y-th byte of the LSO block to 0 STA LSO,Y

Code variation 1 of 1Specific to an individual platform

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

\ Fall through into HLOIN to draw a horizontal line from \ (X1, Y) to (X2, Y)
JMP HLOIN \ Call HLOIN to draw a horizontal line from (X1, Y) to \ (X2, Y), returning from the subroutine using a tail \ call