.SPBLBLDA#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 toLDX#LO(SPBT)\ Set (Y X) to point to the character definition in SPBTLDY#HI(SPBT)\ Fall through into BULB to draw the space station bulb
.SPBLBLDA#%00001111\ Set bits 1 and 2 of the Access Control Register atSTAVIA+&34\ SHEILA &34 to switch screen memory into &3000-&7FFF
.DOBULBTAX\ If the parameter to the #DOBULB command is non-zero,BNEECBLB\ i.e. this is a #DOBULB 255 command, jump to ECBLB to\ draw the E.C.M. bulb instead
.SPBLBLDA#&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 SPBTLDY#&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.
Tap on a block to expand it, and tap it again to revert.
LDA#16*8\ The space station bulb is in character block number 48STASC\ (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 toLDA#&7B\ Set the high byte of SC(1 0) to &7B, as the bulbs areSTASC+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 &7BFFLDY#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.BULL2LDASPBT,Y\ Fetch the Y-th byte of the bulb bitmapEOR(SC),Y\ EOR the byte with the current contents of screen\ memory, so drawing the bulb when it is already\ on-screen will erase itSTA(SC),Y\ Store the Y-th byte of the bulb bitmap in screen\ memoryDEY\ Decrement the loop counterBPLBULL2\ Loop back to poke the next byte until we have done\ all 16 bytes across two character blocks
LDA#16*8\ The space station bulb is in character block number 48STASC\ (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 toLDA#&7B\ Set the high byte of SC(1 0) to &7B, as the bulbs areSTASC+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 &7BFFLDY#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.BULLLDASPBT,Y\ Fetch the Y-th byte of the bulb bitmapEOR(SC),Y\ EOR the byte with the current contents of screen\ memory, so drawing the bulb when it is already\ on-screen will erase itSTA(SC),Y\ Store the Y-th byte of the bulb bitmap in screen\ memoryDEY\ Decrement the loop counterBPLBULL\ 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 block to expand it, and tap it again to revert.
.awayLDA#%00001001\ Clear bits 1 and 2 of the Access Control Register atSTAVIA+&34\ SHEILA &34 to switch main memory back into &3000-&7FFFRTS\ Return from the subroutine
JMPPUTBACK\ Jump to PUTBACK to restore the USOSWRCH handler and\ return from the subroutine using a tail call