Original Supertris

Sunday, February 17, 2013

The Sleeper Re-Awakens

So that last post was a false alarm. I'm not sure what I was up to in the summer of 2006, but we had a second child in 2007 and now I am finally starting to have enough spare time to resume work on this project. Thanks everyone for your comments and patience.

I have good news and bad news. The good news is that I have actually been working on this project for a few weeks now, albeit slowly. The fact that the code has been leading the blog is probably a good thing. The bad news is that an extraordinary amount of bit rot has set in over the past two decades and it will take some effort to get the project off the ground. Here's what I have so far.

I created a github project for this, where you can look at the source code, etc. I decided to go with HTML5 as a platform so it will be largely platform independent. I hope it can work on most browsers, smartphones, and tablets. We'll see. Audio could be a challenge. But if they could do Angry Birds in HTML5, surely I can make Supertris work, too. There is a little bit of code there now that I wrote in the summer of 2011, just to get my feet wet with JavaScript and HTML5 game coding. It's not much now (you can't even clear rows), but it does demonstrate a game loop, screen updates, and keyboard control.

Anyway, rather than write something from scratch now, I want to be true to the original design of the game and use as much of its logic and algorithms as I can. Thus, my plan is to basically translate the original Pascal source into JavaScript and go from there. I'm not sure whether I want to manually translate the source or write something to do it automatically. That decision will be made once I can actually read the source. Read on:

While I have been diligent about migrating the original Lightspeed Pascal source code from stacks of 3.5" floppies to big hard disks to NAS devices (I'm on my second NAS, now), I never actually looked at the source itself until recently. Um, it's stored as binary files, not text. One of the nice features of Lightspeed Pascal's IDE was its automatic code formatting (boldface and indentation, mostly), which was pretty advanced for Reagan-era software, I understand. I guess it stored the source in a semi-parsed binary format to facilitate this. I recall an option when saving source code to save it in text or their proprietary format. I tried both and they looked the same on-screen, so I used their binary format for all but one of the source code files. D'Oh!

Thus my first task is to reverse engineer their format and generate readable Pascal output. I an writing a Python script to do this right now. It seems mostly straightforward, though there are a few byte code sequences that I do not yet understand. And it appears that they are using multiple bytes to encode syntactic elements where one would do. There must be a reason for this, but I have yet to determine what it is. Stay tuned....

0 Comments:

Post a Comment

<< Home