Skip to navigation

Aviator on the BBC Micro

Drawing lines: DrawIndicatorBar

Name: DrawIndicatorBar [Show more] Type: Subroutine Category: Drawing lines Summary: Draw a vertical bar on indicator 9 (rudder) or 11 (thrust)
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * UpdateIndicator (Part 13 of 15) calls DrawIndicatorBar

Arguments: A The height of the vertical bar in pixels S Defines the starting coordinate for the line: * 0 = (joyCoord, H + W) * 128 = (H + W, joyCoord) As all the vertical bar indicators are horizontal in Aviator, only the second option is used X The offset from yJoyCoord where we store the indicator value, so it can be erased when the bar needs to move: * 1 = rudder indicator (indicator 9) * 3 = thrust indicator (indicator 11) W The x-coordinate of the centre point of the indicator Y The y-coordinate of the top of the bar
.DrawIndicatorBar STA U \ Set U = A, so the line is A pixels tall LDA #1 \ Set T = 1, so the line is 1 pixel wide STA T STY joyCoord \ Set joyCoord = Y, the y-coordinate of the top of the \ bar LDA yJoyCoord,X \ Set G = the X-th byte of yJoyCoord, which contains the STA G \ x-coordinate of the current bar, so we can erase it LDA H \ Store H in the X-th byte of yJoyCoord, so the next STA yJoyCoord,X \ time we call this routine, we can use this to erase \ the bar we are about to draw JSR EraseOrthoLine \ Erase the current vertical bar at x-coordinate G LDA #0 \ Set N = 0 to switch the drawing mode to OR logic, so STA N \ the bar gets drawn on-screen JSR DrawOrthoLine \ Draw a new vertical bar at x-coordinate H RTS \ Return from the subroutine