Linus Åkesson’s ‘A Mind Is Born’ Commodore 64 Demo In Just 256 Bytes

It would be an understatement to say that the Commodore 64 demo scene is quite amazing. For those who are unaware, a ‘demo’ in this context is essentially a technological demonstration. Usually to show off particular effects or other (visual) properties that either push the limits of the platform on which it is being run, or use its hardware in a special fashion.  In the case of [Linus Åkesson]’s A Mind Is Born demo, the challenge was to do as much as possible in 256 bytes, while providing an audiovisual experience.

Although at first glance 256 bytes may sound like a lot to work with, this code has to generate the entire melody that is output via the Commodore 64’s SID audio chip, while simultaneously generating an attractive visual pattern. This is quite an undertaking, as the video capture of the result (included after the break) makes clear. The secret sauce here is to make use of the C64’s SID audio & VIC-II video chips.

Driven by a 60 Hz timer interrupt, the three voices of the SID are used to play the kick drum and bass, melody and drone respectively, creating the 64 total bars of the music using a linear-feedback shift register (LFSR). This means that the melody is in a sense randomly generated, but deterministically enough to sound pleasing to the human ear.

For the visual side, the C64 runs in Extended Character Mode, using fonts along with a background color to create interesting patterns using what is essentially a cellular automaton algorithm. While there are some visual glitches due overwriting of video data, and a race condition, these end up adding to the charm. The resulting audio track is pretty catchy too, and absolutely worthy of a listen.

Thanks for the tip, Johannes!

(That banner image?  That _is_ the whole code.)

 

35 thoughts on “Linus Åkesson’s ‘A Mind Is Born’ Commodore 64 Demo In Just 256 Bytes

    1. How big is a frame of a YouTube video? There is a screenshot of super mario bros that is thrown around with a caption that the screenshot is larger than the ROM.

      I have No opinion on how to calculate a single frame. Raw data? Sampling a bunch of videos?

      1. Just a guess, 480 setting would be 640×480, 24 bits depth so maybe just under 1MB total for a single frame on video card? With video codec, easily smaller in several Kb range per frame?

  1. I love lo-fi synth, glitchy visuals, cellular automata, demoscene, the works. I SHOULD really like this, but something about it makes me physically nauseous, like it is messing with my inner ear or something.

    Anyone else getting that?

    1. You’re getting everything from strobed balance/moire effects to autokinesis in this one.

      Please tell me this will be used as the intro to a well-written sci-fi flick…

    2. I think brilliant composition is the word you are looking for. Spoiled and stupid as I am, demos generally don’t wack my tail, except for A E S T H E T H I C ones, but this one got me hooked me straight on. It seems he’s using the glitches to sidechain the bassline with the graphics in a way that causes somewhat of a glitch between my visual and auditory sensors that feels waaaay better than that dopey asmr stuff. Thank you!

  2. What a fantastic bit of code. The code on the surface looks deceptively simple. The title of this piece, with the cellular automata, and the final reboot into created brain.. brilliant. who the hell is this guy!

    1. I first became aware of him after he did an impressive demo on a Parallax Propeller. I then checked out other demos he did, including one where he developed his own soft CPU core on an FPGA. The music and graphics are almost always top-notch. Look up his blog. I’m not exaggerating when I say the guy is a genius.

  3. Oh, this takes me back …. 8-bit audio, glitchy graphics and incomprehensible gameplay/scenes produced using procedural graphics.

    Hard to believe that the program is just 256 bytes long.

    1. The program loads to the standard BASIC load address and starts with a clever BASIC command that doubles as a constant for the interrupt routine. Then it copies itself to the zero page and does its thing.

  4. Started out in disbelief – then over the course of the article, I slowly convinced myself that this was possible. Then I read that the music generation was also in those 256 bytes too – and I was straight back at the start.

  5. I remember it taking two to three floppies of code, the play a “blinded me with science” mp3 equivlent. It was so exisiting to hear real music from our c64 back in 1986

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

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