Skip to navigation

Elite on the BBC Micro

Dashboard: DOT (Master version)

Name: DOT [View in context] Type: Subroutine [Compare versions] Category: Dashboard Summary: Draw a dot on the compass
Arguments: COMX The screen pixel x-coordinate of the dot COMY The screen pixel y-coordinate of the dot COMC The colour and thickness of the dot: * &F0 = a double-height dot in yellow/white, for when the object in the compass is in front of us * &FF = a single-height dot 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 dot STA X1 LDX COMC \ Set COL = COMC, the mode 2 colour byte for the dot STX COL LDA COMY \ Set Y1 = COMY, the y-coordinate of the dot CPX #YELLOW2 \ If the colour in X is yellow, then the dot is behind BNE P%+8 \ us, so skip the following three instructions so we \ only draw a single-height dot JSR CPIX2 \ Call CPIX2 to draw a single-height dash, i.e. the top \ row of a double-height dot LDA Y1 \ Fetch the y-coordinate of the row we just drew and DEC A \ decrement it, ready to draw the bottom row JSR CPIX2 \ Call CPIX2 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