Basics of Character Generation

by Donald Gaminitillake
In early Basic Programming all alphanumeric characters - and graphic symbols – were stored in RAM memory in form of eight –bit codes (usually ASCII) so that one character occupies one byte.
When information is printed on the screen, the codes for each character are put into a reserved area of memory called the ‘video RAM’. If for example, the letter A is printed in the top left hand corner of the screen, the first byte of video RAM will contain the code 65 (ASCII for A). If a C is printed below A, the computer has a 40 column screen, then the value 67 will be found in the 41st location of video RAM, and so on. How does the computer convert the value 65 into the pattern of dots that makes up the character A on the screen? The answer lies in a device called a “Character Generator”
A character generator is a simply a collection of patterns stored as bits in memory. Home computers have the character generator stored in ROM – thus permitting an immediate display of characters when the machine is switched on. The character generator may be incorporated into the ROM with the operating system, or it may be on its own ROM chip. However machines permits the character generator to be transferred into RAM, which allows the programmer to design his own characters and symbols.
All characters are constructed on a matrix of dots, early stages this was eight by eight, although a larger matrix would result in greater legibility and wider range of displayable characters. Characters are designed by filling in squares on the grid. They were defined by representing each filled square with a 1, and blank squares with a 0, giving a total of 6 bits, or eight bytes for each character.
The first byte in the character generator would represent the bit pattern for the top line of the first character in the table. If the computer can display only the ASCII characters with codes from0 to 127, then the character generator will require 128x8 bytes (1 Kbytes of memory)
The difficulty for the computer is that when the rater scan on the television screen is generating the topmost line of the display, it needs to produce the topmost line of dots for the character positioned at the top left of the screen, followed by the topmost line of character positioned to the right of it, and soon across the screen. Then when the rater scan starts the second pass , it must find and display the second line for each of the characters on the top row of the screen.
The video circuitry achieves this by having two independent counters. One counter keeps track of which location in the video memory corresponds to the point that raster scan is passing over. The other counts the raster scan lines, starting at zero for the first line and reaching seven for the eight, then resetting the zero on the ninth, and so on. Thus computer looks up the ASCII or display code from the video memory, multiplies it by eight and adds on the current value of the line counter. This gives it an address in the character generator for the eight-bit pattern that corresponds to the correct row of the character it is currently scanning.
Let’s take the example of generating the character A, which has an ASCII code of 65. We can calculate that the first line of the character will be stored in byte number 520 (65x8+1); the second line in byte 521 (65x8+1); the third line in byte 522 (65x8+2); and so on. All that remains is for the video circuitry to convert those eight bits into a sequence of voltages that will switch the scanning electron beam on and off to display the pattern on the screen.
Complex characters
Sinhala characters can be quite complicated, and the usual 8x8 matrix cannot display enough details to make them readable. Better charity for Sinhala characters can be obtained by using a 24x24 matrix or above with proper published values for all Sinhala characters in the SLSI.



Post new comment