Classic Computer Magazine Archive ANTIC VOL. 5, NO. 9 / JANUARY 1987

by Stephen Everman and Paul Pratt

SUPER TREK IN ST BASIC

Play the ultimate Star Trek game

Here's the breakthrough that all you ST BASIC hobbyists have been waiting for. Super Trek is an ambitious commercial-quality GEM version of the classic public domain Star Trek game-and it's all done with ST BASIC. Nearly nine pages long this is the biggest ST BASIC program ever published by Antic. But Super Trek is a clean, straightforward listing that should not present any undue typing difficulties. And when you command the Enterprise on a 360-day mission throughout the final frontier we think you'll agree it was worth every keystroke. Sorry ... Super Trek runs on color monitors only

Super Trek screenOn the "Star Trek" shows, it all seemed so easy. Captain Kirk and company would hop from planet to planet-sometimes beaming down to vanquish exotic monsters-enter skirmishes with various space scum, occasionally disobey orders from Star Fleet Command or violate the Prime Directive and still come up smelling like a rose. Super Trek-for STs with color monitors only-isn't as simple as that.

Remember those clipboards that the various curvaceous yeomen handed Kirk from time to time? They held energy consumption reports, among other things, and could not be ignored. That's part of what you'll have to deal with here. Your assignment as the new Commander of the United Star Ship Enterprise is to spend the next 360 days doing anything you want-as long as you destroy the prescribed number of Klingon vessels (usually around 25 or 30).

The Atari ST is the final frontier for the classic public domain Star Trek game. Written entirely in ST BASIC it boasts an arcade-quality color display and total mouse control via menu boxes and icons. You'll zoom through the galaxies and do battle with Klingons, just like the old days.

BLAST OFF

The Super Trek screen has one grid showing the entire galaxy and another with just the quadrant you're in at the time. Travel to a new quadrant at Warp Speed by clicking on a quadrant box in the galaxy grid-map. If there is a Klingon ship in the new quadrant, it's time to click on red alert.

A message window gives you status reports during battle. Pie charts show the remaining percentages of phaser power, photon torpedos, computer capability, energy, deflector shields functioning and how much of your 360 days are left. The pie slices removed from the graphs can be huge, so keep a close watch and make sure to warp frequently to a star base for repairs.

The Library Functions window offers the choice of Status & Repair Scheduling, Cumulative Galactic Record, Long-Range Galactic Scanning and leaving a Marker Buoy behind.

While in drydock, repairs can be authorized by clicking on Status & Repairs Scheduling in the Library Functions window. This calls up a small spreadsheet showing present computer capability, shields and phaser status, the goals for these (set by you with the mouse buttons) and the energy units and days needed for repair. When you have set your goals and decided how much time to spend at the star base, click on Authorize Repairs to get set for departure.

The Cumulative Galactic Record shows each galaxy you've visited. But if the computer is damaged, it will show random question marks in places. The Long-Range Scanners take in the area around you. This can help, but it expends a great deal of energy. Marker Buoys can be left to show where you were; but must be replaced whenever you re-enter those areas.

In combat, click on the square for either the phaser or photon torpedo. When the cross-hair cursor appears, click on the Kiingon ship. The phaser beam is more powerful than the photon, but it loses strength as it and the computer take damage. Since the photon torpedos are physical bombs, they won't lose power. But, again, they won't do as much damage as the phaser and you can only carry six at a time.

Super Trek will be a lot easier to play if you remember these hints: Keep your shields up. Make small galactic moves and make repairs often. Be careful of quadrants with more than one Klingon ship, because they'll gang up on you. Remember, the game becomes more and more difficult after each successful voyage.

TYPING IT IN

Carefully type in Listing 1, STARTREK.BAS, using either the editor built into ST BASIC or your favorite ST word processor. If you use a word processor, be sure and save the file in ASCII format. (See this issue's Tech Tips page for more information about using word processors to type in ST BASIC listings.) When you finish, run TYPO ST and generate the TYPO Table for Super Trek. Check each line entry If one of the checksums doesn't match, recheck how you typed that line.

(NOTE: We've discovered ST BASIC will drop the very first character of a textfile when it tries to read the file. For this reason, ST BASIC sees line 1000 as line 000 and calculates the incorrect checksum. The fix is to either disregard the first line or insert a single carriage return as the first character in the file.-ANTIC ED)

Antic Disk owners: STARTREK.BAS is on SIDE B of the January monthly disk. Follow the ST Help file instructions to transfer the programs from the 8-bit disk to your ST.

PROGRAM BREAKDOWN

Lines 1000-1040 make up the title and copyright information. Line 1060 through 1590 hold program initialization information. This is where the screen is drawn and colored. Lines 1610 through 1960 contain the MAIN loop, where the game logic actually lies.

The work is done inside the while...wend loop. Here we watch where the mouse is pointing, and respond appropriately if a mouse button is pressed. When both buttons are pressed, the program will fall out of the while...wend loop and determine the outcome of your battle with the Kiingons. You are asked if you wish to play again.

The next four subroutines support your final outcome. One of these is called for each condition possible; either Success, Failure, Incompetence, and Play Again. Between lines 2270 and 2350 is the subroutine that draws the pie charts used for the onscreen power indicators.

The subroutine GALAXY updates the active quadrant when you change position on the galaxy grid. PHOTON and PHASER are called when you select either weapon to use against the Klingon slime. DESTROY is called when you finally defeat a Klingon ship.

Between lines 3470 and 3550, the subroutines HIT.SHIELDS, HIT.PHASERS, and HIT.COMPUTER are activated whenever the Klingons manage to land a hit on the Enterprise. Down at line 4120, the subroutine LIBRARY is called whenever you move the mouse pointer into the Library Box below the two position maps on-screen. If you choose one of the Library Functions, control is passed to DO.LIBRARY, where the proper function is determined and control is passed on to the proper routine, either REPAIR, GALAXYMAP, SCAN. GALAXY, or SETMARKER.BUOY.

FINAL FRONTIER

Whenever you select a new destination for the Enterprise, control is passed to MOVESHIP, at line 4780. The destination is scanned to check for occupancy and, if the area is unoccupied, the Enterprise's location is changed. If you move the Enterprise to a star base, the subroutine DOCK is called, allowing you to repair systems-if there are no Klingons attacking.

Should you desire repair service while docked at a starbase, the subroutine REPAIR is called. In the library Box, the repairable functions will appear, along with the amount they need to be repaired. Point at the function you want repaired, and press the left mouse button to increase, or the right button to decrease, the level of repair.

The subroutine SETUP in lines 6270 to 6410 reseeds the Galaxy with stars, star bases, Klingons, and the Enterprise. FLASH causes the screen to flash whenever you destroy a Klingon. This routine and the following one, KOLOR, perform something interesting on the ST.

First, they read four color values into an array where each entry is 16 bits wide, then poke the address of the array into where GEM keeps track of where its current color palette is located. This instantly changes the available colors on the ST screen, much faster than the color statement.

Next, we find subroutines to perform some of the common GEM functions. The SET.MOUSE.SHAPE subroutine actually do just that, given the desired mouse shape number (0-7) in the variable POINTER. SHRINKBOX and GROWBOX perform the "moving box" effect whenever you warp the Enterprise to another section of the Galaxy. POLYLINE and PSTRING perform GEM functions for drawing a line and placing graphic text on the screen.

Super Trek is the third in a series of classic public domain games rewritten in ST BASIC by Paul Pratt and Stephen Everman of Hayward, California. ST BASIC Hangman appeared in the November, l986 Antic, and Deduction appeared in December 1986.

Listing 1: STARTREK.BAS Download