Skip to navigation

Revs on the BBC Micro

Text: PrintHeader

Name: PrintHeader [Show more] Type: Subroutine Category: Text Summary: Configure and print a double-height header in screen mode 7 Deep dive: Text tokens
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * GetWingSettings calls PrintHeader * MainLoop (Part 1 of 6) calls PrintHeader * PrintDriverTable calls PrintHeader * PrintToken calls PrintHeader

Prints a token as a double-height header, with the position and colours given in the header tables, and a specific number of spaces between the top and bottom parts of the double-height text (to ensure they line up). The tokens are formatted as follows: * Token 0 ("FORMULA 3 CHAMPIONSHIP") Column 4, row 3 Yellow on red 10 spaces * Token 1 (" POINTS ") Column 7, row 0 Yellow on red 15 spaces * Token 2 ("GRID POSITIONS") Column 9, row 0 White on magenta 19 spaces * Token 3 ("ACCUMULATED POINTS") Column 7, row 0 White on blue 15 spaces * Token 4 ("REVS REVS REVS") Column 0, row 4 The colours of each letter in REVS are magenta/yellow/cyan/green 2 spaces This token actually prints characters 141, 163, 157, 127 before printing token 4 (which it does twice, one for each part of the header). 127 is the DEL character, so this is the same as printing just 141 and 163, which sets double-height, and then shows graphics character 163. This latter character will blank as we are still in alphanumeric text mode... so overall this just displays a double-height token 4, as token 4 contains all the colour information for the individual letters * Token 5 ("THE PITS") Column 11, row 4 Blue on yellow 24 spaces * Token 6 (" BEST LAP TIMES ") Column 7, row 0 White on magenta 15 spaces Arguments: X The number of the token to print as a double-height header
.PrintHeader LDA xHeader,X \ Set the x-coordinate for the text in token 33 STA token33+2 LDA yHeader,X \ Set the y-coordinate for the text in token 33 STA token33+3 LDA headerSpaces,X \ Set the number of spaces in token 33 STA token33+5 LDA headerBackground,X \ Set the background colour in token 34 STA token34+1 LDA headerForeground,X \ Set the foreground colour in token 34 STA token34+3 TXA \ Set the token embedded in token 34 to token X CLC ADC #200 STA token34+4 LDX #33 \ Print token 33, which prints token 34 in double-height JSR PrintToken \ text with the colours and position configured above RTS \ Return from the subroutine EQUB &79, &7B \ These bytes appear to be unused EQUB &7C, &7D EQUB &7E