Skip to navigation

Elite on the BBC Micro

Start and end: TITLE (Master 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 extended token to show below the rotating ship (see variable TKN1 for details of recursive tokens) X The type of the ship to show (see variable XX21 for a list of ship types) Y The distance to show the ship rotating, once it has finished moving towards us Returns: X If a key is being pressed, X contains the ASCII code of the key pressed
.TITLE STY SDIST \ Store the ship distance in SDIST 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 JSR U% \ Call U% to clear the key logger JSR ZINF \ Call ZINF to reset the INWK ship workspace LDA #32 \ Set the mode 1 palette to yellow (colour 1), white JSR DOVDU19 \ (colour 2) and cyan (colour 3) LDA #13 \ Clear the top part of the screen, draw a white border, JSR TT66 \ and set the current view type in QQ11 to 13 (rotating \ ship view) LDA #RED \ Switch to colour 2, which is white in the title screen STA COL LDA #0 \ Set QQ11 to 0, so from here on we are using a space STA QQ11 \ view LDA #96 \ Set nosev_z hi = 96 (96 is the value of unity in the STA INWK+14 \ rotation vector) LDA #96 \ Set A = 96 as the distance that the ship starts at 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 LDA #6 \ Move the text cursor to column 6 STA XC LDA #30 \ Print recursive token 144 ("---- E L I T E ----") JSR plf \ followed by a newline LDA #10 \ Print a line feed to move the text cursor down a line JSR TT26 LDA #6 \ Move the text cursor to column 6 again STA XC 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 LDY #0 \ Set DELTA = 0 (i.e. ship speed = 0) STY DELTA STY JSTK \ Set JSTK = 0 (i.e. keyboard, not joystick) LDA #20 \ Move the text cursor to row 20 STA YC LDA #1 \ Move the text cursor to column 1 STA XC 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 #7 \ Move the text cursor to column 7 STA XC LDA #12 \ Print extended token 12 ("({single cap}C) ACORNSOFT JSR DETOK \ 1986") LDA #12 \ Set CNT2 = 12 as the outer loop counter for the loop STA CNT2 \ starting at TLL2 LDA #5 \ Set the main loop counter in MCNT to 5, to act as the STA MCNT \ inner loop counter for the loop starting at TLL2 STZ JSTK \ Set JSTK = 0 (i.e. keyboard, not joystick) .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 LDX SDIST \ Set z_lo to the distance value we passed to the STX INWK+6 \ routine, so this is the closest the ship gets to us LDA #0 \ Set x_lo = 0, so the ship remains in the screen centre STA INWK 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 IF _SNG47 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 ELIF _COMPACT JSR RDFIRE \ Call RDFIRE to check whether the joystick's fire \ button is being pressed BCS TL2 \ If the C flag is set then the joystick fire button \ is being pressed, so jump to TL2 ENDIF IF _SNG47 BEQ TL2 \ If the joystick fire button is pressed, jump to TL2 ENDIF 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