And so it begins… Again…
Well, I’ve finally dusted off my Z80 programming skills and after a little refresher course with the University of Internet I’ve developed this sprite demo.
Most of the concepts here are not new; they are how I wrote games back in the day. The sprite routine is basic; it does not mask, but it is using pre-shifted sprites and running within a vertical interrupt routine. The red border, by the way, indicates how much raster time the sprite draw is taking up. I set the border to red at the beginning of the vertical interrupt and back to white after my code has finished doing everything. The red occupies nearly all of the screen; therefore the code is taking nearly a 50th of a second up (that’s how much time you have to do everything in a game that you want to run at a smooth 50hz).
There is much room for improvement; the sprites flicker, probably because I’m clearing and drawing them in a random order and paying no attention to the screen redraw, though how that works through emulation beats me!
The demo (and any future updates) can be found here.
The code is given as-is and on the understanding that it will improve! I don’t really want to give you polished code, partly down to my time constraints but mostly because it will not show you how to turn rough code into something you can be proud of.
Update
I’ve added the demo code to an online Spectrum emulator which can be accessed by clicking here.