Classic Computer Magazine Archive ANTIC VOL. 5, NO. 11 / MARCH 1987

Rainbow Screen Customizer

Flashy displays for your programs

By James Hague

Rainbow Screen Customizer expands the color palette of Graphics 0 screens in your own programs to 24, instead of just the three colors usually available in this popular graphics mode. This BASIC programming utility works on all 8-bit Atari computers of any memory size.

Atari 8-bit computers are equipped with a palette of 128 vivid colors (Or 256 with a bit of programming gimmickry. See GTIA Rainbow in the March, 1984 Antic.) This is far more colors than most computers boast. Why then do Atari programs usually use only one or two colors, ignoring all that power? Because, in BASIC, it's difficult to have more than four colors on screen at once. To make matter worse, Graphics Mode 0 seems to be the most popular mode, and it's usually limited to three colors.

But now you can bypass these color barriers with user-friendly Rainbow Screen Customizer. This program lets you make each line of a Graphics 0 screen any of 128 distinct colors-- allowing up to an amazing 24 colors in all, and that's not even counting the border. Rainbow Screen Customizer also generates a BASIC subroutine that will recreate your own 24-color screen in any BASIC program.

HOW IT WORKS

Type in Listing 1, SCREEN.BAS, check it with TYPO II and SAVE a copy before you RUN it. To edit the colors of a GR. 0 screen, choose option one, View/Edit Screen, from the main menu. Move the joystick until the arrow is on the line that you want to edit. (The text on the screen will not be saved with your finished product. It's only there to help you design your color pattern.)

Press [START] to select one color for that line from a possible 16, holding it down to cycle though the available colors. The [SELECT] key changes the luminance of the current line to one of eight brightness levels. [OPTION] selects the character luminance for the line, also allowing eight settings. When you are satisfied with your colorful creation, a quick press of the joystick button recalls the main menu.

There are a few things to be aware of about the color combinations available. First, setting both the character luminance and line luminance to the same value renders any text on the line--including the arrow--invisible. Another important point is that the color of the characters cannot be chosen directly. Instead, the characters usually assume a shade relating to the line color. Except for these minor snags, you can mix and match colors to your heart's content.

USING CUSTOM SCREENS

A colorful screen is nice to look at, but what good is it unless you can spice up your latest programs with it? Imagine being able to divide the screen into separate horizontal color-coded windows, each having its own special function. For example, to bring attention to a message area at the bottom of the screen in a word processor, you could color it a vivid red. Applications like this are the purpose behind this program.

Programming a colorful screen from scratch is not a task for the faint of heart, but with Rainbow Screen Customizer it's a snap. You don't even have to understand how it works, just how to use it.

To create a BASIC subroutine that allows easy access to your customized screen, choose option two, Create Subroutine, from the main menu. You will be asked to enter the line number in your main program where you want your routine to start, and the line increment. (Entering 1000 and then 10 would start the subroutine at line 1000, with the next line being 1010, etc.)

Finally, enter a filename for the subroutine. The file will be in LISTed format, so use .LST as the extender to remind you. Then insert a formatted disk of any density, press a key, and sit back and relax while your subroutine is created automatically.

Now exit the program by choosing option three and LOAD the program to which you want to add the subroutine. Then ENTER the file you just created. You now have a subroutine to create a custom screen included as part of your program. If you want to LOAD the subroutine into memory by itself, type NEW and then ENTER it.

To access the custom screens within your own BASIC program, just GOSUB to the first line of the subroutine. This will take about two or three seconds to set up, after which a brand new GR. 0 screen will appear with the colors you have chosen.

The custom screen is disabled whenever a GRAPHICS command is executed, but another GOSUB brings it back. Fortunately, the subroutine is "intelligent"--if it's called more than once, it will "realize" this and set things up more quickly.

While the custom screen is enabled, the color registers will have no effect, except for the one that controls the border. A pre-defined variable, CTRL, lets you easily enable and disable the multi-colored screen at will. POKE CTRL,1 turns the screen on and POKE CTRL,0 turns it off. When disabled, the entire screen takes on the characteristics of line 0, but the color registers are active again.

WHOOPS!

I have run into two minor glitches with this program. But if a color screen is what you need, these restrictions should be easy to work around.

First, the keyclick sound interfaces with custom displays created by Rainbow Screen Customizer, making the screen shudder whenever a key is pressed, as well as making the click sound more like a quack. XL/XE owners can easily turn off the keyclick sound with POKE 731,255 and turn it back on with POKE 731,0. But 400/800 diehards don't have such an obvious solution. Probably the best way around it is to write a custom routine using memory location 764 to access the keyboard. But, on the other hand, the latest trend in programming is software that doesn't require the keyboard, so why not stick with your joystick?

The second problem is common to many programs involving machine language subroutines. The machine language used by this program, as well as data needed by it, is stored in a section of memory known as Page Six, which starts at location 1536. If you are using other pre-written machine language routines, make sure they don't occupy the same memory space.

With the Rainbow Screen Customizer you can create professional-looking BASIC programs that surpass the two-color displays found in many commercially available software packages. Of course, looks are just one part of a program, but they can make the difference between a mediocre piece of programming and one that is truly outstanding.

James Hague's most recent Antic program was Uncle Henry's Nuclear Waste Dump, (December 1986.) He lives in Richardson, Texas and has been working in assembly language and BASIC for over four years.

Listing:SCREEN.BAS Download