Skip to navigation


Flight: MESS

[BBC Master version]

Name: MESS [Show more] Type: Subroutine Category: Flight Summary: Display an in-flight message
Context: See this subroutine in context in the source code Variations: See code variations for this subroutine in the different versions References: This subroutine is called as follows: * EXNO2 calls MESS * FR1 calls MESS * Ghy calls MESS * KILLSHP calls MESS * Main flight loop (Part 8 of 16) calls MESS * Main flight loop (Part 12 of 16) calls MESS * Main flight loop (Part 15 of 16) calls MESS * me2 calls MESS * ou2 calls MESS * ou3 calls MESS * OUCH calls MESS * SFRMIS calls MESS

Display an in-flight message in capitals at the bottom of the space view, erasing any existing in-flight message first.
Arguments: A The text token to be printed
.MESS PHA \ Store A on the stack so we can restore it after the \ following LDX QQ11 \ If this is the space view, skip the following BEQ infrontvw \ instruction 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 .infrontvw LDA #21 \ Move the text cursor to row 21 STA YC LDA #YELLOW \ Switch to colour 1, which is yellow STA COL LDX #0 \ Set QQ17 = 0 to switch to ALL CAPS STX QQ17 LDA messXC \ Move the text cursor to column messXC, in case we STA XC \ jump to me1 below to erase the current in-flight \ message (whose column we stored in messXC when we \ called MESS to put it there in the first place) PLA \ Restore A from the stack LDY #20 \ Set Y = 20 for setting the message delay below CPX DLY \ If the message delay in DLY is not zero, jump up to BNE me1 \ me1 to erase the current message first (whose token \ number will be in MCH) STY DLY \ Set the message delay in DLY to 20 STA MCH \ Set MCH to the token we are about to display \ Before we fall through into mes9 to print the token, \ we need to work out the starting column for the \ message we want to print, so it's centred on-screen, \ so the following doesn't print anything, it just uses \ the justified text mechanism to work out the number of \ characters in the message we are going to print LDA #%11000000 \ Set the DTW4 flag to %11000000 (justify text, buffer STA DTW4 \ entire token including carriage returns) LDA de \ Set the C flag to bit 1 of the destruction flag in de LSR A LDA #0 \ Set A = 0 BCC P%+4 \ If the destruction flag in de is not set, skip the \ following instruction LDA #10 \ Set A = 10 STA DTW5 \ Store A in DTW5, so DTW5 (which holds the size of the \ justified text buffer at BUF) is set to 0 if the \ destruction flag is not set, or 10 if it is (10 being \ the number of characters in the " DESTROYED" token) LDA MCH \ Call TT27 to print the token in MCH into the buffer JSR TT27 \ (this doesn't print it on-screen, it just puts it into \ the buffer and moves the DTW5 pointer along, so DTW5 \ now contains the size of the message we want to print, \ including the " DESTROYED" part if that's going to be \ included) LDA #32 \ Set A = (32 - DTW5) / 2 SEC \ SBC DTW5 \ so A now contains the column number we need to print LSR A \ our message at for it to be centred on-screen (as \ there are 32 columns) STA messXC \ Store A in messXC, so when we erase the message via \ the branch to me1 above, messXC will tell us where to \ print it STA XC \ Move the text cursor to column messXC JSR MT15 \ Call MT15 to switch to left-aligned text when printing \ extended tokens disabling the justify text setting we \ set above LDA MCH \ Set MCH to the token we are about to display \ Fall through into mes9 to print the token in A