This code appears in the following versions (click to see it in the source code):
Code variations between these versions are shown below.
.LOADSCR LDA ZP \ Set ZP(1 0) = ZP(1 0) - (PROT1 - ECHAR) SEC \ = PROT1 - PROT1 + ECHAR SBC #LO(PROT1 - ECHAR) \ = ECHAR STA ZP LDA ZP+1 SBC #HI(PROT1 - ECHAR) STA ZP+1 LDX #0 \ Set S = 0, to use as a flag denoting whether this is a STX S \ BBC Micro (0) or an Electron (&FF) LDY #&FF \ Call OSBYTE with A = 129, X = 0 and Y = &FF to detect LDA #129 \ the machine type, which returns the following: JSR OSBYTE \ \ * X = 1 if this is an Electron CPX #1 \ If X <> 1 then this is not an Electron, so jump to bbc BNE bbc \ to skip the following DEC S \ Decrement S to &FF, to denote that this is an Acorn \ Electron \ We now define a character set consisting of "fake" \ mode 7 graphics characters so the Electron can print \ its own version of the Acornsoft loading screen \ despite not having the BBC Micro's teletext mode 7 \ \ The command to define a character is as follows: \ \ VDU 23, n, b0, b1, b2, b3, b4, b5, b6, b7 \ \ where n is the character number and b0 through b7 are \ the bytes for each pixel row in the character (there \ are 8 rows of 8 pixels in a character) \ \ So in the following, we perform the above command \ for each character using the values from the ECHAR \ table LDY #0 \ Set Y to act as an index into the table at ECHAR .eloop LDX #7 \ Set a counter in X for the 8 bytes we need to print \ from the table for each character definition (one byte \ per pixel row) LDA #23 \ Print character 23 (i.e. VDU 23) JSR OSWRCH TYA \ We will increase Y by 8 for each character, so this LSR A \ sets A = Y / 8 to give the character number, starting LSR A \ from 0 and counting up by 1 for each new character LSR A ORA #&E0 \ This adds &E0 to A, so our new character set starts \ with character number &E0, then character number &E1, \ and so on JSR OSWRCH \ Print the character number (so we have now done the \ VDU 23, n part of the command) .vloop LDA (ZP),Y \ Print the Y-th byte from the ECHAR table (we set ZP to JSR OSWRCH \ point to ECHAR above) INY \ Increment the index to point to the next byte in the \ table DEX \ Decrement the byte counter BPL vloop \ Loop back until we have printed 8 characters CPY #224 \ Loop back to do the next VDU 23 command until we have BNE eloop \ printed out the whole table .bbc \ We now print the Acornsoft loading screen background \ using mode 7 graphics (for the BBC Micro) or the \ "fake" characters we just defined (for the Electron \ version) LDA ZP \ Set ZP(1 0) = ZP(1 0) + LOGO - ECHAR CLC \ = ECHAR + LOGO - ECHAR ADC #(LOGO - ECHAR) \ = LOGO STA ZP BCC P%+4 INC ZP+1 LDA #22 \ Switch to mode 7 using a VDU 22, 7 command JSR OSWRCH LDA #7 JSR OSWRCH .jsr1 JSR prstr - PROT1 \ Call prstr to print the following characters, \ restarting from the NOP instruction (this destination \ address is modified by the code above that adds PROT1 \ to the address) EQUB 23, 0, 10, 32 \ Set 6845 register R10 = %00100000 = 32 EQUB 0, 0, 0 \ EQUB 0, 0, 0 \ This is the "cursor start" register, and bits 5 and 6 \ define the "cursor display mode", as follows: \ \ * %00 = steady, non-blinking cursor \ \ * %01 = do not display a cursor \ \ * %10 = fast blinking cursor (blink at 1/16 of the \ field rate) \ \ * %11 = slow blinking cursor (blink at 1/32 of the \ field rate) \ \ We can therefore turn off the cursor completely by \ setting cursor display mode %01, with bit 6 of R10 \ clear and bit 5 of R10 set NOP \ Marks the end of the VDU block LDA #145 \ Set T to teletext control code 145 (Red graphics) to STA T \ specify that the first Acornsoft is red .jsr2 JSR jsr6 - PROT1 \ Call jsr6, which calls jsr7, which calls LOGOS (this \ destination address is modified by the code above that \ adds PROT1 to the address)Name: LOADSCR Type: Subroutine Category: Loader Summary: Show the mode 7 Acornsoft loading screen
JSR prstr - PROT1 \ Call prstr to print the following characters, \ restarting from the NOP instruction (this destination \ address is modified by the code above that adds PROT1 \ to the address)
.jsr5 \ If we get here then this is an Electron JSR prstr - PROT1 \ Call prstr to print the following characters, \ restarting from the NOP instruction (this destination \ address is modified by the code above that adds PROT1 \ to the address)
.jsr6 JSR jsr7 - PROT1 \ Call jsr7 (this destination address is modified by the \ code above that adds PROT1 to the address). This calls \ the LOGOS routine twice to print two Acornsoft logos, \ with a newline between then JSR OSNEWL \ Print two newlines JSR OSNEWL .jsr7 JSR LOGOS - PROT1 \ Call LOGOS (this destination address is modified by \ the code above that adds PROT1 to the address). This \ prints a third Acornsoft logo JSR OSNEWL \ Print a newline \ Fall through into LOGOS to print a fourth Acornsoft \ logo and return from the subroutine using a tail call