Skip to navigation

Elite on the BBC Micro

Start and end: TITLE (Disc version)

Name: TITLE [View in context] Type: Subroutine [Compare versions] Category: Start and end Summary: Display a title screen with a rotating ship and prompt
Display the title screen, with a rotating ship and a text token at the bottom of the screen. Arguments: A The number of the recursive token to show below the rotating ship (see variable QQ18 for details of recursive tokens) X The type of the ship to show (see variable XX21 for a list of ship types) Returns: X If a key is being pressed, X contains the internal key number, otherwise it contains 0
.TITLE PHA \ Store the token number on the stack for later STX TYPE \ Store the ship type in location TYPE JSR RESET \ Reset our ship so we can use it for the rotating \ title ship LDA #1 \ Clear the top part of the screen, draw a white border, JSR TT66 \ and set the current view type in QQ11 to 1 DEC QQ11 \ Decrement QQ11 to 0, so from here on we are using a \ space view LDA #96 \ Set nosev_z hi = 96 (96 is the value of unity in the STA INWK+14 \ rotation vector) LDA &9F \ As part of the copy protection, location &9F is set to CMP #219 \ 219 in the OSBmod routine in elite-loader3.asm. This BEQ tiwe \ jumps to tiwe if the value is unchanged, otherwise it \ crashes the game with the following (as presumably \ the game code has been tampered with) LDA #&10 \ Modify the STA DELTA instruction in RES2 to &10 &FE, STA modify+2 \ which is a BPL P%-2 instruction, to create an infinite LDA #&FE \ loop and hang the game STA modify+3 .tiwe STA INWK+7 \ Set z_hi, the high byte of the ship's z-coordinate, \ to 96, which is the distance at which the rotating \ ship starts out before coming towards us LDX #127 STX INWK+29 \ Set roll counter = 127, so don't dampen the roll STX INWK+30 \ Set pitch counter = 127, so don't dampen the pitch INX \ Set QQ17 to 128 (so bit 7 is set) to switch to STX QQ17 \ Sentence Case, with the next letter printing in upper \ case LDA TYPE \ Set up a new ship, using the ship type in TYPE JSR NWSHP LDY #6 \ Move the text cursor to column 6 STY XC LDA #30 \ Print recursive token 144 ("---- E L I T E ----") JSR plf \ followed by a newline LDY #6 \ Move the text cursor to column 6 again STY XC INC YC \ Move the text cursor down a row LDA PATG \ If PATG = 0, skip the following two lines, which BEQ awe \ print the author credits (PATG can be toggled by \ pausing the game and pressing "X") LDA #13 \ Print extended token 13 ("BY D.BRABEN & I.BELL") JSR DETOK .awe LDA brkd \ If brkd = 0, jump to BRBR2 to skip the following, as BEQ BRBR2 \ we do not have a system error message to display INC brkd \ Increment the brkd counter LDA #7 \ Move the text cursor to column 7 STA XC LDA #10 \ Move the text cursor to row 10 STA YC \ The following loop prints out the null-terminated \ message pointed to by (&FD &FE), which is the MOS \ error message pointer - so this prints the error \ message on the next line LDY #0 \ Set Y = 0 to act as a character counter JSR OSWRCH \ Print the character in A (which contains a line feed \ on the first loop iteration), and then any non-zero \ characters we fetch from the error message INY \ Increment the loop counter LDA (&FD),Y \ Fetch the Y-th byte of the block pointed to by \ (&FD &FE), so that's the Y-th character of the message \ pointed to by the MOS error message pointer BNE P%-6 \ If the fetched character is non-zero, loop back to the \ JSR OSWRCH above to print it, and keep looping until \ we fetch a zero (which marks the end of the message) .BRBR2 JSR CLYNS \ Clear the bottom three text rows of the upper screen, \ and move the text cursor to column 1 on row 21, i.e. \ the start of the top row of the three bottom rows. \ It also returns with Y = 0 STY DELTA \ Set DELTA = 0 (i.e. ship speed = 0) STY JSTK \ Set JSTK = 0 (i.e. keyboard, not joystick) PLA \ Restore the recursive token number we stored on the \ stack at the start of this subroutine JSR DETOK \ Print the extended token in A LDA #12 \ Set A to extended token 12 LDX #7 \ Move the text cursor to column 7 STX XC JSR DETOK \ Print extended token 12 ("({single cap}C) ACORNSOFT \ 1984") .TLL2 LDA INWK+7 \ If z_hi (the ship's distance) is 1, jump to TL1 to CMP #1 \ skip the following decrement BEQ TL1 DEC INWK+7 \ Decrement the ship's distance, to bring the ship \ a bit closer to us .TL1 JSR MVEIT \ Move the ship in space according to the orientation \ vectors and the new value in z_hi LDA #128 \ Set z_lo = 128, so the closest the ship gets to us is STA INWK+6 \ z_hi = 1, z_lo = 128, or 256 + 128 = 384 ASL A \ Set A = 0 STA INWK \ Set x_lo = 0, so the ship remains in the screen centre STA INWK+3 \ Set y_lo = 0, so the ship remains in the screen centre JSR LL9 \ Call LL9 to display the ship DEC MCNT \ Decrement the main loop counter LDA VIA+&40 \ Read 6522 System VIA input register IRB (SHEILA &40) AND #%00010000 \ Bit 4 of IRB (PB4) is clear if joystick 1's fire \ button is pressed, otherwise it is set, so AND'ing \ the value of IRB with %10000 extracts this bit BEQ TL2 \ If the joystick fire button is pressed, jump to TL2 JSR RDKEY \ Scan the keyboard for a key press BEQ TLL2 \ If no key was pressed, loop back up to move/rotate \ the ship and check again for a key press RTS \ Return from the subroutine .TL2 DEC JSTK \ Joystick fire button was pressed, so set JSTK to &FF \ (it was set to 0 above), to disable keyboard and \ enable joysticks RTS \ Return from the subroutine