A Brief z80 Assembly Tutorial

submited by
Style Pass
2021-05-30 08:30:05

In this brief tutorial I'm aiming to make a small game for the ZX Spectrum, written 100% in assembler. I've done a bunch of projects for the speccy using SDCC; while I couldn't completely escape assembly, the C compiler did a lot of heavy lifting for me. In other words, I traded control for convenience.

Now, since I've never actually done a 100% assembler project before (ignoring some tiny DOS TSR experiments), this is a learning experience for me as well. A lot of things I'll do here is likely not going to be optimal, but what I present is what happened to work for me. All the source code is free to use in whatever way you wish, with no warranty whatsoever.

Like I mentioned, the target is to make a game for the ZX Spectrum. More specifically, I'll be targeting a 48k subset of the 128k spectrum; I'll ignore the bank switching memory things of the 128k, but I want to use the audio chip of it. The result will also work on, but not use any of the advanced features of the ZX Spectrum Next.

For development, I'm using sjasmplus assembler, because it's convenient and can output .tap files all by itself - and if need be, scales up to other devices too, including Next's extended instruction set. As an emulator I'll be using the good old Fuse, which handles the pre-Next speccys so well that testing against actual hardware is rarely, if ever, necessary.

Leave a Comment