Animated abstract graphics; Commodore's port. John J. Anderson.
Say yo ho, Commodorians. Hope you are getting the most of the early summer, and not spending every sunny, beautiful day cooped up inside. At least bring your C-64 out into the back yard or onto the fire escape. Or get a really long extension cord and bring it back to the beach.
Don't take it in the water though. Computers can't swim.
I have received a batch of letter from new users telling me not to take them--beginners--for granted. Well let me tell you, I never thought I had. But I guess it must be true that some people get left behind when I move from easy stuff to tough stuff so quickly.
There is always so much to say, and so little room in which to say it.
Beginners, take heart. What follows is just for you. Warm up your machines and get ready to learn something fun. Beginner's Rainbow
New owners of C-64s should type in the very short program that appears here as Listing 1. Figure 1 shows all the graphics characters of the program, and how to get them appear on your computer. So typing the listing shouldn't be too hard, and will give you practice typing special graphics characters.
Run the program. You get a neat rainbow test pattern in all 16 of the colors the C-64 is capable of displaying.
Now let's take a look at how the program works. Line 5 turns the entire screen, background and border, to white. Line 10 is the first part of a FOR/NEXT loop, which tells the computer it will be counting from 1 to 23.
By sticking a command or commands in between the FOR and the NEXT statements, we can make the computer execute these instructions however many times we like. Here, we have said to count from 1 to 23, and then inserted a PRINT statement between the FOR and the NEXT statements.
Pretend that you are the computer for a second and trace the program through an imaginary run. First you are told to count from 1 to 23. The first time through X will equal one, until you see the NEXT statement, which tells you to count again.
But beofre you see the NEXT statement, you are told by line 20 to PRINt something. Reverse is turned on, which prints in the inverse mode, and the cursor color is switched through every possibility. So you print that line to the screen.
Then you encounter the NEXT statement in line 30. That says to go back to line 10 and count. This time through the loop X will equal 2. You print line 20 again, then NEXT tells you to return to line 10 again and increase the count by one.
The process happens again and again, until the value of X reaches 23. Then the FOR/NEXT loop terminates, and the program ends. Easiest Animated Graphics in the Universe
Big deal, right? A rainbow test pattern. Wonderful (yawn).
Aha, we have just begun. Time to pull a really neat trick out of the hat. Try this: put a semicolon after the final quote in the PRINT statement--line 20 in Listing 1. Witness the result by running the program.
Originally, each time through the loop, the program printed line 20 on a new screen line, making an ordered test pattern. By putting a semicolon in after the final quote in line 20, you command the computer to start the next print line right where the last one ended. Our test pattern becomes a diagonal mosaic pattern.
By taking things one step further, we can obtain very pleasing animated abstract patterns with hardly any effort at all. Try Listing 2 on for size.
This program is very much like the one we have just examined--the print line is just the same, with the addition of the semicolon at the very end. However, the screen has now been turned totally black by line 5, and the FOR/NEXT loop has been replaced by an endless GOTO loop.
When we run the program, the color bars print continuously, until we press the RUN/STOP key. As the bars print to the bottom of the screen, the print scrolls upward. The effect is a looping cascade of color. Let's see any other computer do this quite so easily or in so few lines of code. That is a special advantage of your C-64's design philosophy.
You can harness the power of scrolling PRINT statements to sophisticated effect. By inserting graphics characters in RVS mode, you can create textures and patterns. The programs themselves can be very short; you can, in fact, fit them on a single program line. Listing 3 and 4 will help you get started.
Using FOR/NEXT loops, you can stack print lines in a single program to move through different patterns at whatever rate you desire. Listing 5 shows you how.
In Listing 5 each FOR/NEXT loop runs through a different, then moves on to the next. These loops are enclosed within a GOTO loop, which starts everything over again. See how easy it is to nest loops? There's nothing to it.
Want your abstract to go truly nuts? POKE the value of X into the background location each time through the loop. Add the statement POKE 53281,X as lines 15, 35, and 55 in the program above. The result is Listing 6.
Talk about psychedelic! It's hard to watch that program run for long. A calmer multicolor background is preferable in the long run.
Listing 7 is one to experiment with. Here we have taken the concept of the counter and put it to use. We have set up a counting GOTO loop, using IF/THEN statements to keep the values of X and Y trimmed to our requirements. We have set up two counters--and one lives inside the other. As we move through the loop, Y counts by 1 only after X has counted by 20. This is all there is to nesting loops.
if we were to POKE location 53281 with the value of X instead of Y, the backgroung color would change as fast as it did in our psychedelic program. But Y counts more slowly, allowing the background color to change at a much more restful pace.
Line 10 sets up the X counter, just as it did in our earliest print programs. Line 20 says that when X has counted to 20, Y can count once. Only if X is about to become 21 can Y increase by one.
Line 23 says to reset X to 0 once it has counted past 20. Then it starts counting all over again. Line 25 says to reset Y when it reaches past 15. Just as in our color changing program, we want to go back to black once we have cycled through all the available colors.
Line 30 contains our abstract patter. Don't forget the semicolon after the closing quote mark. Line 40 sets the background color to the value of Y. Line 50 sends us back to the beginning, to start all over again. We add one to X, and go through the loop again. That's all there is to it! News from the Wire
Space for just a few quickie announcements this time around. Next time, we will devote more space to new product announcements. MicroProse
Solo Flight from MicroProse is a flight simulator designed with fun in mind. It is easier to fly than Sublogic's Flight simulator, and though its graphics are not quite as advanced as Sublogic's, it is more fun to play.
For whatever it is worth, this is the first flight simulator I have managed to land successfully in. After three dozen crashes, this was a very gratifying experience.
You are placed in the cockpit of a light practice landings and choose weather conditions--even night flight. An air mail game lets you practice at various airports under various conditions.
Look for a full view of Solo Flight in an upcoming games roundup. Precision Software
Superbase 64 is a professional database management and retrieval system for the Commodore 64. It offers an unlimited number of databases, with up to 15 rifles per database. Each record can hold up to 1108 characters, with a maximum of 127 fields.
The system includes search and sort capabilities, and a user interface that is quick and easy to use, with multiple on-line help screens. Superbase 64 handles arithmetic as well as calendar calculations. It allows the sophisticated user to create customized application packages within the Superbase 64 environment.
The program lists for $100 and requires a single disk drive. CArdCo
The CardCo C/?+G printer interface has a very strange name, but does a terrific job translating from Commodore serial to Centronics parallel printer code.
The C/?+G retails for $90 and requires no software. It includes all necessary cabling and prints the full Commodore character set including all Commodore graphics characters, reversed characters, and reversed graphics characters. There are many similar interfaces on the market, but few can make that claim.
The CardCo interface works with all Epson, MX, FX, and RX printers, as well as the Star Gemini and Delta-10; Prowriter; C. Itoh 8510; NEC 8023; Okidata 82, 83, 84, 92, 93, and 94; Mannesmann-Tally Spirit and MT-160; Seikosha GX-100, BMC BX-80, gorilla Banana; and other parallel printers.
Okay that's all for now. Catch you next time. And get some sun!