Skip to navigation

Elite on the BBC Micro and NES

Dashboard: DOT

[BBC Master version]

Name: DOT [Show more] Type: Subroutine Category: Dashboard Summary: Draw a dash on the compass
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: * COMPAS calls DOT * SP2 calls DOT

Arguments: COMX The screen pixel x-coordinate of the dash COMY The screen pixel y-coordinate of the dash COMC The colour and thickness of the dash: * &F0 = a double-height dash in yellow/white, for when the object in the compass is in front of us * &FF = a single-height dash in green/cyan, for when the object in the compass is behind us
.DOT 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 LDA COMX \ Set X1 = COMX, the x-coordinate of the dash STA X1 LDX COMC \ Set COL = COMC, the mode 2 colour byte for the dash STX COL LDA COMY \ Set Y1 = COMY, the y-coordinate of the dash CPX #YELLOW2 \ If the colour in X is yellow, then the planet/station BNE P%+8 \ is behind us, so skip the following three instructions \ so we only draw a single-height dash JSR CPIXK \ Call CPIXK to draw a single-height dash, i.e. the top \ row of a double-height dash LDA Y1 \ Fetch the y-coordinate of the row we just drew and DEC A \ decrement it, ready to draw the bottom row .DOT2 JSR CPIXK \ Call CPIXK to draw a single-height dash 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 RTS \ Return from the subroutine