Hacker News new | ask | show | jobs
by cjauvin 5098 days ago
Very elegant and well done! I recently went through the process of learning 6502 C64 ASM (an unfulfilled childhood dream), by writing a simple Tetris clone:

https://github.com/cjauvin/tetris-c64

The basic concepts came very easily (with a quick skim through Jim Butterfield's ML book), but I struggled a bit more with the C64 hardware intricacies: zero page addressing, IRQs, double-buffering to avoid flickers, etc. This was a very interesting and enlightening experiment (in terms of the perspective it sheds on modern-day tools and languages), and I plan to write about it soon.

1 comments

It's pretty unusual to use double-buffering on the C64 - wastes memory. You'll find a lot of code times screen updates to the raster interrupt to either do updates during virtual blank, or start updates after the portion of the screen in question was updated. Of course that assumes you can do the updates in one frame, so you will find exceptions.
In fact, I don't know if what I did really corresponds to "real" double-buffering: at any point, the next move is created in an alternate buffer, which, when ready, is then switched as the visible portion of the video RAM (at vblank, using the raster interrupt). It works ok, but it's also quite possible that this mechanism might be a bit overkill.