Skip to navigation

Elite on the BBC Micro

Version analysis of SPBLB / DOBULB

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

Code variations between these versions are shown below.

Code variation 1 of 6A variation in the comments only

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

Cassette, Flight, Docked, Master, Electron

6502SP

Name: SPBLB
Name: DOBULB
Type: Subroutine Category: Dashboard

Code variation 2 of 6A variation in the comments only

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

Cassette, Flight, Docked, Master, Electron

6502SP

Summary: Light up the space station indicator ("S") on the dashboard
Summary: Implement the #DOBULB 0 command (draw the space station indicator bulb)


Code variation 3 of 6A variation in the comments only

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

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

Master

6502SP

Other entry points: BULB2 Switch main memory back into &3000-&7FFF and return from the subroutine
This routine is run when the parasite sends a #DOBULB 0 command. It draws (or erases) the space station indicator bulb ("S") on the dashboard.

Code variation 4 of 6Related to Elite's use of the Tube

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

Cassette, Flight, Docked

Master

6502SP

Electron

.SPBLB LDA #24*8 \ The space station bulb is in character block number 24 \ 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(SPBT) \ Set (Y X) to point to the character definition in SPBT LDY #HI(SPBT) \ Fall through into BULB to draw the space station bulb
.SPBLB 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
.DOBULB TAX \ If the parameter to the #DOBULB command is non-zero, BNE ECBLB \ i.e. this is a #DOBULB 255 command, jump to ECBLB to \ draw the E.C.M. bulb instead
.SPBLB LDA #&20 \ Set A to the low byte of the screen address of the \ space station bulb (which is at &7D20) LDX #LO(SPBT) \ Set X to the low byte of the address of the character \ definition in SPBT LDY #&7D \ Set Y to the high byte of the screen address of the \ space station bulb (which is at &7D20) \ Fall through into BULB to draw the space station bulb

Code variation 5 of 6Related to an advanced feature

The advanced versions have wider "E" and "S" dashboard indicators than the original versions.

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

6502SP, Master

LDA #16*8 \ The space station bulb is in character block number 48 STA SC \ (counting from the left edge of the screen), with the \ first half of the row in one page, and the second half \ in another. We want to set the screen address to point \ to the second part of the row, as the bulb is in that \ half, so that's character block number 16 within that \ second half (as the first half takes up 32 character \ blocks, so given that each character block takes up 8 \ bytes, this sets the low byte of the screen address \ of the character block we want to draw to LDA #&7B \ Set the high byte of SC(1 0) to &7B, as the bulbs are STA SC+1 \ both in the character row from &7A00 to &7BFF, and the \ space station bulb is in the right half, which is from \ &7B00 to &7BFF 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 .BULL LDA SPBT,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 BULL \ Loop back to poke the next byte until we have done \ all 16 bytes across two character blocks

Code variation 6 of 6Specific to an individual platform

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

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

Master

6502SP

.BULB2 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
JMP PUTBACK \ Jump to PUTBACK to restore the USOSWRCH handler and \ return from the subroutine using a tail call
RSS Feed