Character font
This code from block 854 is loaded into node 514. It provides access to memory sufficient to store the 5x7 font for 27 characters: blank 0-9 a-p.
The design of a font is a balance between size and legibility. This seems to work.
go
An infinite loop:
- Fetch character from left (513)
- Compute address: font is 2 words/char starting at address 0a
- Address into a
- If greater than 3f, ask right (515) for font
- Send 2 words back to left
Fetching the words on the last line is the same whether they come from 514's RAM or from 515's port.
The offset of 0a lets the font wrap smoothly from 514 to 515.
Font
This 5x7 font was designed by Greg many years ago. Each character is represented here in hex as 7 bytes, 4 in the first word, 3 in the second (right justified). Reading from left to right they are the 5 bits (again right justified) of a character from top to bottom. The bits also read from left to right. The word g, tells the compiler how to pack 2 32-bit numbers into 2 18-bit ones.
The resulting 36-bit format is:
- The sign bit of the first word specifies a descender if set
- 3 5-bit fields
- A field with 2 bits in the first word and 3 bits in the second
- 3 more 5-bit fields