[This documentation originally appeared as the text of an article in Portable 100 magazine (June 1988, pp. 13-16). I have modified it only slightly to enhance clarity and adapt it for on-line presentation. The program and documentation have been released by the author to the public domain. -- Mike Nugent, 71426.1201@compuserve.com] Men-u-tility A program to change files without leaving the main menu. by Greg Susong Does this sound familiar? You enter BASIC on your Model 100, type FILES, enter the fifteen keystrokes necessary to delete a file, and press ENTER ... then you type FILES again to refresh the display, type fifteen more keystrokes to delete another file, etc. What a bother! Have you ever counted the keystrokes it takes to rename a file? Twenty-nine if you count pressing ENTER. It's crazy! Now there's a better way. With Men-u-tility you can kill a file with as little as three keystrokes. You can also rename files, print files, make files invisible or visible, set the day, date and time, set an alarm, and check the memory requirement of any file, all without ever leaving the main menu. Does this sound like ad copy? Well, it's close. Through my now defunct company, Custom Software, my wife Carol and I sold hundreds and hundreds of these programs for $24.95 each. Now we've decided to give it away. Most machine language programs you will encounter must reside at a certain location in memory. This often causes conflicts when you try to use more than one at a time. Men-u-tility is designed to be placed anywhere in memory, thus allowing you to avoid this type of conflict. Men-u-tility comes in two parts, MLOAD.BA and MCODE.DO. The MLOAD.BA program is the loader. It asks you where to locate Men-u-tility and then reads the TEXT file, MCODE.DO, and adjusts it to fit into that location. Start by having both these files in your computer. GETTING STARTED Before you can load Men-u-tility you must decide where you want to place it in memory. The ideal place to put it is just below MAXRAM. If you aren't using any other machine language programs, or your other machine language programs are relocatable, then I suggest that you place it there. Men-u-tility is 1,954 bytes long. To find the start address for the program, go into BASIC, type PRINT MAXRAM-1954 and press ENTER. If you have other machine language programs in RAM that cannot be relocated, you must locate Men-u-tility below their start address. Using the documentation from the other program, determine the start address of that program and subtract 1,954. This will be the start address to give the loader program. Go to BASIC and type CLEAR 256,xxxxx (replacing 'xxxxx' with the start address that you decided on). Now type RUN "MLOAD.BA" and press ENTER. You will be prompted to type the start address for the program. Type the start address you've decided upon and press ENTER. The loader will begin reading the MCODE.DO file and creating your custom copy of Men-u-tility. The loader will warn you if an error occurs. The three possible errors are: * Program would exceed high memory limits: The start address you gave the program is too high. Recalculate the start address and try again. * Memory not clear for this address: Memory has not been protected for the area you have told it locate Men-u-tility. Follow the instructions that appear after the error message and try again. * Checksum error--Try again: There is an error in the MCODE.DO file. Open the file in TEXT and look for any obvious errors. If you find none, try downloading another copy of the file. If that fails, notify the forum Sysop and/or the uploader of these files (Mike Nugent, CompuServe ID 71426,1201). Now is the best time to create a backup copy of the actual machine language program. If you should have to remove Men-u-tility it is much faster to reload it from a backup copy than to use the loader again. From the BASIC 'Ok' prompt, type LOADM "MENUTL" and press ENTER. The screen will show: Top:aaaaa End:bbbbb Exe: aaaaa To backup to tape, put a blank cassette into your recorder and press both PLAY and RECORD together. Then type CSAVEM "MENUTL.CO",aaaaa,bbbbb,aaaaa (replacing 'aaaaa' and 'bbbbb' with the actual values shown next to 'Top:', 'End', and 'Exe:'. (To backup MENUTL.CO to floppy disk, follow the instructions for your particular disk operating system.) INSTALLING THE PROGRAM To install Men-u-tility, position the cursor over the file named MENUTL.CO and press ENTER. The Model 100's main menu will be replaced with Men-u-tility. You may now kill the files named MENUTL.CO, MLOAD.BA, and MCODE.DO. The date, day, and time are still in their normal position. Just to the right of the time, a figure representing the number of free bytes available is displayed. This was previously shown on the bottom line of the menu. To the right of the free bytes is the file length indicator. As you move the cursor bar from file to file, the length of the file (number of bytes) is displayed in this position. This value reflects the number of bytes the file actually uses, plus whatever terminating or data bytes the file needs. For example, the end of a BASIC file is marked by two binary zero bytes. Therefore, a BASIC file that is totally empty will still show a length of two. The end of a TEXT file is marked with a 1A (decimal 26) byte. An empty TEXT file will show a length of one. The first six bytes of a machine language file tell its start address, length, and entry address. This amount is added to the length of a .CO file. When the cursor bar is over BASIC, the length of any unsaved BASIC file is shown. When the cursor bar is over TEXT, the number of bytes in the paste buffer is shown. If BASIC or TEXT have been made invisible, the first two ROM files will give these values. If all ROM files have been made invisible, these two values won't be shown. If you use the Disk/Video Interface from Radio Shack you will be pleasantly surprised to find that when Men-u-tility is active and you are using the CRT, the menu will appear on the CRT instead of the LCD. THE FUNCTION KEYS F1--Name: To rename a file, move the cursor bar over the filename you want to change and press F1. The bottom line of the display will disappear and you will be prompted with 'Name as?'. Type in any six characters and press ENTER. Do not type the extension! All lowercase letters will be converted to uppercase. If you decide not to rename the file, press SHIFT and BREAK to cancel the prompt. You can rename any file, even the ROM files (BASIC, TEXT, TELCOM, etc.). If you type more than six characters, only the first six will be used. You cannot change the extension of the filename. If you type the extension it will be considered part of the filename; i.e., if you try to rename TEST.DO and you type 'T.DO' the file will end up being named T.DO.DO. F2--Kill: To kill a file, move the cursor bar over the filename you want to delete and press F2. The bottom line of the display will disappear and you will be prompted with 'Sure?'. This is a precautionary measure to keep you from killing a file inadvertently. Type 'Y' or 'y' to kill the file, or type 'N' or 'n' to cancel the prompt. F3--Prnt: To print a file on your printer, move the cursor bar over the text (.DO) file that you want to print, and press F3. The bottom line will disappear and prompt you: 'Left? (0)'. This sets your left margin. To use the default value of zero, press ENTER; otherwise type the value you want for the left margin and press ENTER. The next prompt is: 'Width? (80)'. This sets the maximum width of the text on the page. To use the default value of 80 just press ENTER; otherwise type the width you want and press ENTER. The next prompt is: 'Top? (3)'. This sets the margin at the top of the page. To use the default value of three lines just press ENTER; otherwise type the top margin you want and press ENTER. The next prompt is: 'Bottom? (3)'. This sets the margin at the bottom of the page. To use the default value of three lines just press ENTER; otherwise type a new bottom margin and press ENTER. The last prompt is: 'Page length? (66). This sets the page length. This value should be equal to the number of lines per page. Either press ENTER to use the default value of of 66 lines per page or enter another value and press ENTER. To cancel the print function, press SHIFT and BREAK at any of the five prompts. Once printing has started you can abort the job in the same manner. Men-u-tility checks to see if your printer is ready. If the printer is not ready, pressing the F3 key will simply cause a beep. F4--Invi: This allows you to make a file invisible. The file will still be in memory--you just won't be able to see it on the menu. Position the cursor bar over the file to want to make invisible and press F4. To make all invisible files visible again, press CODE and C at the same time. (You must always have at least one visible file or the display will act strangely.) F5--Date: This lets you set the date without going into BASIC. Press F5 and you are prompted with: 'MM/DD/YY?'. Type in the date and press ENTER. You can cancel the prompt by pressing SHIFT and BREAK. F6--Day: This works like F5 except it let you set the day of the week The valid entries are: Mon, Tue, Wed, Thu, Fri, Sat, and Sun. You can cancel the prompt by pressing SHIFT and BREAK. F7--Time: This works like F5 and F6 except it lets you set the time. Type the time using HOUR:MINUTE:SECOND format and press ENTER. You can cancel the prompt by pressing SHIFT and BREAK. F8--Alrm: This feature lets you set an alarm that will beep at the designated time. The alarm will beep for approximately one minute or until you shut it off. Press F8 and you will be prompted with: 'Set for? HH:MM'. Type the HOUR:MINUTE you want the alarm to go off, and press ENTER. You can cancel the prompt by pressing SHIFT and BREAK. After the alarm is set, the function key definition will appear in reverse video. This lets you know an alarm is pending. To cancel the alarm, press F8 and you will see that the definition returns to normal video. Once activated, the alarm will go off no matter what mode your computer is in. This means that you can be editing a TEXT file or even be using TELCOM and the alarm will still be sounded. The alarm will not sound if the computer is turned off. No check is made for correct syntax; therefore if you type something like '34:FT' the alarm will never go off. TURNING OFF MEN-U-TILITY Any machine language program that uses the same area of memory Men-u-tility uses will cause a conflict. To prevent a cold start you must turn off Men-u-tility before loading the other program. Men-u-tility can be turned off in two ways, the first of which is by pressing the CODE key and the O (for OFF) key at the same time. This will turn off Men-u-tility and return you to the normal main menu. Whenever you position the cursor bar over a machine language program and press ENTER, you are given another chance to turn off Men-u-tility. You will see the prompt: 'Remove Men-u-tility? (Y/N/C)'. This is a safety measure so that you won't inadvertently load a conflicting machine language program on top of Men-u-tility. Type 'Y' to remove Men-u-tility and execute the new program. Type 'N' to execute the program without removing Men-u-tility, or type 'C' to cancel the prompt. (You *must* remove Men-u-tility if the new program shares any of the same addresses.) TECHNICAL NOTES Men-u-tility uses the RST 7.5 vector at memory location F5FFH to take control of the Model 100. This location is jumped to approximately 256 times every second and usually holds a simple RETurn instruction. Men-u-tility reroutes the normal flow of the Model 100's operating system so that it can take control whenever the machine would normally return to the menu or when the alarm needs to be sounded. Men-u-tility copies the instructions in these locations (F5FFH to F601H) so that if another machine language program is already using this vector, it will get its turn when Men-u-tility is through. When you press the CODE and O keys to turn off Men-u-tility, or answer 'Y' to the remove Men-u-tility prompt, the instructions that were in the RST 7.5 vector when Men-u-tility was started will be restored. The first 46 bytes of Men-u-tility are only needed the first time the program is run. The area is then returned to free memory. Men-u-tility protects itself by changing MAXRAM to below the area where Men-u-tility resides. This keeps BASIC programs that have the statement CLEAR 256, MAXRAM from causing a cold start. The CLEAR command is also intercepted to keep you from clearing the space where Men-u-tility is located. When you turn off Men-u-tility, these are returned to their normal state.