Classic Computer Magazine Archive START VOL. 5 NO. 7 / APRIL/MAY 1991

TECH TIPS

BASIC Color Selector
By Bob Spiewak

Choosing the right colors for a screen for a BASIC program can be a real hassle. The usual approach is to RUN the program, and view the screen. Then, if the colors still need tweaking, you have to stop the program, assign new colors using SETCOLOR or POKE commands, and RUN the program again. And again, and again....

By adding the following routine to your program, you can adjust the colors while viewing your screen. Type it in and LIST a copy to disk. Then type NEW and LOAD your program. Make sure that you have no lines in your program numbered 25000 or above. Then ENTER this routine from disk, and it will be merged with your program.

Now you need to add a temporary statement to your program. Right after the program prints your screen, insert the statement GOSUB 25000. (You might want to put this on a separate line to make it easier to remove later.) Now when you RUN your program, it will draw the screen as usual, then go to the color selector routine.

Use the [ARROW] keys (without [CONTROL]) to adjust the hue and luminance while you watch the changes onscreen. To work with another color register, press the spacebar.

When you have the color combination you want, press [ESCAPE]. All the POKEs you need will appear on the screen, with room for a line number at left. Add the line number you want and press [RETURN], and this new line will be added to your program. (Make sure you pick an appropriate point in the program to set the colors. Don't use the number of an existing line unless you want to replace it with this new information.)

Once you're done, be sure to remove the GOSUB 25000 statement, and the Color Selector routine, from your program.

Listing: 8bit/POKECOLR.BAS Download

Print POKEs
By Jeffrey A. Summers, MD

When using a BASIC program, you may find yourself wanting a printout of your program's output. There's no problem if the program is designed to print your results, or you can at least redirect your output to "P:" instead of saving to a disk. However, if the program simply uses PRINT statements, you may be forced to rewrite large portions of the program to get that printout.

One shortcut you can take is to enter the statement

POKE 838,202:POKE 839,254 before running the program. Make sure you type both POKEs on one line (with no line number) as shown, and then press [RETURN].

The READY prompt should now appear on your printer, not on the screen. All output that would normally go through channel 0 (the usual screen editor channel) will now be directed to the printer. What you type will still appear on the screen, but the computer responds on the printer. Watching the printout instead of the screen, you can operate most programs and get the printouts you need. With programs that use special graphics, however, you're likely to get a lot of garbage from your printer, and maybe some unexpected form feeds and nasty noises.

To return to the regular onscreen mode, press [RESET] or enter

POKE 838,175:POKE 839,242