In this tremendously educational video, [Linus Åkesson] takes us through how he develops a synthesizer and a sequencer and editor for it on the Commodore 64, all in BASIC. While this sounds easy, [Linus] is doing this in hard mode: all of the audio is generated by POKE, and it gets crazier from there. If you’re one of those people out there who think that BASIC is a limited language, you need to watch this video.
[Linus] can do anything with POKE. On a simple computer like the C64, the sound chip, the screen chips, and even the interrupts that control program flow are all accessible simply by writing to the right part of memory. So the main loop here simply runs through a lot of data, POKEing it into memory and turning the sound chip on and off. There’s also a counter running inside the C64 that he uses to point into a pitch lookup table in the code.
But the inception part comes when he designs the sequencer and editor. Because C64 BASIC already has an interactive code editor, he hijacks this for his music editor. The final sequencer interface exists inside the program itself, and he writes music in the code, in real time, using things like LIST and editing. (Code is data, and data is code.) Add in a noise drum hack, and you’ve got some classic chiptuney sounds by the end.
We love [Linus]’s minimal C64 exercises, and this one gets maximal effect out of a running C64 BASIC environment. But that’s so much code in comparison to his 256-byte “A Mind is Born” demo. But to get that done, he had to use assembly.
Thanks [zogzog] for the great tip!
My teacher taught in the most complex way to “filter” the students.
I have always hated him
How funny it seems like magic to young people when back in time we had no choice but to poke and peek :-)))
Yeah I was wondering why peek wasn’t mentioned in the article.
Only on 8-Bitters. Owners of an Atari ST or Amiga had the choce to do proper programming on GFA Basic and Amiga Basic, respectively.
PC Users had BASCOM and Quick Basic or Turbo Basic. Or Locomotive Basic v2 on GEM.
All being available since 1985, circa. The C64 wasn’t much younger, either.
C64 coders with ambitions hat used SIMONS’ BASIC. Or ran GEOS.
@CPerrod said: “How funny it seems like magic to young people when back in time we had no choice but to poke and peek :-)))”
In DOS (erm, CMD) we had DEBUG.EXE.[1][2]
References:
[One] Debug (command)
https://en.wikipedia.org/wiki/Debug_(command)
[Two] Editing Binaries in DOS
https://susam.net/editing-binaries-in-dos.html
This video demonstrates the power of ABSOLUTE mastery of a domain of knowledge, in this case BASIC on C64.
Thank you for taking me to church this morning. Inspiring.
I’ll take a PEEK at the video to see his use of POKE.
🤣👍
This is the masterpeace of Linus Akkeson:
https://www.linusakesson.net/scene/craft/index.php
Just be careful when POKEing around; you can wedge the machine, which requires a power cycle to fix.
Thanks for the write-up. I scrolled past this vid in my youtube feed several times thinking “eh, I’ll get to it next time, maybe” but a couple key points in this writeup made it “I can’t believe I almost missed that. Must watch Now!” And while I tuned-out a bit on some of the details of a machine I know little about, I got sucked-in when he was changing the song in realtime via REM statements.
Awesome work.
Gonna have to watch again morre closely to see how he did it, and quite a bit more.
Thanks for highlighting this, Elliott!
I said it in the previous article,
He looks a lot like a friend of mine.