Dot Graphics Lines
Remember our discussion of bit-mapped memory? That is how lines are produced on the Atari. We have one bit for each dot on the screen, and if that bit is "set" (1), the Atari switches on the corresponding dot on the TV. This uses a great deal of memory. The inside back cover of the Atari Basic Manual has a chart of the amount of RAM required for each graphics mode. Graphics 8 requires 7900 bytes. This compares with the value we calculated of 7,680 bytes. (The difference is due to various tables and other information the Atari must keep track of in this mode.) Also examine the number of displayable dots in X and Y directions. There are 320 horizontal dots and 192 scan lines. That's 40 characters X 8 dots per character (320), and 24 lines X 8 scan lines (192). You now should have a good idea of what happens inside the machine. Just eliminate the character squares on the chessboard, using the bytes per square technique, and you will have 320 X 192 dots, each one represented by one bit inside the Atari. The first scan line (320 dots) thus occupies 40 bytes (40 X 8 bits is 320 bits), the next scan line the next 40 bytes and so forth.
How does the Atari display a line? It turns on the dots on the screen that the line "passes over". It does this by turning on the bits in memory and letting the video refresh circuits use that memory to refresh the screen. Run program 3, and you will be able to see the individual dots light up and watch the line shift over discrete horizontal increments to draw a diagonal.
The Atari uses display memory in one of two fundamentally different ways; "character addressing" (reserving one byte per character where the number in that byte is a unique character number) or "bit mapping" (reserving one memory bit for each screen dot).
10 GRAPHICS 8+16 20 SETCOLOR 2,0,0 30 SETCOLOR 1,0,14 40 COLOR 1 50 PLOT 1,1 60 DRAWTO 319,1 70 DRAWTO 1,191 80 DRAWTO 1,1 90 GOTO 90
Program 3.
Another computer, the Apple, has "Lo-Res" graphics (which are character addressed) and "HiRes" graphics, which are bit-mapped. There is no middle ground, just one or the other. Many people, familiar with the Apple, ask about the Atari's "Hi-Res" graphics. They are thinking in Apple terms, and these just do not apply as well to the Atari. The answer to the above question is "which Hi-Res mode are you referring to?"
There are 14 different display operation modes in the Atari. Some are character addressed, some are bit-mapped, and some are in between. Let's restrict ourselves for now to the Basic graphics modes, which you are probably familiar with. We will return to the modes the Basic manual does not tell you about. All these different modes give you a great deal of flexibility and ease in doing complex graphics.
The character modes, 0, 1, and 2, are pretty easy to understand. Mode 0 we have been looking at. Mode 1 is just mode 0 characters stretched out to twice their width. Mode 2 is mode 0 characters stretched to twice their height and width. Since both 1 and 2 involve characters twice the width of graphics 0 characters, 8 X 2 16 dots wide, it will not surprise you to learn you can only fit half as many on one line (20). Modes 3-0 are graphics modes, and do not involve characters. In order to learn about them we will have to define a word, the "pixel".
A "pixel" is a group of screen dots that the Atari treats as one. They will all be the same color and will all be represented by just one memory location. If the single bit in memory that represents this group of dots is on, then the whole group is lit, and vice versa. Now, the size of a pixel is not fixed. Different graphics modes have different pixel sizes. A pixel can be as small as one dot or as large as 64 dots. Graphics 8 gives us the highest amount of control over the screen with one dot per pixel, allowing us to program every dot individually. In Graphics 3 each pixel is 8 rows of 8 dots. The size of the pixel determines the amount of graphics detail possible. Imagine a pixel to be a square of paper of varying size. A graphics 8 pixel would be the size of one TV dot. A graphics 3 pixel could be a quarter of an inch on a side. Everything going on the screen must be plotted using those squares. If you're using the larger squares, you are not going to be able to get a lot of detail. The smaller the square, the finer the detail you can draw with.
Fewer of the larger pixels can be fit on the TV at the same time, so it is reasonable to assume they will use less memory. If you will examine the graphics modes table on the back of the Atari manual, you will see this is the case. With finer detail and smaller pixels, more memory is used.
If you were drawing ten line bar graphs on the screen, you would not need fine detail. The pixels can be huge and it will not make any difference. If you are drawing a finely detailed picture, you will need small pixels and "high resolution", or fine control. In the first case, you can use a coarse detail graphics mode and not waste memory. Since the Atari has several modes, you can select the mode you need for the application and not be forced to use the highest resolution for all graphics.
The Atari manual states that only one graphics mode can be used at a time, with the option of putting a graphics 0 text window at the bottom of the screen. If you tried to mix them, and displayed data meant for graphics 0 in graphics 8, the character in the upper left hand corner, from READY, would be "R". In graphics mode 0, the "R" is represented by a 50, so the first byte of display memory would have that data in it. A 50 is a bit pattern of 0011 0010. If we switched to graphics 8, that would be the bit pattern we would have on the top scan line (blank, blank, dot, dot, blank, blank, dot, blank.) The other data in display memory would also be sent to the screen as random data. All data in display memory must be consistent with the graphics mode it was written in.
The Atari manual attempted to simplify matters for users and prevent them from having a lot of problems by announcing that graphics modes cannot be mixed. This is not so, but in mixing modes you have to know a lot about the machine and how televisions really work, and most people do not have that knowledge. The really fancy graphics capabilities, such as mixing modes, were left to Atari's own top programmers. That is what we are going to explore next.
We will set up a sample problem and solve it using mixed graphics modes. The problem is to draw a graph on the screen, titled with big letters, subtitled in small letters, with a finely detailed graphics plot and labels on the lower axis. You could do this all in the highest resolution mode, but you would be a lot older by the time you were finished. You would have to compose all the lettering out of individual dots, and that would take quite some time. Atari has taken a lot of the work out of this process and saved the programmer a lot of time.
Table of Contents
Previous Section: Character Generation
Next Section: ANTIC and CTIA