Niels Horn's Blog
Random thoughts, tips & tricks about Slackware-Linux, Lego and Star WarsXSpaceWarp, or: converting old source code for modern compilers
May 14th, 2010 by Niels Horn in ARMedslack, Patches, Slackware, TRS-80, gcc
How it all started
On the TRS-80 mailing list I subscribe there was a discussion about an old (from 1977!) game I used to play on my TRS-80 Model I called Space Warp. This game was originally called "Time Trek", based on the popular television series Star Trek. When Tandy/Radio Shack released this game commercially, they changed some of the terms, probably for copyright reasons.
Someone mentioned that it had been ported to X and that the sources were available. But, when I downloaded the sources from x.org and tried to build it, I noticed that this port was from 1995 and many things have changed since then… It simply threw tons of errors instead of building the program. For sentimental reasons I did not give up though, and decided to try to solve the incompatibilities with the modern Gnu C++ compiler.
What needed to be adapted
Some of the needed changes were quite obvious, others required a bit of "Googling" to discover. All in all, it was a nice exercise for me. The major items were:
#include <iostream.h>
- Modern versions of gcc expect#include <iostream>
and a line defining the namespace ("using namespace std
")- string literals needed to be defined as (char*) like:
invalid((char*)"columns");
instead ofinvalid("columns");
Other changes were less obvious, but all in all I had to create a patch file of 999 lines
After all these patches, XSpaceWarp built fine on Slackware 13.0 and the 13.1 beta, both 32 & 64-bits. I also tested it on ARMedslack.
The result
Here are two screenshots from the game:
It's not exactly a graphic-intensive game, but don't forget that this was written over thirty years ago
Get it!
If you use Slackware, you can get packages from Slackware 13.0 32 & 64-bits and for ARMedslack from my site.
As soon as SlackBuilds.org opens for submissions again (after the release of Slackware 13.1), I'll submit the SlackBuild.
If you want to build the program yourself, get the original sources from x.org or the patched version for newer compilers here.
The patch is also separately available here, so that you can study it and patch your own sources.