Bob's Games

Star Trek


[Last Update: 03 August 2018]
Star Trek One of the first game programs written for microcomputers was Star Trek. I have some BASIC source code that was written for the Altair 8800B in 1976, and I did a conversion to C to make an executable program.

The first link below points to a zip file which contains the executable file (startrek.exe) for PC's, an instruction file used by the program (stinstr.txt), and an icon (ncc1701.ico) that can be used with the executable for a Windows(c) shortcut to it.

The executable (approx. 38k) is a DOS text-mode rendition of the classic Star Trek "shoot the Klingons" game. I tried to stay as true as I could to the original game, adding only a few beeps, input error checking, and a bail-out command.

I am also providing here the original BASIC source code, a slightly altered BASIC program that will execute under QBASIC (I tested it with version 6.22), and the C source from my conversion. The C code contains some comments (the BASIC programs do not!), and it will be obvious that I took routines from other programs to use in this conversion, as the documentation of functions is not consistent. In the C program I tried to use mostly the same variable names as in the BASIC program, but in some instances I had to add new ones as the BASIC ones did not distinguish between integers and non-integers. The original BASIC code is great "spaghetti code" and also does some naughty things like treating some parts of the code as subroutines part of the time and not at other times. It also did some things with "FOR-NEXT" looping that QBASIC did not like, so I had to modify those parts of the code. The C conversion does add quite a bit of structure to the code (no "goto" statements, for example), but I did not break my back optimizing it.

Each of the zip files also contains the instructions in an appropriate format. The Altair Extended Disk Basic (yep, our old Altair actually had an 8-inch floppy drive in it -- though it was unreliable at times!) only supported 8-character file names, so the instruction file was originally named "INSTR", and that is how it is included in the zip file containing the original source code. I renamed the instruction file to "stinstr.txt" for the QBASIC and C versions.

One more note about the C source code. It is written for Borland C, and uses some Borland-specific calls. It was not my intention to write a portable C version. Mostly, it uses "cprintf" calls instead of "printf" calls, and also calls the "gettime" routine. If you want to try and make this into more portable source code, be my guest! I only wanted to end up with a program that would execute.


To get the Star Trek executable ZIP file (approx. 27k), Click Here!!

To get the Star Trek ZIP file containing the original Altair BASIC source code (approx. 5k), Click Here!!

To get the Star Trek ZIP file containing the modified QBASIC source code (approx. 5k), Click Here!!

To get the Star Trek ZIP file containing the C source code (approx. 10k), Click Here!!

Click here to Go Back To Bob's Game Page.