Try out your assembly and BASIC skills with a ZX Spectrum project

It can be really hard to warm up to coding in Assembly. But this tutorial looks to make it understandable and (almost) easy. It focuses on programming a game for the ZX Spectrum. But you won’t need the hardware on hand as you can just use the ZX Spin emulator as you work your way through the code.

Ostensibly this is a 30-minute tutorial but that’s a gross underestimate. We finished a cursory read of the tutorial and the building blocks are certainly clear and easy to understand. But we like to make sure we understand every line of code and plan to spread that out over the coming weekend.

The first chapter eases us into machine code by combining it with a bit of BASIC. You’ll see how to manipulate the ZX Spectrum memory and then pluck that value back out into the BASIC program. But once chapter 2 hits it’s pretty much all assembly from there on out. The nice thing is that as you go along you learn how the hardware works and there are quite a few references to pages in the manual so you can do some extra learning along the way.

15 thoughts on “Try out your assembly and BASIC skills with a ZX Spectrum project”

ZXSpin hasn’t been developed for quite some time now and has quite a few known bugs which can be quite frustrating. Personally I mostly use a win32 build of Fuse (The Free Unix Spectrum Emulator) but there are several very good emulators under active development.

If you want to go (quite) a bit further then hgave ahunt around on the web for a copy of “The Art of Assembly” by Randall Hyde. Yes, there is a printed book available, but the author put the whole work up for free many years ago, so you’re buying convenience, not pirating. It takes you one step further, on to dealing with the Intel x86 architecture (which is about as far, if not further than you need to go unless you are getting paid for it), and will do wonders for your programming technique even if you don’t make it past Chapter 1.

I still have my copy of “Programming the Z80″ by Rodnay Zaks on my bookshelf – I haven’t done any Z80 assembler for nearly 30 years and the book is falling part, but I can’t find it in myself to throw it away – mind you, new on Amazon it costs an astonishing £115GBP, or $130USD.

That is a book I’ve always wanted. At $130 I’m still going to always want it…

I have “Z80 Applications” and “Z80 Assembly Language Subroutines” and also wanted the Zaks book. I learned a lot from the second book and used part of it as a template for other assembly languages that I have learned.

It showed a ton of examples of how to do “atomic” operations. Three different ways to clear the accumulator. How to do a 10’s compliment. How to compare greater than vs. greater/equal using each of the registers or register pairs and memory. Tons of variations on testing/branching. Bunches of examples on looping.

The Z80 Assembly Language Subroutines book was the basis for becoming proficient at a lot of other assembly languages. At the time I programmed mainly in assembly the book was worth its weight in gold.