Skip to navigation

Revs on the BBC Micro

Screen mode: screenRegisters

Name: screenRegisters [Show more] Type: Variable Category: Screen mode Summary: The 6845 registers for the custom screen mode Deep dive: Hidden secrets of the custom screen mode
Context: See this variable in context in the source code References: This variable is used as follows: * SetCustomScreen calls screenRegisters

The custom screen mode used during the race is based on standard mode 5, but with the following differences: * Horizontal sync position = 45 instead of 49 * Vertical displayed = 26 instead of 32 * Vertical sync position = 32 instead of 34 * Screen memory start = &5A80 instead of &5800 So essentially it is a shorter mode 5 that takes up less memory, adjusts the vertical and horizontal sync positions accordingly, and lives in screen memory from &5A80 to &7AFF (as there are 26 character rows of 40 characters, with 8 bytes per character, giving 26 * 40 * 8 = 8320 bytes of screen memory, and &5A80 + 8320 = &7B00).
.screenRegisters EQUB 63 \ Set 6845 register R0 = 63 \ \ This is the "horizontal total" register, which sets \ the horizontal sync frequency, i.e. the number of \ horizontal characters minus one. This value is the \ same as in standard mode 5 EQUB 40 \ Set 6845 register R1 = 40 \ \ This is the "horizontal displayed" register, which \ defines the number of character blocks per horizontal \ character row. This value is the same as in standard \ mode 5 EQUB 49 \ Set 6845 register R2 = 45 \ \ This is the "horizontal sync position" register, which \ defines the position of the horizontal sync pulse on \ the horizontal line in terms of character widths from \ the left-hand side of the screen. For comparison this \ is 49 for mode 5, but is adjusted for our custom \ screen EQUB &24 \ Set 6845 register R3 = &24 \ \ This is the "sync width" register, which sets the \ horizontal sync width in characters using the low \ nibble (i.e. 4), and the vertical sync width in the \ high nibble (i.e. 2). These values are the same as in \ standard mode 5 EQUB 38 \ Set 6845 register R4 = 38 \ \ This is the "vertical total" register, which contains \ the integer part of the vertical sync frequency minus \ one. This value is the same as in standard mode 5 EQUB 0 \ Set 6845 register R5 = 0 \ \ This is the "vertical total adjust" register, which \ contains the fractional part of the vertical sync \ frequency. This value is the same as in standard mode \ 5 EQUB 26 \ Set 6845 register R6 = 26 \ \ This is the "vertical displayed" register, which sets \ the number of displayed character rows to 26. For \ comparison, this value is 32 for standard modes 4 and \ 5, but we claw back six rows for storing code above \ the end of screen memory EQUB 32 \ Set 6845 register R7 = 32 \ \ This is the "vertical sync position" register, which \ determines the vertical sync position with respect to \ the reference, programmed in character row times. For \ comparison this is 34 for mode 5, but needs to be \ adjusted for our custom screen's vertical sync EQUB %00000001 \ Set 6845 register R8 = %00000001 \ \ This is the "interlace and display" register, which \ sets the following, reading from bit 7 to bit 0: \ \ %00 = no delay in the cursor blanking signal \ %00 = no delay in the display blanking signal \ %00 = not used \ %01 = interlace sync mode \ \ These values are the same as in standard mode 5 EQUB 7 \ Set 6845 register R9 = 7 \ \ This is the "scan lines per character" register, and \ contains the number of scan lines per character row, \ including spacing, minus one. This value is the same \ as in standard mode 5 EQUB %01100111 \ Set 6845 register R10 = %01100111 \ \ This is the "cursor start" register, which sets the \ following, reading from bit 7 to bit 0: \ \ %0 = not used \ %1 = enable blink feature \ %1 = set blink frequency to 32 times the field rate \ %00111 = cursor end scan line \ \ These values are the same as in standard mode 5 EQUB 8 \ Set 6845 register R11 = 8 \ \ This is the "cursor end" register, which sets the \ cursor end scan line. This value is the same as in \ standard mode 5 EQUB &0B \ Set 6845 register R12 = &0B and R13 = &50 EQUB &50 \ \ This sets 6845 registers (R12 R13) = &0B50 to point \ to the start of screen memory in terms of character \ rows. There are 8 pixel lines in each character row, \ so to get the actual address of the start of screen \ memory, we multiply by 8: \ \ &0B50 * 8 = &5A80 \ \ So this sets the start of screen memory to &5A80