Skip to navigation

Elite on the BBC Micro and NES

Dashboard: BULB

[Elite-A, I/O processor]

Name: BULB [Show more] Type: Subroutine Category: Dashboard Summary: Draw an indicator bulb on the dashboard
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * ECBLB calls BULB

Arguments: A The y-coordinate of the bulb as a low-byte screen address offset within screen page &7D (as both bulbs are on this character row in the dashboard) (Y X) The address of the character definition of the bulb to be drawn (i.e. ECBT for the E.C.M. bulb, or SPBT for the space station bulb)
Other entry points: BULB-2 Set the Y screen address
.BULB STA SC \ Store the low byte of the screen address in SC LDA #&7D \ Set A to the high byte of the screen address, which is \ &7D as the bulbs are both in the character row from \ &7D00 to &7DFF STA SC+1 \ Set the high byte of SC(1 0) to &7D, so SC now points \ to the screen address of the bulb we want to draw STX font \ Set font(1 0) = (Y X) STY font+1 LDY #7 \ We now want to draw the bulb by copying the bulb \ character definition from font(1 0) into the screen \ address at SC(1 0), so set a counter in Y to work \ through the eight bytes (one per row) in the bulb .ECBLBor LDA (font),Y \ Fetch the Y-th row of the bulb character definition \ from font(1 0) EOR (SC),Y \ Draw the row on-screen using EOR logic, so if the bulb STA (SC),Y \ is already on-screen this will remove it, otherwise it \ will light the bulb up DEY \ Decrement the row counter BPL ECBLBor \ Loop back to ECBLBor until we have drawn all 8 rows of \ the bulb RTS \ Return from the subroutine