4]----------------------------------- 3]THE SHELL GAME: A Continuing Column 3]Palette and Freemap 3]By Brad Webb 4]----------------------------------- This month you'll learn about Palette and Freemap, two programs on your Extras 1.3 disk. For some of the experimentation you'll need a CLI or Shell window. If you know how to get either of these on screen, skip on to the start of the tutorial. Otherwise, consider this: 3]IF YOU'RE NEW HERE The shell and the CLI are special windows. In these windows commands and programs are run by typing, rather than by using the mouse and icons as with the Workbench. The CLI is an older, more primitive version of the shell. In this column we concentrate on the newer shell window. We examine uses of the shell itself, utilities and programs you can run from the shell, and the shell's interactions with the familiar Workbench environment. This column provides tutorials and examples to make it easier to follow. You will find a shell icon on your Workbench 1.3 disk in the window that opens when you double-click on the disk icon. Double-click on the shell icon and you have a window in which you can type the exercises and experiments from this column. If you have displayed this text by clicking on the ShellGame icon in the J: window, you can resize the PPMORE reader screen smaller to both display this text and type the commands. To resize, click on southeast corner, hold and roll mouse, then release. Move the shell window to the bottom to the screen. Click in either window to activate it. Before working any exercises, be sure you have started your Amiga with a copy of an unmodified Workbench disk. 3]MORE TOOLS Last month we took a look at the Icon editor in the Extras disk's Tools drawer. We will continue our exploration of this drawer. This exploration lets us see how a knowledge of the shell can enhance the use of Workbench tools. For now I'm skipping the other major program in this drawer, FED. FED is a Font EDitor and is used for creating or modifying screen fonts. I feel its use would be of little interest to most readers, so will pass it by. If I am wrong, please write me at the adrress given at the end of this article, and I will write a tutorial on its use if response is great enough. Instead, we will look at two small utilities that are more perhaps more interesting than practical: Palette and FreeMap. In a later column we can take a look at IconMerge, PerfMon and KeyToy2000, which works fine on A500s as well). 3]PALETTE TOOL This little program is new with Workbench 1.3. Its sole purpose is to change the color palette of programs "on the fly." By that we mean you can use Palette Tool to adjust any program's colors as the program is running. Unfortunately, the color changes are not permanent. They go away as soon as you close down the program you modified. We will use Palette Tool to customize our Workbench colors. We will then use the Preferences program, in conjunction with Palette, to save the modified Workbench. Using Shell commands, I'll show you how to have a library of different colored Workbenches on disk, and how to switch among them. Finally, I'll show you how to use Palette Tool with any program, not just the Workbench. Because of the changes we will be making, you should only be working with copies of your disks! Start by placing a copy of your Extras disk in a drive. Double-click on the disk icon to open it, and then double-click on the Tools drawer. In the window that opens is the Palette Tool icon. Double-click on it to reveal the Palette Tool window. You will see four color bars at the top of Palette Tool, one for each Workbench color. On the left is a vertical rectangle. It shows the color currently being worked with. In the center are three slider bars, labeled R, G and B (for red, green and blue). Next to them is a three-digit number. The number represents the red, green and blue components of the currently active color. Below all this are control gadgets labeled OK, RESET and CANCEL. All colors the Amiga can display on its screen are formed from combinations of the primary colors red, green and blue. Palette Tool lets you click on one of the color bars shown at the top of its window, and then to vary the amounts of red, green and blue in that color by moving the sliders. In this way you make the color into a different one. The changes are instantly reflected in the screen you are viewing. To familiarize yourself with the program, click in turn on each of the colored blocks at the top of the window. Watch what happens to the sliders, vertical box and three digit number. They will change to display the settings appropriate to each color activated. The active color will appear in the vertical box. Now place your mouse pointer on one of the white markers in a slider, hold down the left mouse button and move the marker from end to end. Note how the color changes and how the three-digit number changes. Try the other slider bars. 3]HEXAWHATZIT? You will see that each digit in the three-digit number varies from 0 to F. F, you may be saying, is not a numeral. Ordinarily you would be correct. In the hexadecimal numbering system A, B, C, D, E and F are numerals in turn representing values of 10, 11, 12, 13, 14 and 15. This allows each numeral to hold a value ranging from 0 through 15, rather than 0 through 9, as in our usual numbering system. Such an arrangement has proved useful in computer work. The Amiga's color values are often expressed using such numbers, so it is no surprise Palette Tool uses them. If your screen is really messed up when you are finished, click on the RESET gadget at the Palette Tool window bottom to restore it to its initial state. You can use the Palette Tool in this manner to determine a set of colors you like and then make a note of what the three-digit number reads. If you have a program that lets you modify its colors and save them in a preferences file, you can use Palette Tool to experiment to your heart's content. If the program you're adjusting lets you enter colors as numeric values, you can call it later and enter the values obtained from Palette Tool. Many programs provide internal windows much like Palette Tool, but others are more difficult to work with. For these programs, experimenting with Palette Tool first may make life easier. We will discuss later how to use Palette Tool with nearly any Amiga program. For now let's use it with the Workbench to get some practice. 3]CUSTOM WORKBENCH COLORS There is no reason to restrict yourself to the usual Workbench colors. Using the Amiga's Preferences program, you can dress up your Workbench in any four colors you desire. It can be a bit tricky to adjust the colors with Preferences, though. Its window obscures the entire Workbench (or half of it if you are using an interlace Workbench), making it difficult to see what your effects will look like on the Workbench itself. Palette Tool can solve this problem. While we're at it, we'll set up a library of different Workbench color schemes from which to choose. First we'll make sure we can return to your current Workbench color scheme later with ease. Begin by opening a Shell window. In the Shell type: cd devs: (Return means to press the RETURN or ENTER key.) Next type: dir You should see this display: keymaps (dir) printers (dir) clipboards (dir) clipboard.device MountList narrator.device parallel.device printer.device ramdrive.device serial.device system-configuration The file we are interested in is "system-configuration". This file stores all current Preferences settings. Included are your choice of printer driver, mouse speed, whether the Workbench comes up in interlace or normal, 60 or 80 column mode, all printer adjustments, serial port adjustments and so on. Included are the current Workbench colors. We will make a copy of this file so we can restore all these settings at once later. To make this copy, type the following command in your Shell: copy system-configuration syscon.original Use another DIR command to be certain your new file is there. 3]ON TO THE CHANGES Close your Shell window and open the Palette Tool window. Position it at a comfortable location on your Workbench. Adjust the colors until you have a set you like. The small size of the Palette Tool window will let you see how your new colors affect the real Workbench display. Open a few windows to show drawer and tool icons if none are visible. At this point, DO NOT click on the Palette Tool OK gadget. Palette Tool would vanish and the new Workbench colors would stay there until you did something to change them. We want instead to make our new colors permanent with the Preferences program. Calling Preferences will reset the colors, so leave Palette Tool where it is. Start it again if you already clicked OK. Now, open your Preferences Window as well. It's in the Prefs drawer of your Workbench disk. If you only have 512K memory, you may wish to shut down any open drawer windows. Don't worry about the Workbench colors being reset. Single-drive users may have to do some disk swapping to make this happen. You may also have to use the windows' fore and aft gadgets in the upper right corners to get everything set correctly. Place the Palette Tool window over the Preferences window. By the way, you are now using the Amiga's multitasking capabilities to your advantage. Click on a marker in any Palette Tool's slider and your custom colors will return. Preferences has no way of letting us enter the color number we have in the Palette Tool window, so we have to use Preferences' slider gadgets. Move them to positions approximating the ones for the sliders in your Palette Tool window. You will have to activate each changed color in turn in both windows and move the Preferences sliders. As soon as you touch Preferences sliders, the colors will revert to Preferences values, not Palette Tool values. By clicking in the Palette Tool slider again you can see how close you have gotten. Adjust, click, adjust, click and so on until there is no change when moving from one window to the other, and you will have achieved a perfect match. It is probably easiest if you adjust the background (leftmost) color first. Once you have your color match, click on the Preferences SAVE gadget. From now on, when you boot your Amiga, your custom colors will be used for the Workbench. You can use this method to create an entire library of Workbench configurations. In the Shell copy each new system-configuration setup to a file with a name that means something to you (such as syscon.GyBkYlRd for system-configuration Grey, Black, Yellow and Red). To switch among them, copy the one you wish to system-configuration and restart your Amiga. Each configuration file uses only a small bit of disk space (232 bytes). 3]ONE OR TWO HINTS If you decide to build up a configuration library, here are some good ideas. Always use COPY when switching system-configuration files, never RENAME. That way you will never lose your custom settings. Hint two: Yes, you can use the Preferences RESET ALL gadget to restore the Workbench to its original colors. This will also restore the screen to 60-column mode from 80, will restore the mouse speed to its default settings, restore margins and so on. It is much less work to use the Shell and the COPY command in the manner just described. 3]USING PALETTE TOOL WITH OTHER PROGRAMS Palette Tool was designed to let you use it with any well-behaved program, meaning one that lets you do multitasking. Now that you are familiar with how it works, I'll describe how to do this. If you are working with any program that runs on the Workbench screen, try the techniques we used with Preferences. If you are using a program that opens its own screen, things are just a bit more involved. Let's work through an example with a custom screen. We will use the Extras tool FED for our example because it uses a screen with more than the Workbench's four colors and because we all have a copy. There are a few items to be aware of, though. We will not be describing how to use the FED program itself. Though I have not tested this procedure in a 512K machine, all the programs we will be using are small and I expect no problems. You will probably want to restart your 512K computer to be sure memory is not fragmented. If you are reading this column in one window and working the exercises in other on a 512K machine, you may instead wish to print the column and read if from paper for these exercises. 3]USING PALETTE TOOL WITH CUSTOM SCREENS The basic technique is simple, but let's run through the steps before we actually try them. Start the program whose colors you wish to modify. Next pull down the screen of your target program so you can see the Workbench screen beneath. It is important to keep the target program screen in front of the Workbench screen. Now start Palette Tool. It will open on the custom screen of the program you wish to modify, rather than on the Workbench screen as it ordinarily would do. It will configure its window to allow for adjusting all the colors on the custom screen. OK, let's do it. Make sure the icon for Palette Tool is visible on your Workbench screen near the top, but do not start Palette Tool running yet. First, move the Tools window to the top of the Workbench screen. Now, double-click on the FED icon to start that program. Pull down the FED screen. To do this, place your mouse pointer on the drag bar at the screen's top. Hold down the left mouse button and move the mouse toward you. When the Tools window is visible, double-click on the Palette Tool icon to start it and watch its window open on the FED screen. You can now move the FED screen upward so it is all visible and adjust its colors with Palette Tool to your heart's content. You will find you cannot push the Palette Tool window behind the FED window to hide it, but you can click on OK to make it vanish when you have the colors set as you wish. If you need to change the colors later, you can restart Palette Tool by repeating the steps you just used. FED does not have the ability to adjust colors itself. For FED and other programs without this ability, Palette Tool can be helpful. Unfortunately, FED also lacks any way of saving modified colors. Since it doesn't provide for their adjustment, the lack of a save feature is not too surprising. To make changes you must run Palette Tool and adjust the colors every time you run the program. You could start a list and put the Palette Tool three-digit number by the names of such programs for future reference. Keep this as a Notepad (or ED, MEmacs, etc.) document for easy access. The use of Palette Tool with other programs is an excellent example of the power of multitasking and intercommunicating programs. The addition of a Notepad document to store your settings is also a fine use of multitasking. Show this example to anyone who asks what multitasking can do for you. You must experiment on your own to see how Palette Tool works with the particular programs you own. In some cases it will undoubtedly be easier to modify colors from with the particular program. For cases where no such provision is made and you do not like the default colors, or where the adjustment is cumbersome, Palette Tool can be a gem of an utility. 3]FREEMAP Lets examine one more denizen of the Tools directory. Clear all programs and windows cluttering your Workbench, but leave the Tools window open. Double-click on the FreeMap icon. A low-resolution screen will pop up over part of your current screen. The amount of chip memory available in your computer is listed on the right. A graphic map of memory use is presented over most of the small screen. Below the map is a readout of how much of the Amiga's two types of memory is available. Chip memory is the memory that can be used by the custom graphics and sound processors in the Amiga. It can also be used by the main 680xx processor. Fast memory can only be used by the main processor and a math co-processor if one is fitted. Leaving FreeMap running while working can be instructional. Push it behind your other screens by using its fore and aft gadgets and refer to it from time to time. Besides keeping you posted on how much of each type of memory is available, it can help you monitor memory fragmentation. As your Amiga runs, the various programs in use and the operating system itself consume areas of memory. Over time this tends to cut up the memory available for new tasks into small, disjointed pieces. This process is what we refer to as "memory fragmentation." If a new task cannot find a single piece big enough for its needs, it will not be able to restart, even though you may have enough total memory available for it. The only solution at that point is to reboot the computer. FreeMap has two pulldown menu items, one for QUIT and one for ABOUT. If you select the ABOUT item, you will see that each pixel (a pixel is the smallest dot of color that your screen can display) represents a memory piece of 64 bytes. Each byte can hold one character, like the letter "a" or the numeral "1". If the set of 64 bytes represented by a pixel is all free and available for use, the pixel will be dark. If any of the 64 byte set is in use, it will be light in color. To make the ABOUT display go away after you've read it, click the right mouse button. 3]UNTIL NEXT TIME... We covered a much ground -- two little known Workbench utilities, using the Workbench and shell in conjunction, multi-tasking, how colors are formed on an Amiga screen, hexadecimal numbers and more. Have fun experimenting with Palette Color and FreeMap and I'll see you in the next issue. If you want to get in touch, write me: Brad Webb, 123 N. Monroe St., Watertown, WI 53094.