Classic Computer Magazine Archive START VOL. 5 NO. 3 / NOVEMBER 1990

CYBER CORNER

PIXELS AND BYTES

Basic ST Graphics

BY ANDREW REESE, START GRAPHICS EDITOR


When the computing world first saw Atari's ST in 1985, most commentators were delighted to see such graphics power in a reasonably priced machine. Now, five years later, ST graphics are still quite acceptable; indeed, except for hardcore graphics junkies, ST owners are happy with what the little gray box can do. In this column in the months to come, we're going to take a look at the graphics that made the ST so popular - what they are, how to use them and what's coming.

pixelsandbytes.jpg
The left side of the Golden Gate Bridge has been
distorted to demonstrate the difference in smooth-
ness due to resolution.

We're going to begin with a review of some basic computer-graphics principles and how the ST handles graphics and displays images. If this sounds old hat to you, stick with us for a few paragraphs; we just may surprise you.


Color and Monochrome

Like most personal computers, the ST can display images in both color and monochrome (black-and-white). But unlike most computers, Atari can drive either type of display right out of the box. On an IBM PC or clone, you have to specify which type of display you want and then pay for a display card and monitor to fit your needs. The situation in the Macintosh world is even worse: color is not even available on the vast majority of Macs. If you want Mac color, you have to be prepared to pay big bucks for a Mac II-series machine. It's the reverse on the Commodore Amiga; it was designed as a color machine from the start.

So the ST is a pretty unique bird, as graphics go. Moreover, the ST offers two color-graphics modes, not just one. This is nice and versatile, but you may have asked yourself why Atari chose these particular modes. To understand why, we need to take a look at how the ST manages its color display. (Don't worry, we aren't going into great detail at this time; let's just take the first few steps now.)


Picture Elements

Every computer display you're likely to see these days uses the concept of pixels, or picture elements. Pixels are an arbitrary division of the computer display screen into a matrix of x pixels across by y pixels down. Atari's color display is either 320 pixels across by 200 pixels down (low resolution) or 640 pixels across and 200 pixels down (medium resolution). The monochrome ST display is 640 pixels across by 400 pixels down.

In the last paragraph, we used the word arbitrary to describe the division of a computer display into pixels. In truth, it's far from arbitrary. A large number of factors go into choosing the screen display size - from processor speed, memory size and storage availability to display sync rate and bus width. Engineers must balance the need for the best possible display against the very real component costs of increased system speed or data-transfer rate. The higher the resolution (the more pixels across and down), the greater the number of data bits that represent that image within the computer's memory and the larger the file size for stored images. And that means more random access memory (RAM) chips and larger storage devices. In other words, more money.

As an example of how image size has long been related to computer memory (and cost), remember Atari's first 8-bit computers, the Atari 800 and 400? They came with eight kilobytes of RAM - that's right, 8K! And if you wanted to bring an 800 all the way up to a whole 32K, it only cost $800 or so, about what a 1040ST costs today. And for all that money, you could have just barely fit a single ST image into it.

Today, things are a bit different. RAM chips are relatively cheap and STs can store many images in memory at once. But the same cost vs. image quality equation still holds. Today's super-duper high-resolution image-processor systems typically use a "true color mega-pixel" display. That's 1,024 pixels across and 1,024 pixels down with 32 (or 24) bits of color information per pixel. A true color megapixel image with no compression will require some 4MB of memory or disk space. And so we're in the same position as the Atari 800 owners who could barely fit an ST image into their RAM: We could barely fit a true color mega-pixel image into a Mega 4's memory!

And just think about trying to move those 4MB images through a computer at any kind of speed. If you wanted to feed 30 frames per second of true color megapixel images to a monitor (30 fps is the typical television video frame rate), that would mean approximately one billion bits of data to be transferred each second! How could your ST's poor old 68000 central processor keep up? It clocks out at only about 8,000,000 single operations per second and even assuming that the 68000 could move a full 16 bits of data from memory to display with each clock tick, that would still be only about one-eighth of the speed necessary.


Everyone Wants More Bitplanes!

In the last section, we mentioned a true color display having 32 bits of color per pixel. What does that mean? Let's back up and start with monochrome displays; they're easier to understand. If we look at a typical monochrome display like the Atari SM124, it can have exactly two different colors on the screen, black and white. Every shape is actually composed of a combination of tiny black and white dots, or pixels, even gray-looking shaded fill patterns. Since the human eye can't distinguish between the tiny dots from a distance, they appear to blend together into a uniform gray color.

You must always remember that we're dealing with digital computers that, at their lowest level, only understand the binary number system. Binary numbers are made up of 1s and 0s and are based on the powers of two. Briefly, places in the binary system are assigned as follows, up to a decimal value of 64:

2 6 = 64 2 5 = 32 2 4 =16 2 3 = 8 2 2 = 4 2 1 = 2
1 1 1 1 1 1

Our monochrome choice of just two colors, can be represented by a single bit of data that takes either a 1 or 0 value. Eight bits make up a single byte, so we have the following arithmetic for a monochrome image file:

640 pixels across X 400 pixels down = 256,000 total pixels
256,000 pixels X one bit per pixel = 256,000 bits of data
256,000 bits / 8 bits per byte = 32,000 bytes of data

And surprise, surprise! Each and every uncompressed monochrome ST image file is 32,000 bytes, plus some additional bytes for certain other information. (Before you read on, try working out the math for a medium- or low-resolution color image.)

Medium-resolution color mode has four colors and, therefore, needs to have just enough bits assigned to each pixel to give four choices. It only takes two bits to give those four choices (which would look like 00, 01, 10 and 11).

640 pixels across X 200 pixels down = 128,000 total pixels
128,000 total pixels X two bits per pixel = 256,000 bits of data

Well, here we are again with 256,000 bits or 32,000 bytes of data per image.

Low-resolution color requires that each pixel be represented by enough bits to give 16 color choices. Looking at the table above, you can see that it requires four bits of color per pixel to give those 16 choices.

Now the math looks like this:

320 pixels across X 200 pixels down = 64,000 total pixels
64,000 total pixels X four bits per pixel = 256,000 bits of data

The same answer: 256,000 bits equals 32,000 bytes of data per image.

Now if you think that these numbers are the result of a series of remarkable coincidences, you're wrong. Atari's engineers knew the clock speed of the 68000, knew how fast they could move image data through their theoretical ST, knew how larger image sizes run up costs in all parts of a computer and knew that Jack Tramiel wanted to produce a great graphics computer at a low price. The engineers decided on the ST's three current modes to strike the best balance of performance and cost then available.

And what are those bitplanes we mentioned in the subhead above? Well, each set of bits per pixel can be visualized as a row of 1s and 0s stretching back behind its associated pixel in place on the screen. All of the first set of bits back from the screen would be in a single plane and all of the 32nd bits back would be in the 32nd bit plane. And that's why you hear of bitplanes and why the more you have, the better! By the way, you'll also hear of color being referred to as, "16 bits deep." If you think of the string of 1s and 0s behind each pixel, you can figure out where this phrase came from.


Next Time

Next time, we'll go deeper into bitplanes and look at other types of displays. Before we do, though, try calculating the exact number of data bytes in the megapixel display we talked about above. And, assuming that we need 24 of those 32 bits per pixel for color information, how many possible colors can we display at once on a single screen? (Careful, there's a trick here!)

Andrew Reese is the START Graphics Editor and was Editor of START for nearly two years. He's now the manager of the multimedia technical publications department of a large San Francisco Bay Area software firm, and still loves his ST.