AADevLog #7 - Creating "the demo"
Writing a demo is a lot of fun, because there are basically no limitations. You just use what you have, and there's no fixed goal. You can make it as short or as long as you like, and when something doesn't work, you either change it, or just drop it.
While all along the way, of course, you run into a lot of issues. A proper demo generates graphics and sound, and has some sort of timing. That's a little less work than a game, which additionally needs user interaction (input) and "rules of engagement", but it's still quite a lot to handle.
It's interesting: creating graphics and sound with some math is great, but at a certain level it's all about timing. Assembler coding gurus doing elaborate sprite multiplexing and stuff know much more about this - but even a simple piece of software like "the demo", written in C, involves dozens of little timing considerations. How long does it take to load something from disk, how long does it take to make the calculations, what needs to happen concurrently, does something have a proper effect at the given speed, etc. - and what's the runtime of the complete end result on different machines? In the end, to simplify things a bit, I decided that "the demo" is tailored to a 7Mhz OCS Amiga without FastMEM. It runs fine on faster Amigas, but you lose the nice realtime-drawing Lissajous curves, they just pop up, and the music cuts off at the end.
![]() |
| A tile-effect in "the demo" |
Fixed-point math was used for the Lissajous curves and the 3D graphics. It not fully optimized, e.g. uses multiplications where maybe a bit-shift would've been possible, but it's still waaaay faster than software floating-point calculations.
Sine and cosine functions were replaced by a CORDIC algorithm, adapted from the Python code found on Wikipedia: https://en.wikipedia.org/wiki/CORDIC.
The Lissajous curves code is an adaptation of the code found at BIT-101's old blog: https://bit-101.com/2017/2022/11/coding-curves-04-lissajous-curves/
The mandelbrot set code is also an adaptation of the code found on Wikipedia: https://en.wikipedia.org/wiki/Plotting_algorithms_for_the_Mandelbrot_set
"The demo" uses medplayer.library for music playback. I was surprised by hearing the floppy drive load the graphics from floppy disk, while the music kept playing. Wasn't there a thing with PAULA and the disk drive? Or is it in medplayer.library? Anyway, very nice, no need to handle music pauses when loading new data.
Overall, the amount of tech that went into "the demo" was a little bigger than expected: It also has graphics double-buffering, multitasking, IFF ILBM loading, and an interrupt server.
You can download "the demo" from AmiNet, and run it on your own Amiga, if you like:
