Commodore's port. (Program for Vic-20 to manage the 1541 disk drive) John J. Anderson.
Gee whiz, I want to tell you. Lot's going on in the Commodore arena, and it's really hard to keep up anymore. More and more new hardware and software products, more great packages meriting review, and more applications than you can shake a disk at. We need more room! Maybe Creative should become Commodore specific! Just kidding, Atari fans. See John Run
No, but seriously, folks. I want to lead off by extending my sincere thanks to a Karl T. Thurber, Jr, of Millbrook, AL. In the March issue of Run magazine, Karl said some very kind words about my old Baby Driver program for the 1540 disk drive.
In an article entitled "Bringing Up Commodore," he described Baby Driver for more than four paragraphs, and wrote, "I place it on practically every disk . . . I find it very easy to use, and it can be used whether or not the Wedge programs have been loaded. Some users may even prefer the Baby Driver over the still-cryptic Wedger by virtue of its simple, menu-driven operation."
Karl, old buddy, you made my month. And if you liked Baby Driver, which was written way back in the winter of 1982, you'll love MiniDos Menu 2.0, which appeared in our May issue. It is designed specifically for the C-64 and 1541 drive, and has many signicificantly improved features. So type it in, okay?
And all you other C-64 owners out there--you type it in, too. Run, John, Run
It just goes to show you. If an unfortunate soul reads only Run, he first learned about Baby Driver in March, 1984. The enlightened Run contributor, i.e. Mr. Thunder who never misses an issue of Creative Computing, has not only know about the virtues but had a copy of Baby Driver since Christmas of 1982. And now he will have a copy of the improved version. It's enough to make a micromag publisher Green with envy.
And due to overwhelming demand (four letters so far), this month we present the Vic version of Menu 2.2. Just when Vic owners thought it was safe to go back in the water. Warm up your machines and limber your finges. And don't Run away. Another Winner
This month we have another debut application, by my Commodore-maven buddy Robert Alonso, that without a doubt will also set other Commodore micromags swiftly ahemming and hawing. Let's hope they credit Creative Commputing for this one, too. It runs in a mere 20 lines,and I guarantee you will want to type this one in. But I mention this now only to whet your apetite. First let's look at the menu. MEnu: a Vic MiniDos
Listing 1 is version 2.2 of Menu for the Vic, a Basic program that makes working with the 1541 disk drive much easier. Figure 1 will help you locate all the special graphics characters you'll need to type in. every line in which they appear is indicated in the figure.
The real utility of the Menu program is knowing that a copy of it resides on every data disk you own. When you power up, type LOAD "MENU", 8 then press RETURN. When the Vic comes back with a READY, run the program.
Automatically upon the program RUN, a disk directory will be privided. First the name and extender of the current disk are listed. Then the lengths, names, and types of files appear. After the directory is completed, a menu prompt of choices appears. You pick a letter, hit RETURN, and the chosen process is automatically carried out for you.
Here is the roster of functions Menu can perform:
* (<) RUN-- allows you to autorun and program in the directory.
* (F)ORMAT--formats a disk.
* (C)OPY--allows you to copy a file under a new filename.
* (E)RASE--deletes a file from disk.
*(D)IRECTORY--lists the files on disk.
* (*)CHECK ERROR STATUS-- queries the error channel on the disk drive.
* (R)ENAME--allows you to change the name of any file.
* (W)RITE MENU--automatically puts a copy of the Menu Program itself out disk
* (Q)UIT MENU--eliminates the Menu program from memory and brings you back out to Basic.
For more detailed documentation on the program, see last month's Commodore's Port. Simple Screen Save
Okay, sond the trumpets. For more than a year now, I have been trying to develop a short and simple character graphics screen save routine for the C-64. Embedding color character graphics in PRINT statements in highly unsatisfactory for a number of sticky reasons. First, it limits the size of the graphic. Second, the process of composing multicolor images becomes a nightmare. The complexity stifles creativity in a hurry. Color-change characters themselves dispalce the graphic image to the right, one space per color change. Allowing for them is akin to thinking in Esperanto.
What is needed is a program that allows the cursor to move freely, so you can compose an image, then save the whole screen to disk.
I have seen similar programs for hi-res screens, but tried in vain to design a character graphics version. Then, in frustration, I gave the project to my good friend Robert Alonso, who knows the C-64 better than I know the back of my hand. He did the job in 20 lines of code. I tuned it up a bit, got it to run a bit more smoothly, and made it a little easier to use, but Listing 2 is his program.
I'm going to give Robert the floor, So to speak, to take you through the mechanism of the screen save program. I think it is among the most useful short programs I have seen for the C-64. It makes saving and retrieving color character graphics screens utterly simple. Take it away Robert!
Designing a title screen is often the most tedious part of programming. The programmer must not only decide how he wants the screen to look, but also how he plans to make it look that way. The usual choices are either to POKE the layout of the screen or to PRINT the layout. On the Commodore 64, it is more practical to PRINT the layout because it is much faster and because both the image and the color can be placed on the screen simultaneously. With POKES, each character would have to be POKED into screen memory (which starts at 1024 ($0400) and the color would have to be Poked into the corresponding color memory location (with starts at 55296 ($D800).
Fortunately, there is an easier way. A programmer can just create his design and colors with a screen editor that saves the finished screen to the disk drive. The saved screen can then be accessed by any program that has the approriate subroutine for loading the screen. This can be particularly useful if a series of programs uses the same or similar title screen layout.
The program shown here as Listing 2 is a simple but effective sreen editor for the Commodore 64. Figure 2 lists the graphics characters in the progarm. In writting the program I tried to minimize the time necessary to load and save a screen to a 1541 disk drive. I have found that saving an entire screen with color takes about one minute and 20 seconds, while loading the same screen takes about 53 seconds. Almost every key is allowed by the program (including the STOP/RESTORE keys, so be careful). All the colores are accessible by using the CONTROL key and a number or the COMMODORE key and a number. Reverse characters can be used simply by pressing the CONTROL key and the 9 to enable it or the 0 to dsable it. All the graphics charters are accessed with the SHIFT and COMMODORE keys.
When you run the program, it prompts you for the filename you want to use for the screen. You must keep the name shorter than 16 characters to avoid an error message when saving. Once you enter the filename and hit RETURN, you are in the edit mode. Now you can proceed to design your screen using the cursor keys to move the cursor around. Please note that in addition to being a good editor for designing title screens, the program is also adequate for teaching the fundamentals of word processing to a beginner.
The limitations of the program are that only one screen can be done at a time and that text will scroll off into oblivion if the cursor to go beyond the last screen line. Another disadvantage is that you can't directly PRINT to the bottom righthand corner. Instead, you must Print whatever you want in that corner one space to the left of it, move the cursor to the left of what you PRINTED, and hit SHIFT-INSERT once. Your character will then be forced into the corner.
If, while using the program, you decide that your screen really isn't what you had in mind, you can erase it without having to exit the program. Just hit SHIFT-CLEAR.
At any point in the program, you have the option of saving the screen, loading a screen that has already been saved, or exiting the program. These opions are accessed by hitting funtion key 1 to save, function key 3 to load, or function key 5 to exit the program. I have included a very short routine at the beginning of the save and load routine to flash different colors on the border. the routine was included to confirm that a save or load is taking place. If you should ever experince a problem loading or saving you can hit RUN/STOP-RESTORE and in immediate mode type GOTO 23. You will then get a printout of the error condition.
Once you have a screen finished and saved, you can include it in a program by adding four lines at the beginning of that program. The first line should include the given values for the variables SC and CR, the filename you gave the screen assigned to a$. Add too, if desired, two POKES, one to set the border color and one to set the screen color. The next three lines shoulds be equivalent to lines 20-22 of the given program. Remember to delete the GOTO 8 in line 22 so it doesn't affect the flow of your program. Although the routine I have described works well, you can improve on it by first blanking the screen and then, when the screen has been loaded, bringing it back. The following two Pokes are necessary to do this: POKE53265,PEEK(53265)AND239- blank screen POKE53265,PEEK(53265)OR16 - reset screen Program Revealed
Line 0-5: Remarks to remind the user of the purpose of the program and the author.
Line 6: Checks the keyboard for input; colors screen black.
Line 7: Initialization of the variables SC, CR, BC, and C$. SC is the start of screen memory. CR is the start of color memory. BC is the border color register. And C$ is a string used in the program to keep the cursor from moving on its own.
Line 8: Prints the filename input prompt in white, accepts the input, assigns it to A$,and clears the screen.
Line 9: Gets input from the keyboard and assings the cursor shape to B$ if the input is null or a quotation mark.
Line 10: Uses the input from line 6 to test if any cursor key or the RETURN key has been hit. If any of the keys has been hit, then C$ is printed to erase the cursor from its present location.
Lines 11-13: Test to see if function key 1,3, or 5 has been hit. If so, a save, load, or exit takes place.
Line 14: Prints the key which was struck on the current cursor position and returns the program to line 8 to form a continuous loop.
Line 15: Steps the register for border color through its 15 possible colors.
Line 16: Opens a sequential file to write to the disk drive (device 8) with the name A$.
Line 17: Begins a FOR-NEXT loop that PEEKS the values from the screen RAM and color RAM and assings them to S and C respectively.
Line 18: Completes the FOR-NEXT loop from line 17 by storing S and C to the opened file (#2) on the disk drive. Once the loop is finished, the file is closed and program control is sent back to the loop beginning at line 8.
Line 19: Steps the register for border color through its 15 possible colors.
Line 20: Opens a sequential file to read from the disk drive (device 8) with the name A$.
Line 21: Begins a FOR-NEXT loop that INPUTS the values S and C and POKES the S value into the sreen RAM.
Line 22: Completes the FOR-NEXT loop from line 21 by POKEing the C value into the color RAM. Once the loop is finished, the file is closed, and program control is sent back to the loop beginning ar line 8.
Line 23: Opens the command channel to the disk drive to check the error status by INPUTing the string values W$, X$, Y$ and Z$.
Line 24: Clears screen, and prints the string for reference.
Line 25: Closes the command channel and ends the program.
Beautiful. One more thing you might want to do to improve the program is to add the line POKE 650,128 somewhere near the beginning of the program. This will give you an autorepeat function on every key. This comes in very handy when creating graphics patterns with multiple keystrokes. Mailbag
This one came in from John Dayton, of Liburn, GA:
I am writting this letter to share my experience with you and your readers regarding the video quality of the C-64. I was trying to reach a decision on which home computer would best meet my needs when a friend showed me your video quality article in the August issue. My concern nearly scared me off the C-64.
After reading your article, I started thinking about alternative approaches. Initially I wanted to hook the micro up to the family TV, but soon decided that if everyone was to remain happy i needed a separate monitor or TV. Faced with the expense, I preferred the flexibility of another TV. But what about video quality?
Being the owner of a videocassette recorder, I reasoned that it might pay to bypass the RF modulator in the C-64. I bought a utility cable from a local computer store and ran the video and audio output directly from the Commodore to the video and audio in jacks on the VCR. Now the Commodore video can ride into the TV via the superior VCR modulator.
The video quality using this method is excellent and rivals that of a dedicated monitor. I'm confident that all home computer/VCR owners will find that this approach works very well.
An ingenious approach, John. I'm going to have to give that a try. Save and Replace Clarification
Since readers have continued to write in with the same question, allow me to answer once again a question I answered, albeit incorrectly, about a year and a half ago. You can save a file under its existing filename, replacing the original file with the midified contents. The command is SAVE" O :FILENAME",8
Sorry for the booboo. My only excuse is that the preliminary documentation for the 1541, with which I originally made an evaluation of the drive, makes the current manual read like Shakespeare.
That's about all for this time. Next month, back to reviews and new products. Auf wiedersehn.