BBC Fonts

Text on the BBC Micro is drawn from an 8×8 character set. Any character can be redefined to your own shape with a single VDU 23 command, which makes the font both a way to change text and a source of tiles for games. MODE 7 is the exception: it uses the teletext chip's own character ROM instead.

BBC Fonts

Overview

In the bitmap MODEs each character is an 8×8 cell drawn from eight bytes, one byte per pixel row. When you print a character the OS copies these eight bytes into the display file at the current text position, packed into the MODE's pixel form. Because the definitions live in RAM, redefining one changes every later use of that character at no extra cost, so games treat characters as ready-made 8×8 shapes.

Character format

A character is eight consecutive bytes. The first byte is the top row of the character and the last byte the bottom row. In each byte a set bit is a pixel drawn in the foreground colour, and the most significant bit is the leftmost pixel.

ByteRowBits (bit 7 = left)
0Top8 pixels of row 0
1–6Middlerows 1 to 6
7Bottom8 pixels of row 7

Most built-in glyphs leave the bottom row and the rightmost column blank so that printed characters have natural spacing between them.

Redefining characters

The command VDU 23,c,r0,r1,r2,r3,r4,r5,r6,r7 redefines character c. The eight values r0 to r7 are the eight rows top to bottom, each a byte with bit 7 as the leftmost pixel. After the command, every print of that code uses the new shape. This is the whole mechanism: no pointer to move and no table to copy, just one VDU sequence per character.

PartMeaning
23The redefine command
cCharacter code to change
r0Top row, bit 7 leftmost
r1–r6Middle rows
r7Bottom row

The character range

Characters run from code 32 to 255. Codes 32 to 126 are the printable ASCII set. By default the codes above 128 are duplicates or unassigned, and the OS reserves an area of RAM so a range of them, commonly 224 to 255, can be redefined for user shapes without disturbing normal text. To free a larger block, the *FX 20 command explodes the soft font so every character from 32 upward has its own RAM definition and can be changed.

CodesUse
32–126Printable ASCII text
224–255User-definable by default
32–255All redefinable after *FX 20

Mode 7 teletext

MODE 7 does not draw characters from the 8×8 soft font. It is a teletext display generated by the SAA5050 chip, which carries its own character ROM of letters, digits, symbols and 2×3 block-graphics shapes. The screen stores only 40×25 character codes in 1K, and the chip builds each glyph from its ROM as the picture is scanned. Because the shapes come from the SAA5050 rather than RAM, VDU 23 redefinition does not apply in MODE 7; instead control codes in the character stream switch colour, double height and graphics.