Skip to navigation

Elite on the BBC Micro and NES

Drawing lines: HLOIN

[Acorn Electron version]

Name: HLOIN [Show more] Type: Subroutine Category: Drawing lines Summary: Draw a horizontal line from (X1, Y1) to (X2, Y1) Deep dive: Drawing monochrome pixels in mode 4
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: * TT15 calls HLOIN * TTX66 calls HLOIN

We do not draw a pixel at the right end of the line. To understand how this routine works, you might find it helpful to read the deep dive on "Drawing monochrome pixels in mode 4".
Returns: Y Y is preserved
.HLOIN LDX Y1 \ Set Y2 = Y1, so we can use the normal line-drawing STX Y2 \ routine to draw a horizontal line .HL1 JMP LL30 \ Draw a line from (X1, Y1) to (X2, Y2), which will be \ horizontal because we set Y2 to Y1 above