Skip to navigation

Elite on the BBC Micro and NES

Drawing ships: LL9 (Part 12 of 12)

[BBC Master version]

Name: LL9 (Part 12 of 12) [Show more] Type: Subroutine Category: Drawing ships Summary: Draw ship: Draw all the visible edges from the ship line heap Deep dive: Drawing ships
Context: See this subroutine in context in the source code Variations: See code variations for this subroutine in the different versions References: This subroutine is called as follows: * LL9 (Part 1 of 12) calls via LSCLR * LL9 (Part 11 of 12) calls via LSCLR * SHPPT calls via LSCLR * LSPUT calls via LSC3

This part draws any remaining lines from the old ship that are still in the ship line heap.
Other entry points: LSCLR Draw any remaining lines from the old ship that are still in the ship line heap LSC3 Contains an RTS
.LSCLR LDY LSNUM \ Set Y to the offset in the line heap LSNUM .LSC1 CPY LSNUM2 \ If Y >= LSNUM2, jump to LSC2 to return from the ship BCS LSC2 \ drawing routine, because the index in Y is greater \ than the size of the existing ship line heap, which \ means we have already erased all the old ship's lines \ when drawing the new ship \ If we get here then Y < LSNUM2, which means Y is \ pointing to an on-screen line from the old ship that \ we need to erase LDA (XX19),Y \ Fetch the X1 line coordinate from the heap and store INY \ it in XX15, incrementing the heap pointer STA XX15 LDA (XX19),Y \ Fetch the Y1 line coordinate from the heap and store INY \ it in XX15+1, incrementing the heap pointer STA XX15+1 LDA (XX19),Y \ Fetch the X2 line coordinate from the heap and store INY \ it in XX15+2, incrementing the heap pointer STA XX15+2 LDA (XX19),Y \ Fetch the Y2 line coordinate from the heap and store INY \ it in XX15+3, incrementing the heap pointer STA XX15+3 JSR LOIN \ Draw a line from (X1, Y1) to (X2, Y2) to erase it from \ the screen JMP LSC1 \ Loop back to LSC1 to draw (i.e. erase) the next line \ from the heap .LSC2 LDA LSNUM \ Store LSNUM in the first byte of the ship line heap LDY #0 STA (XX19),Y .LSC3 RTS \ Return from the subroutine