Skip to navigation

Elite on the BBC Micro

Drawing ships: LL9 (Part 12 of 12) (Master version)

Name: LL9 (Part 12 of 12) [View in context] Type: Subroutine [Compare versions] Category: Drawing ships Summary: Draw ship: Draw all the visible edges from the ship line heap Deep dive: Drawing ships
This part draws any remaining lines from the old ship that are still in the ship line heap.
.LL155 LDY XX14 \ Set Y to the offset in the line heap XX14 .LL27 CPY XX14+1 \ If Y >= XX14+1, jump to LLEX to return from the ship BCS LLEX \ drawing routine, because the index in Y is greater \ than the size of the existing ship line heap, which \ means we have alrady erased all the old ships lines \ when drawing the new ship \ If we get here then Y < XX14+1, 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 LL30 \ Draw a line from (X1, Y1) to (X2, Y2) to erase it from \ the screen JMP LL27 \ Loop back to LL27 to draw (i.e. erase) the next line \ from the heap .LLEX LDA XX14 \ Store XX14 in the first byte of the ship line heap LDY #0 STA (XX19),Y .LL82 RTS \ Return from the subroutine