Character Generation


R represented in dot matrix

character_gen1.jpg

Figure 4.

When you turn on your Atari, the word READY appears. We know that the letters of READY have to be made out of dots with color and luminance.

Figure 4 shows an R with a grid on top of it. Wherever in that grid the R crosses a square, the square is filled up. Thus we get a rough "R" from the shape of the squares. These squares can be thought of as dots. If we send the TV this pattern, line by line, by having it turn on the filled-in dots and leave the others off, an "R" will appear on the screen. Since we've broken the "R" up into eight horizontal segments, the "R" on the TV screen will be eight scan lines high.

Triangle as character

character_gen3.jpg

Figure 5.

"READY" is just a bit more difficult. We must first send the top "slice" of "R", then the top slice of "E", then "A", "D", "Y", then finish out the scan line, then produce the next slice of the "R", and so forth. After eight scan lines are done, we will have our "READY" on the TV screen. We have no choice about what order the lines are plotted in (left to right, top to bottom.)

We can display any character we want, or any shape, through these methods. For example, if we wanted to display a triangle, we'd split it up into horizontal segments and send its parts as dots (Figure 5).

Switch on your Atari and examine the READY characters. You'll be able to see the scan lines and individual dots if the picture is sharp and clear.

The Atari must refresh the TV screen 60 times each second, or the dots will stop glowing and fade away. In order to regenerate the screen, the Atari must have a copy of the information on the screen internally to send 60 times per second. The Atari saves a copy of the current TV image in memory.

R as dot-matrix and bit patterns

character_gen2.jpg character_gen7.jpg

Figure 6.

Let's find out how this can be done. The Atari is trying to represent the letter "R" in memory. It thinks of an "R" as a group of eight horizontal slices of eight on/off dots. Now this corresponds nicely to our concept of bits. An unlit dot can be represented by a 0 bit, and a lit dot is represented by a 1 bit. Since there are eight bits in each slice, there is one byte (8 bits) per slice. (Do you believe in coincidences?) So let's go back to our figure of the "R" broken up into slices and represent it as bits/bytes instead (Figure 6).

It takes 8 bytes, each composed of 8 bits, to store the shape of the "R" in the Atari's memory. When refresh time comes around, the Atari takes the first byte, sends it to the display as a blank dot for each 0 bit, and a lit dot for each 1 bit. After completing the rest of the scan line, it uses the second byte, and so forth, of the "R". After 8 scan lines are done, and 8 bytes, it is finished with the "R". The "EADY" characters are also stored in memory as shapes, represented by 8 bytes each.

character_gen4.jpg

Figure 7.

If the Atari used this approach, we would need 8 bytes for each character on the screen. There are 40 characters per line, and 24 lines, totaling 960 characters, with 8 bytes per character. That is 7,680 bytes.

In order to clear up any confusion, we will use an analogy. Imagine a chessboard with 40 squares across and 24 down. On each square we put one letter. This is the Atari's "display memory", where we save a copy of what's on the display screen for refresh purposes. When the Atari needs to do a refresh each sixtieth of a second, it starts at the upper left hand corner of the chessboard, and finds an "R" stored there. It sends that to the display, along with the "EADY" in the squares next to it. In order to save the shape of each character in the square, we need 8 bytes per character (Figure 7). Consider the chessboard as stored in memory a row at a time, in one long line, near the end of RAM.

This approach to display memory is called "bit mapping". The name refers to the fact that every bit in display memory corresponds to one unique dot on the screen. (The bit is "mapped" onto the screen). It gives you the capability of controlling every display dot by modifying the memory. (How many dots? Since there are 40 characters across, and 8 dots per character, there are 320 dots across one scan line of the screen. There are 24 rows, 8 scan lines vertically each, for a total of 192 scan lines.) There is just one problem with this approach, and that's the amount of memory required to do things this way.

character_gen8.jpg

Figure 8.

Memory is a scarce commodity on any computer. At the retail price, 16,000 bytes will cost you $99. Dedicating nearly 8,000 bytes to display memory is not very good if it can be avoided. That would be one sixth of the total memory even if you have spent the money to get the full 48K. That memory is needed for other purposes, such as storing your Basic programs.

Remember in our chessboard (memory), we are saving the shape of every letter. There's going to be a lot of redundancy. There is a number of "space" characters on the screen most of the time, each of them occupying 8 bytes. What we could do is define the shape of each character once, then in our display memory, tell the Atari where to look for the shapes of each character. The shapes of these characters do not change, so we can store them in the ROM operating system cartridge and not use the limited RAM.

Our "chessboard" used to have 8 bytes per square, saving the shape of a character. Instead of 8 bytes, let's use one. A byte can store a number from 0 to 255. For each possible character the Atari can generate, we will assign a unique number. Atari does it this way: A is 33, B is 34, and so on. (For READY: 50, 37, 33, 36, 57). Other characters, such as commas or asterisks, have their own numbers. We save those numbers in the chessboard.

character_gen9.jpg

Figure 9.

The operating system ROM cartridge has a complete table of character shapes, 8 bytes per character. Given a character number stored in display memory, the Atari can determine the character's shape. From that shape the letter is displayed.

Our 40 X 24 chessboard now has numbers in it. In the upper left hand corner the first five numbers are: 50, 37, 33, 36, 57 (Figure 8). The Atari knows these numbers to be READY, because the display list instruction identifies this as a character mode while the shape-table identifies which characters and then generates the display. Let's calculate the RAM memory we are using with this technique: one byte per character, with 960 characters (40 X 24), means 960 bytes used. This is one eighth of what we used before with the "bit mapping" approach. Because of this efficiency, this is the approach the Atari uses. The first 40 bytes of display memory represent the characters on the first row of the display screen, the next 40 bytes the second row, and so on. Spaces are characters by themselves represented in display memory by a 0 byte.

Let's go through the process of displaying "READY". The Atari determines that it is time for a screen refresh. It starts with the uppermost scan line on the screen. In that line it starts with the left character's top slice. It looks to the display memory chessboard, and finds a 50 there. It looks up the 50 in its collection of character shapes, and finds the shape "R". It outputs to the display the top slice of the "R", composed of eight on-off dots from the top byte of "R". The display gets this information, composed of a group of color and luminance information, and it displays the first eight dots. The Atari sees the 37, looks it up ("E"), sends the top slice of it, and so on. It finishes the other characters, "ADY" on the first scan line, then goes on and finishes that scan line by displaying the spaces. For the second scan line on the screen, it uses the second slice of the "R", then the "EADY", and so on. After eight scan lines, it is finished with the first row of characters. It repeats this process 24 times, for there are 24 rows on the screen. This entire process is completed 60 times every second (Figure 9).

Table of Contents
Previous Section: How A TV Works
Next Section: Dot Graphics Line