About
Retired blog about web development, scripting,
web 2.0, social software, apple, linux and
technology in general.
Closeline
-
[web 2.0]
-
Reinier implemented what I always thought was a pretty fun game: Closeline.
Getting it to play was usually a big pain in the ass because he had an implementation in written in assembler[1] and it always had problems with joystick recognition and stuff like that (this is how it has stuck in my mind).
So thank god for the web and its newfound cross platformness (for everyone except for IE).
[1] The Javascript code for this version (which I strongly suggest you do not look at) still bears that heritage. It reads like a direct rewrite of the original assembler code. Mind putting that on the web as well, Reinier?
-
-
Made by alper at 2005-12-08 01:21
| Place comment (3)
| Trackbacks (0)
Comments
Re: Closeline
There are two versions - the original, programmed in about 10 minutes, as living example waaay back in 1998, when someone suggested to me he could make a more interesting game in C compared to me in assembler even if I had twice the time. After claiming I was 'done' in about 10 minutes, with this, the issue was resolved :-P
The original version no longer appears to work in XP.
The extended second version adds support for up to 4 players (up from 2), support for up to 2 joysticks (up from none), adds a menu, adds score-counting (win 21 games to win), and does not need to be re-run just to play another game, which was a fairly big weakness of the original.
I freely admit I had to tweak even the new version as the delay code was using a fugly empty forloop construction, which, needless to say, needed to be looped through a heck of a lot more often on current machines. After the tweak it still works on XP.
As far as joystick support goes - unless you have some vanilla DOS lieing around, shake it. The code is almost completely standalone, meaning, in theory, with very few changes it would work when written to the bootsector of a disk. Assuming you have an original ISA soundblaster of course, or something compatible to that, for a plain bus accessible gameport. The joystick support did work at one time, and windows 95 actually translated newfangled gameports back to the old ISA bus for dos boxes. Back then supporting games of auld was deemed important enough to go through that trouble. XP no longer appears to do this.
compiling either version:
nasm -o closline.com closline.asm (google for nasm).
here's the original - it no longer works but at least that code is almost readable to you newfangled python/javascript folk. The original compiled to a 355 byte comfile. About 40 more bytes of boilerplate around that and I could run it on ie some sort of strange keystroke pattern, which makes 405 bytes. Small enough to hide amongst the IVT and some other unused parts of memory. Could have made it the jokey part of a virus or somesuch. heh. Not that that would in any way or form work on anything but windows 95 or dos.
The version that actually works is here:
Made by:
Reinier Zwitserloot
on December 08,2005 03:22
Re: Closeline
something got stripped there...
working version: source and compiled COM executable (run this from a dos box, and go to fullscreen first with alt+enter.
As far as its assembler heritage shining through - really? Aside from the one-dimensional positional cache, which the assembler version never had (the screen ITSELF was my positional cache. graphics memory is read/write, a canvas is read-only), what's so assemblery about it?
I think various parts of assembler are in fact shining through into javascript. lambda functions is the order of the day in assembler. Assembler is the original event driven programming 'language' - everything that came after it, and I do mean everything, back then, wasn't event driven anymore. Even an 8086 was 'event-driven' - that's the way it just worked back then and in some cases still does: The keyboard port on the back of your computer had a line going straight into one of the pins on the processor. Anytime a signal arrived on that, the processor itself would raise a hardware 'interrupt', effectively calling, immediatly, a preset function. Somewhat similar to how onkeyup/onkeydown now gets called in javascript when keys are hit. Whereas in BASIC, PASCAL, and C, you had to poll the keyboard buffer, which was not flexible and sucked the big one in many ways.
Ahh, interesting to reflect on how much modern programming resembles those first tentative steps into Computer Science so many years ago. Perhaps now, finally, I can stop saying that a programmer who hasn't taken the step of learning how to program for a vanilla PC, no operating system, is not worth his salt.
Made by:
Reinier Zwitserloot
on December 08,2005 03:35
- Trackbacks
There are no trackbacks.
There are two versions - the original, programmed in about 10 minutes, as living example waaay back in 1998, when someone suggested to me he could make a more interesting game in C compared to me in assembler even if I had twice the time. After claiming I was 'done' in about 10 minutes, with this, the issue was resolved :-P
The original version no longer appears to work in XP.
The extended second version adds support for up to 4 players (up from 2), support for up to 2 joysticks (up from none), adds a menu, adds score-counting (win 21 games to win), and does not need to be re-run just to play another game, which was a fairly big weakness of the original.
I freely admit I had to tweak even the new version as the delay code was using a fugly empty forloop construction, which, needless to say, needed to be looped through a heck of a lot more often on current machines. After the tweak it still works on XP.
As far as joystick support goes - unless you have some vanilla DOS lieing around, shake it. The code is almost completely standalone, meaning, in theory, with very few changes it would work when written to the bootsector of a disk. Assuming you have an original ISA soundblaster of course, or something compatible to that, for a plain bus accessible gameport. The joystick support did work at one time, and windows 95 actually translated newfangled gameports back to the old ISA bus for dos boxes. Back then supporting games of auld was deemed important enough to go through that trouble. XP no longer appears to do this.
compiling either version:
nasm -o closline.com closline.asm (google for nasm).
here's the original - it no longer works but at least that code is almost readable to you newfangled python/javascript folk. The original compiled to a 355 byte comfile. About 40 more bytes of boilerplate around that and I could run it on ie some sort of strange keystroke pattern, which makes 405 bytes. Small enough to hide amongst the IVT and some other unused parts of memory. Could have made it the jokey part of a virus or somesuch. heh. Not that that would in any way or form work on anything but windows 95 or dos.
The version that actually works is here: