Devastator
And your contrads approach the hostile Devloped a powerful mothership ready to destroy Earth. Out of nowhere, guardian ships attack. You destroy all of them—or else Earth is destroyed. Written for the unexpanded VIC, versions are also included for the 64, Color Computer, T1-99/4A, Apple II, and IBM PC and PCjr. Joystick required for all versions except VIC (optional)."Devastator" is an action game where you must save Earth from aliens. What makes it different from similar games is that when you fail, Old Terra Firma is destroyed before your eyes.
You and your comrades are in one-man spaceships skimming the surface of a huge alien craft known as Devastator. Suddenly, out of nowhere, guardian ships appear, darting and dodging swiftly, causing havoc among your ranks. Blast them by lining up your cross hairs with the center of the spaceships and pressing the fire button. You have a mere 30 seconds to destroy ten ships before Devastator annihilates Earth with a death bolt.
The VIC Programs
This program is written in two parts because of the limited memory in an unexpanded VIC-20. Program 1 gives the instructions and customizes the characters. Be sure to save Program 1 before you run it. However, if you wish to view Program 1 before saving it, temporarily add the line 295 END. After you type in Program 2, save it with the name D. (For tape, be sure to save it immediately following Program 1.) Lines 305 and 310 of Program 1 will then cause Program 2 to load and run automatically.
The second program is the actual game. If you hit RUN/STOP and RESTORE anytime during the second program, you must type POKE 36869, 255—no line number is needed—to play the game again. I his is the location of the customized characters.
Devastator is played with a joystick simply for ease of use. However, if you want to the keyboard you can substitute the following lines in Program 2:
1000 IFPEEK (197) = 17 THENR = R - 22 1005 IFPEEK (197) = 33 THENR = R + 22 1010 IFPEEK (197) = 28 THENR = R - 1 1015 IFPEEK (197) = 36 THENR = R + 1 1110 POKE L + R, 219 : IFPEEK (197) <> 32 THEN1128
Delete lines 1016-1022.
The difficulty level of this game can be changed by subtracting or adding time in line 140, or by increasing or decreasing the number of points for ships hit (SC) in line 2000. (Each ship is worth ten points.) You can also make the ships harder to hit by changing the 9 in line 500 to a higher number.
Here is an explanation of Program 2:
Line
0 Variables. 20 Print Earth and stars. 70 Print first screen of Devastator. 160 Print second screen of Devastator. 250 Print third screen of Devastator. 350 Print fourth screen of Devastator. 500 Subroutine to print ships. 800 Subroutines for sound, joystick, and cross hairs. 1120 PEEK hit of a guardian ship. 1800 Subroutines for printing saucers. 2000 Decide win or loss. 2005 Routine for loss. 2040 "Play again" option. 3000 Routine for win.
Both of these programs use a lot of so don't add extra spaces.
Be careful—the graphics can make this a difficult program to type in.
"Devastor," VIC version. Another alien saucer waits to be destroyed in "Devastator," Color Computer version.Color Computer Notes
Use a joystick plugged into the right port to play the Color Computer version of "Devastator" (Program 3). Type the DATA statements carefully; they determine the shape and color of the moving trench. The program reads the patterns of l's, 2's, and 3's and creates three different "views" of the trench, using the solid-colored blocks in the character set. When these are shown in succession, you get the illusion of moving bands. This is all made feasible, of course, by the Color Computer's very fast PRINTing speed.
The alien ship is drawn by several subroutines; each draws a different-sized ship. By erasing and redrawing, the alien ship can be made to appear to weave in and out three-dimensionally. The alien ship is also drawn with relatively low-resolution, quarter-square characters. The main program checks for a collision between the cross hairs and the alien simply by comparing their X, Y coordinates.
You have a limited amount of time to shoot the alien. If you take too long (the clock counts down to zero), a colored beam blasts and reduces the Earth to a smear of colorful dots. There's always the next game!
TI-99/4A Version Notes
The TI-99/4A version of "Devastator" (Program 4) is written in Extended BASIC and requires a joystick. As the game begins, you are cruising above the ominous Devastator. A guardian ship from Devastator appears. You must eliminate this alien ship and at least nine others that follow in a given period. If you fail, Devastator blasts Earth with a lethal laser.
Two levels of difficulty are offered in this version. On either level, you can eliminate the guardian ship by simply positioning the cross hairs over them using the joystick. The main difference between skill levels is the size of these guardian ships (which are actually sprites). The CALL MAGNIFY statement in line 420 produces ships of two sizes. Consequently, on level one, guardian ships are large and can be easily destroyed, but level two features smaller ships which require greater dexterity to eliminate.
The primary game loop for the program is from line 450 to 510. The counter W in line 500 is increased each time through the loop. When W reaches 200, the game is over and Earth is either blasted or not, depending on whether you've destroyed the required number of guardian ships. If the game as written is just too easy or too difficult for you on the skill levels offered, vary the time limit (200) to achieve a comfortable level of play.
The programming techniques used here might aid you in writing your own programs on the TI. You may notice that program execution appears to pause between the title page and the appearance of the playfield (background). Actually, the playfield is being set up, but since the foreground and background colors of all characters are defined as black, nothing appears at this point because the screen color is also black. When all characters on the playfield have been printed, color codes are assigned simultaneously using the CALL COLOR statement so that the entire game field appears at once.
Another trick, also achieved with color coding of characters, gives the game a 3-D effect. The Devastator is first printed in lines 220 to 320, using redefined characters from three character sets. By constantly shifting the foreground and background colors of these character sets in line 450, an illusion of movement is produced. Thus, as you watch the screen, you feel that you are actually circling this colossal ship.
Apple Devastator
Todd Koumriar
"Devastator" for the Apple (Program 5) is a joystick-controlled hi-res game written in Applesoft with several machine language (ML) subroutines. When playing Devastator, you need not hold down the fire button; merely placing the cross hairs on the moving alien interceptor will insure its destruction. However, if you take too long, Devastator will have enough time to destroy Earth.
The cross hairs and the alien interceptors are drawn using shape tables. The Applesoft SCALE and ROT commands are used to create the arrival and explosion of the interceptors. The shape table is POKEd in at line 8030 and sits at $300.
Earth and its subsequent destruction are handled by short ML routines. The worlddraw routine resides at $1900 and is CALLed once every loop through the main program or whenever the image is garbled. The routine stores the bit image on the screen memory from a data table at $1980 to $1A6F. World-draw OR's the image with what is on the screen and then stores it so that it does not erase what is already there.
The destruction of Earth at the end of the game is handled by an ML routine at $1A7O. It stores random garbage in a randomly selected line and byte in screen memory. Since the routine confines the garbage to the area around the image of Earth for a number of cycles and then expands it to the edges of the screen, the explosion appears to expand quickly. The ML random number generator used at $1AFF is a common one that generates random nybbles and masks them together for random byte values. A short lookup table is used by both the world-draw and world-destroy routines to find quickly the addresses of the first 40 lines on the screen. The table lies between $1930 and $197F; its use has been well documented in the past year.
When you're typing in Devastator for the Apple, it is important that the data be absolutely correct. If the data for the shape tables or the world-image has errors, the images will look malformed. If there are errors in the data for the ML routines, the computer will most likely crash or write all over your program. If you have a printer, use it to check the data, and remember to always save your program before you run it.
IBM Notes: Devastator
Charles Brannon, Program Editor
The Devastator, an alien ship of incredible power, is now approaching the earth. The Devastator roams the galaxy, destroying planets and absorbing matter-energy transformations. Unfortunately, it's now Earth's turn to be the matter.
The combined technology of the planet has managed to assemble a primitive ship, one that can at best discourage the Devastator. You are the pilot of that ship, mankind's last, best hope.
You've been briefed thoroughly: The Devastator sends out ten ships, one at a time. Each ship plants an explosive satellite above the earth. After all ten charges have been laid, the Devastator detonates them, destroying the planet utterly. It didn't expect to encounter you, thoug…
You'll need an IBM PC with BASICA (advanced BASIC), or a PCjr with Cartridge BASIC, as well as a joystick, to play "Devastator." After you RUN the game, read the instructions to familiarize yourself with the game. To begin play, hold the joystick to the lower right corner, then press the button. This lets the program calibrate itself to your joystick (since the range of the joysticks is not standard).
After a pause, while the game is being set up (the background colors will change to assure you your machine's not dead), the main viewscreen appears, inside dotted lines. You're orbiting the massive Devastator. Terra Firma is in the upper left corner of the viewscreen, and a dreaded alien ship is hovering about. Move the cross hairs with your joystick, center it on the alien, then press fire. If you made a hit, the screen will flash red and a new alien will appear. But if you miss, the alien ship darts away, making it harder to reaim. The alien ship will plant its charge after ten seconds. However, the more ships you hit, the faster they get.
At first the Devastator hardly notices you, but after you begin to destroy the ships, the Devastator modifies them to reach Earth faster. Every time you hit five ships, future ships will reach Earth a second sooner. Your control panel shows you a countdown of time remaining before the charge is planted. Each time an alien lays a charge, Earth will flash, and the deadly ring around Earth becomes more complete. When ten charges have been set, Earth shudders in nil-space, then flashes outward at the speed of light. You may not have saved Earth, but at least it went out with a bang!
Programming Tips
The program uses the medium resolution, four color mode (SCREEN 1). All the animation is done using PUT and GET. First, three views of the trench are drawn. Each one starts with a different color, so when they are viewed in succession, you get the illusion of moving bands, which in turn makes you feel like you are orbiting the Devastator. Each view is saved in an array (with GET), then displayed with PUT. The cross hairs, the alien, and the planet Earth are also drawn, then nabbed with GET.
To animate, you must erase the old image, redraw the image at the new location, erase, draw, etc. In drawing and erasing, though, it's too easy to erase the underlying background. The trick is how you lay down the image. If you just place it on the screen, you are overlaying and destroying the dots under the image. Instead, you can use a quasimathematical function called XOR (exclusive OR) to both draw and erase the ship. Let's follow XOR with a binary example.
Let's say the image is one byte wide and one line high: 10101010. This would create a dotted line in high resolution, or a colored line in medium. Underneath the image might be a single dot: 00100000. When the two bytes are XOR'd together:
XOR 00100000 (background) 10101010 (shape) 10001010 (new background)
(The rule for XOR is 0 XOR 0 = 0, 0 XOR 1 = 1, 1 XOR 0 = 1, 1 XOR 1 = 0.)
Now watch the magic as we XOR the answer back with the image:
10001010 (new background) XOR 10101010 (original shape) 00100000 (restored background)
The image is erased, but the original dot is back! The same idea applies to a shape made up of lots of bytes. You can XOR it against the background, then XOR again to restore the background (and erase the shape).
The IBM version of "Devastator."Notes For The 64 Version
The 64 version of "Devastator" uses machine language, coupled with sprite and character graphics, to produce a realistic battle scenario. You must defend the earth against all invaders. To insure the earth's safety, you must strike your opponent's ship at least once every ten seconds. Failing this challenge will place the earth in imminent danger.
Several options for game play are available. Initially, you may select either a one-or a two-player game. The one-player game pits you against a computer-controlled ship. This ship evades your attack with random movements. Choosing the two-player option pits you against an opponent who is actively avoiding your attack.
Player one (in either the one- or two-player game) must use a joystick in port 2 to move a crosshair around the screen. (In the two-player game, player two controls the alien ship with a joystick in port 1.) When the crosshair comes in contact with the alien ship, you must fire to achieve a successful strike against the opposing ship. Ten points are awarded for each successful strike. A score of 1000 will save the earth.
The game has three levels of difficulty. You can change levels at any time by pressing the top three function keys. The f1 key gives the lowest level, f3 the second highest, and f5 the most difficult level. The SHIFT/LOCK key can be used to increase or decrease the size of your crosshair, which also affects the difficulty of the game.
To use Devastator for the 64, you must first enter Program 8 using MLX. The starting address for this program is 49152 and the ending address is 50891. After saving this program, type in Program 7 and save it. To run Devastator, first load the program that you created with MLX like this:
LOAD "program name", 8, l
for disk, or
LOAD "program name", l, l
for tape. Then type NEW (hit RETURN) and load and run Program 7.