Pong Wars on the Commodore 64

Imran Nazar wrote up "Pong Wars on the Commodore 64," an incredible article detailing how a simple self-running game was implemented to run on hardware from the 1980s. It might seem like an odd bit of content for ByteCode.News, but:

  1. I love the Commodore 64. I have one on my desk right now. I'd show a picture as proof but my wife demanded I clean my office first and that's not happening - I'd have no idea where anything was.
  2. It's utterly fascinating to see the decisions that used to go into every line of code. Optimization today and optimization back then were very different even though the concerns should be the same.

Nazar walks through all of it, the 6510 assembler used to get stuff done, the math, all the shortcuts ("we don't use the random number generator because it's too slow, we reach for hardware instead because it's right there"), oddities related to actual bugs in the 6510 CPU itself that present optimization opportunities - leveraging a wraparound bug to calculate cosines from sines, precision concerns (since the 6510 had no innate floating point, so he uses a custom encoding for precise math)... and getting to the point of counting clock cycles.

When he calculates that he's able to render at 30fps - actually an achievement on that hardware in the first place - he can tell you exactly why, structurally, even without having to run it to check. And he can spend time thinking about ways to change that, and whether the effort is worth it.

It's utterly amazing, even if you don't have any Commodore 64 history, and it represents a mode of thinking that's incredibly useful even today, even if the techniques it yields matter less than they did.

Unless, of course, you're like me and you're actually looking at a Commodore 64 at this very moment.

Comments (0)

Sign in to comment

No comments yet.