Glimpse into the world of Cycle Exact programming

The retro fever caught me again. I am these days quite busy with my RC models like helicopters and multicopters, but I felt it was time again to explore some topics around the Commodore 64 hardware. I stumbled upon the website of Michael Steil. He was the author of the 15 Second Disk Copy program on the C64. He is still very active and also had some presentations on the 28C3 events, organized by the CCC (Chaos Computer Club). For every Commodore fan I can really recommend to explore his site. There are also links to his presentation on YouTube. I particularly enjoyed the “Ultimate C64 Talk”.

New for me was, that the assembly professionals know, how much cycles the processor need for a certain instruction. So the optimization for the code in demos  goes that far, that different ways in assembly are used, to safe just two or three CPU cycles. Aiming the goal of speeding up the routines. But sometimes it was not only about making things faster for the sake of being faster. It was necessary because of the C64s video chip (VIC)  and how certain graphic tricks are done, on a machine with so limited resources. For the developer tt was like an ongoing battle between the raster beam, creating the next image on the TV screen. Only when the raster beam is in the invisible area of the screen on top and bottom, there was enough time for calculations or other stuff. But even between raster lines, things needed to be done. I heard one developer in another 28C3 presentation saying, that he is after a Zen like perfection in his code and still aiming for more perfection.

Even more challeging as on a C64 was the programming on the good old Atari VCS 2600. Another 6502 based system, but the design seems to be “the most f***ed up” of all systems of that time – quoting another developer. The VCS doesn’t even has a video memroy, its just a raster line memory. So what happened on a VCS screen, needed to happen pretty much in real time. You always had to deal with the raster beam and adjust your code to its timing. These days  I thought how easy it was to develop games in the past, compared to today. Looking at the VCS, I must say that this is a challenge of its own. To wite a good games, you have to be an assembly genius. Below is a video of the 28c3 presentation, regarding the VCS 2600.

Leave a Reply