@party: Weaving thread

I spent this weekend at @party 2010, the first (and hopefully not last) demoparty of this name. The event was in the Town of Harvard, Massachusetts – a bit outside of Boston. I heard four live music performances, saw an early cut of Jason Scott’s almost-finished Get Lamp documentary, and saw and heard grafix, music, and demos (wild and windows) in the Saturday evening compos. There were great tunes, a truly excellent 4k windows demo, an incredible demo running on an Arduino, and much more. Many thanks to the organizer, Metoikos, and everyone who helped her out. And, a big thanks to the demoscene!

Working with two others and using the moniker “nom de nom,” I completed my first demoscene production: thread, a Commodore 64 demo that has fewer than 32 bytes of code. (There are no C64 demos this size or smaller on pouet.net, as far as I can tell.) This demo is a tribute to a BASIC program that generates random mazes, one that exists in one form in the C64 User’s Guide but has also circulated as a one-liner. Here’s a version of the program:

10 PRINT CHR$(205.5+RND(1)); : GOTO 10

I developed thread working in person first with Le Colonial of Atlanta, a sometime co-author of mine who also writes Atari VCS games. (He’s also known as Ian Bogost.) At the party itself, I was fortunate to encounter C64 expert rv6502 of MontrĂ©al, who joined me and did the heavy lifting in the second phase of this project.

After working one evening with Le Colonial in Cambridge, we had a 32 byte program that wasn’t exactly like the original, but did something pretty cool. When I checked it out on my actual C64 right before I left for the party, however, it didn’t work. The SID was initialized differently in the emulators I’d used than it was on the box itself – as it happened – and there was something odd happening with my video display as well.

I brought my C64 to the event rather half-heartedly, without any way of getting programs onto it other than typing them in and without a display. Alas, I wasn’t going to get away from the program that easily: Dr. Claw brought me a monitor to use and NO CARRIER loaned me a flash cart – and, later, a physical copy of the Commodore 64 Programmer’s Guide. rv6502 and I sat down to work further on the program. It turned out my C64’s video was different that of the emulators I used, but also different from Ferris’s actual C64 (which matched the behavior of the emulators I tried). So it wasn’t just an emulator failing to match the metal; the two different C64s apparently have different KERNAL code in ROM. Dumping my machine’s ROM and used that with my emulator would have solved that part of the mismatch.

I won’t try to go into all the details of developing this demo, but there were two particularly great things about the process at a high level. First, I got to collaborate with and learn from two others at different points. Second, I got to learn a lot more about the C64, including many things I wouldn’t have run up against if I hadn’t been working on something like this. I’m not talking about small differences between emulation and the hardware, which were a minor part of this experience, in the end. I mean finding excellent facilities of the 6502 and the C64 to work around those which weren’t doing what we wanted.

We’ve released thread in three versions: The canonical one, which has 31 bytes of code but is in a 33-byte PRG file, because the beginning memory location is stored in the first two bytes of PRG files. If this bothers you, there is a 28-byte version which fits into a 30-byte PRG file and has all the same colors, but displayed in a way that we think is not as pretty. We also include a simple, straightforward reimplementation of the BASIC program above: A 20-byte program in a 22-byte PRG file. I’d love to get this uploaded to pouet.net at some point, but I don’t know how. For now, here’s a zipfile with source and PRGs.

thread got 4th place in the Oldschool category at @party. After you load a PRG file in your emulator (or on your C64), you can run it by typing “SYS 4096”.

Finally, these are the 31 bytes of thread:

A9 80 8D 0F D4 8D 12 D4 A8 B1 F9 8D 86 02 AD 1B D4 29 01 69 6D 20 D2 FF E8 D0 ED E6 F9 50 E9


6 Replies to “@party: Weaving thread”

  1. Just curious: What was the issue you were running into with machine differences?

    As I recall, the first versions of the kernal set the character color map to the text color, but at some point the kernal was changed so the color map was set to the background color by default. This meant that programs that only changed the character map would not be visible on all machines. Was that it?

  2. Yeah, that was it Jesper. Although, we encountered it with the kernal as well as with straight writes to video memory.

  3. That was it indeed. Actually we did end up working around it by using the kernal’s CHROUT routine instead of writing directly to screen memory. An earlier workaround that we tried was simply changing the background color to something that contrasted with both light blue and dark blue, the defaults at startup. But we didn’t stick with that – it took much more space and wasn’t as nice-looking.

Leave a Reply

Your email address will not be published. Required fields are marked *

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax

This site uses Akismet to reduce spam. Learn how your comment data is processed.