Skip to navigation

Elite on the BBC Micro and NES

Drawing lines: LOIN

[BBC Master version]

Name: LOIN [Show more] Type: Subroutine Category: Drawing lines Summary: Draw a one-segment line
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * BLINE calls LOIN * BOMBOFF calls LOIN * DVLOIN calls LOIN * LASLI calls LOIN * LL9 (Part 12 of 12) calls LOIN * LSPUT calls LOIN * TT15 calls LOIN * WPLS2 calls LOIN

Arguments: X1 The screen x-coordinate of the start of the line Y1 The screen y-coordinate of the start of the line X2 The screen x-coordinate of the end of the line Y2 The screen y-coordinate of the end of the line
.LOIN STY YSAV \ Store Y in YSAV so we can retrieve it below LDA #%00001111 \ Set bits 1 and 2 of the Access Control Register at STA VIA+&34 \ SHEILA &34 to switch screen memory into &3000-&7FFF JSR LOINQ \ Draw a line from (X1, Y1) to (X2, Y2) LDA #%00001001 \ Clear bits 1 and 2 of the Access Control Register at STA VIA+&34 \ SHEILA &34 to switch main memory back into &3000-&7FFF LDY YSAV \ Retrieve the value of Y we stored above RTS \ Return from the subroutine