Skip to navigation

Elite on the BBC Micro

Version analysis of ECBLB

This code appears in the following versions (click to see it in the source code):

Code variations between these versions are shown below.

Name: ECBLB Type: Subroutine Category: Dashboard

Code variation 1 of 5A variation in the comments only

Tap on a version to expand it, and tap it again to show to all variations.

Cassette, Flight, Master, Electron

6502SP

Summary: Light up the E.C.M. indicator bulb ("E") on the dashboard
Summary: Implement the #DOBULB 255 command (draw the E.C.M. indicator bulb)

Code variation 2 of 5A variation in the comments only

This variation is blank in the Cassette, Disc (flight), Master and Electron versions.

6502SP

This routine is run when the parasite sends a #DOBULB 255 command. It draws (or erases) the E.C.M. indicator bulb ("E") on the dashboard.
.ECBLB

Code variation 3 of 5Specific to an individual platform

This variation is blank in the Cassette, Disc (flight), 6502 Second Processor and Electron versions.

Master

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

Code variation 4 of 5Related to the screen mode

Tap on a version to expand it, and tap it again to show to all variations.

Cassette

Flight

6502SP, Master

Electron

LDA #7*8 \ The E.C.M. bulb is in character block number 7 \ with each character taking 8 bytes, so this sets the \ low byte of the screen address of the character block \ we want to draw to LDX #LO(ECBT) \ Set (Y X) to point to the character definition in LDY #HI(ECBT) \ ECBT. The LDY has no effect, as we overwrite Y with \ the jump to BULB-2, which writes the high byte of SPBT \ into Y. This works as long as ECBT and SPBT are in \ the same page of memory, so perhaps the BNE below got \ changed from BULB to BULB-2 so they could remove the \ LDY, but for some reason it didn't get culled? Who \ knows... BNE BULB-2 \ Jump down to BULB-2 (this BNE is effectively a JMP as \ A will never be zero)
LDA #7*8 \ The E.C.M. bulb is in character block number 7 \ with each character taking 8 bytes, so this sets the \ low byte of the screen address of the character block \ we want to draw to LDX #LO(ECBT) \ Set (Y X) to point to the character definition in \ ECBT (we set Y below with the jump to BULB-2, which \ writes the high byte of SPBT into Y BNE BULB-2 \ Jump down to BULB-2 (this BNE is effectively a JMP as \ A will never be zero)
LDA #8*14 \ The E.C.M. bulb is in character block number 14 with STA SC \ each character taking 8 bytes, so this sets the low \ byte of the screen address of the character block we \ want to draw to LDA #&7A \ Set the high byte of SC(1 0) to &7A, as the bulbs are STA SC+1 \ both in the character row from &7A00 to &7BFF, and the \ E.C.M. bulb is in the left half, which is from &7A00 \ to &7AFF LDY #15 \ Now to poke the bulb bitmap into screen memory, and \ there are two character blocks' worth, each with eight \ lines of one byte, so set a counter in Y for 16 bytes .BULL2 LDA ECBT,Y \ Fetch the Y-th byte of the bulb bitmap EOR (SC),Y \ EOR the byte with the current contents of screen \ memory, so drawing the bulb when it is already \ on-screen will erase it STA (SC),Y \ Store the Y-th byte of the bulb bitmap in screen \ memory DEY \ Decrement the loop counter BPL BULL2 \ Loop back to poke the next byte until we have done \ all 16 bytes across two character blocks
LDA #&98 \ Set A to the low byte of the screen address of the \ E.C.M. bulb (which is at &7C98) LDX #LO(ECBT) \ Set X to the low byte of the address of the character \ definition in ECBT LDY #&7C \ Set Y to the high byte of the screen address of the \ E.C.M. bulb (which is at &7C98) BNE BULB \ Jump down to BULB (this BNE is effectively a JMP as \ A will never be zero)

Code variation 5 of 5Specific to an individual platform

This variation is blank in the Cassette, Disc (flight) and Electron versions.

Tap on a version to expand it, and tap it again to show to all variations.

Master

6502SP

BMI BULB2 \ Jump to BULB2 to switch main memory back into \ &3000-&7FFF and return from the subroutine (this BMI \ is effectively a JMP as we just passed through the BPL \ above)
JMP PUTBACK \ Jump to PUTBACK to restore the USOSWRCH handler and \ return from the subroutine using a tail call
RSS Feed