2 Customizing The Graphics Modes

Put Graphics Modes 1 And 2
At The Bottom Of Your Screen

R. Alan Belke

Most of you who are regular readers of COMPUTE! are familiar with the mixing of the graphics modes. The only problem is that you can't use a mode past its regular range. That is, if you wanted to use mode 1 past line 20 or mode 2 past line 10, you couldn't. So you were stuck putting text you wanted at the top of the screen or in the text window. Until now, that is!

What's The Display list?

First we'll look at the "display list" to see what it is and what it does. Figure 1 shows the display list for mode 3. You can verify this by running Program 1. Locations 560, 561 contain the starting address of the list.

Figure 1.

112,112,112,72,112,158,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,66,96,159,2,2,2, 65,78,158

The purpose of the list is to tell the computer how to display the information stored in the screen and/or text memories. Let's see how it does this. The first three bytes (112) set up the margin at the top of the screen. Next comes what I call an address byte (72), in this case, a mode 3 address byte. (Figure 2 shows what the address bytes are for each of the modes.) This byte pulls double duty. First, it sets the first line to mode 3. Then it tells the computer that the next two bytes contain the address of the screen memory.

Figure 2.

MODE          0  1  2  3  4  5  6  7  8
ADDRESS BYTE  66 70 71 72 73 74 75 77 79

The next 19 bytes (8) set one line each to mode 3. I call these mode 3 bytes. You get the value for these bytes by subtracting 64 from the address byte (72-64 = 8). From this, we can deduce that any byte with bit 6 on is an address byte. Also, notice that 19 mode 3 bytes with the mode 3 address byte give you 20 rows of mode 3, which fills the screen up to the text window.

For whatever mode you are in, you will have one address byte and the number of rows, minus one, regular bytes. For example, mode 7 will have a mode 7 address byte (77) and 79 regular mode 7 bytes, giving you 80 rows. To find out how many rows each mode has, check the "Table of Modes and Screen Formats." It's on the inside back cover of your Atari BASIC Reference Manual.

The Last Three Rows Of The Text Window

Now here's the important part. The next byte (66) is a mode 0 address byte. But, instead of the next two lines containing the address of the screen memory, they contain the address of the text editor memory. This is the start of the text window. Modes 1 through 8 use the screen memory. Mode 0 uses the text editor memory. As you may have already guessed, the next three bytes (2) are mode 0 bytes, giving us the last three rows of the text window. If we were in a full screen format, these last six bytes would not be here.

Now we are to the end of the list. This next byte (65) is also an address byte. But it has a special purpose. It tells the computer that it has reached the end of the list and that the next two bytes contain the starting address of the list. (The same as locations 560, 561. )

Before we go on, let me say that the bytes that contain the addresses may vary, depending on the mode you're in and on the amount of memory you have. All the other bytes will be the same.

So how do we get modes 1 and 2 on the bottom of the screen? It's simple! Basically, all we do is change the mode 0 bytes to mode 1 or 2 bytes. Presto! The computer now displays the text editor memory in modes 1 or 2.

Let's look at Program 2 to see how this is done:

Line 10: sets the margins to 40 characters per line and selects mode 3 with text window. Then it finds the address of the display list.
Line 20: searches the list for the start of the text window.
Line 30: changes the mode 0 bytes to mode 1 bytes.

There are a few things to be aware of. Even though you are using modes 1 and 2, you're using the text editor memory; so the computer thinks in 40-column, not 20-column, lines, which means two lines now equal one old line. Here is an example. Suppose we use an empty PRINT statement, planning to leave a blank line. Sorry, it won't work. We would have two blank lines. What we do is put 20 spaces in front of what we want printed on the second line. Also remember that we are using the text editor, so PRINT #6 will not work. Try some different things yourself.

What About Mode Two?

Well, that's almost as simple. Mode 2 lines are twice as wide as modes 1 and 0; so there are only two combinations using mode 2 possible: two rows of mode 2 or one row of mode 2 with two rows of mode 1. We can use only the amount of room that was originally there. Program 3 uses the latter option from above:

Lines 10-20: same as Program 2.

Line 30: basically the same as in Program 2; only this time we make the second line mode 2. And, since we use one less byte, we have to move the end of the list one location forward.

By now you should be able to change the text window into any combination of modes 1 and 2 you want. If you have a program that would work better with the text at the bottom of the screen or the text window as modes 1 or 2, get to work, experiment! Remember, you're the boss.

Download P039L1.BAS (Saved BASIC)
Download / View P039L1.LST (Listed BASIC)
Download P039L2.BAS (Saved BASIC)
Download / View P039L2.LST (Listed BASIC)
Download P039L3.BAS (Saved BASIC)
Download / View P039L3.LST (Listed BASIC)

Return to Table of Contents | Previous Section | Next Section