ZX Spectrum: Assembly programming

Assemblers, emulators and debuggers

There are quite a few emulators around for the ZX Spectrum, and even more Z80 assemblers. So it can be hard to find the one that works best for you.

Disclaimer: while I found more assemblers, emulators and debuggers during the research for this article, I have not included them here since I have no experience with them. This is in no means an exhaustive list. As time progresses I might extend the list but I don’t want to write about a program with at least a minimal amount of personal use.

I have not listed the OS these programs are available on. And while I use Linux professionally I use Windows on my personal computer for compatibility with some of the programs I need for other hobbies. None of these programs are heavy on resource use and can easily run on an older machine. And they don’t use fancy graphics that would preclude them from being run in Wine on a *nix based machine. The Retro Virtual Machine is the fanciest in it’s UI, but it has a releases for Windows, Mac and Linux. There is no need to run this one through emulation or any other virtualization system.

Documentation is hard to get through
Bad editor (Selection of text is broken)
Awkward usage (cannot find key combinations)
OKWeak/Hard to use
Advanced features are hard to learn
Not yet found how to use
Retro Virtual MachineOK
The fancy UI makes it hard to use
Not yet been able to get to work
OshonSoft Z80 Simulator IDEBasic
Can use TASM
Z80 emulation only, no ZX SpectrumExcelent

Since I’ll be writing for the ZX Spectrum for now I can’t use the OshonSoft IDE. While the emulation and debugger are excellent, I need the emulation of the whole system.

I have bought myself a license for the OshonSoft IDE and plan to use it once I start programming for a custom system.

Originally I started with doing everything in ZXSpin, but the bad editor and basic assembler made me look for alternatives.

I will be using the SJASMPlus assembler since it has the most features. It has specific functionality for the ZX Spectrum but can also be used for a self assembled machine. While I probably won’t need a whole lot of the advanced functionality (Lua scripting for example), being able to include other files and split up the work is the most important requirement I currently have.

I can’t see myself working on a large project using only a single source file.

For the emulation of the ZX Spectrum I’m currently using Zesarux. I’ll have to search to find out how to use the debugging features.


While you can use notepad to write your code, it offers no support.

I’ve listed a few assemblers that are part of an emulator, but sadly those emulator don’t have the best assemblers, and the editing functionality is very basic.

While the ZXSpin editor has a list of the used labels, which can be used to navigate the code, it doesn’t offer much more. And on my computer selecting code with the mouse or even navigating with arrow keys gives strange results.

The OshonSoft IDE has code highlighting and is integrated in the debugger. It doesn’t list the used labels and the built in assembler is basic and there is barely any documentation for. While TASM is included and better documented, it still is very basic. Using an external assembler makes it awkward to use since you have to switch to another window to call it.

There are a few code highlighting schemes available for Notepad++, I’m not sure if you can configure a key combination to call the assembler.

The 2 best options that I can currently think of are Atom or Visual Studio Code. Both have plugins that allow for code highlighting and can call the assembler.

For Visual Studio code there is a single plugin that handles all functionality I can think of needing. For Atom it’s a combination of plugins to have a working setup. I’ve installed both of them and try to see which setup works best. Once I have experience with both I will publish an article about this.

New project: ZX Spectrum Enigma

Project page

I’ve started a new project where I will attempt to make an Enigma simulator on the ZX Spectrum 48 in assembly. I’ve always had a fascination with the Enigma machine. Or I should say, I’ve always had a fascination with any vintage mechanical machines. And I really want to learn Z80 assembly, so I decided to write it for the ZX Spectrum.

I’m aware there have been implementations for the ZX Spectrum before – – and it isn’t only that this version is written in Basic, I think this project will be a good introduction for myself to program assembly again. At least the initial version will be limited in the visual aspect and it doesn’t include real animations, so quite a bit of it will be logic.

I intend to make my own Z80 processor based computer in a bit, but first want to experiment using an already working system. I have no special memories of any 8 bit processor so I looked at their specs and chose one based on those.

Some of my criteria that resulted in choosing the Z80: no multiple voltages (5V only), extensively used in period computers, still readily available (New, new old stock, second hand) and easy to build a circuit around (Not line multiplexing)

The 6502 and Z80 where the 2 big standouts. From there I picked the Z80 for a few reasons: separate IO addresses and execution starts at $0000. I personally think the way the 6502 has it memory organized very strange. The rom in the high part and starting code executing somewhere in the middle, and the limit of the 255 byte stack (The 6502 only uses 1 byte for the stack pointer).

I’ve never done any Z80 assembly programming, nor have I ever used the ZX Spectrum. I’ve done PLC programming and some x86 during my university years but that has been over 12 years ago (for PLC about 15 years). And while I now got about 12 years of professional Java programming experience, this won’t help me much in this case. I do know how to tackle problems and work out algorithms. But with assembly programming go to a much deeper level than I’m used to.

Basic project overview

In the basic version I plan to create 3 views in the program. The main one where you have a view of the 26 lighted characters. It won’t show the keyboard, since you will use the keyboard on the ZX Spectrum to enter the text. Then there will be a view showing an interface to choose and configure the rotors, and one for the plug-board.

I haven’t yet decided how to switch to the rotor or plug-board view or how these will be used. Also the design of those screens are something I need to think about.

For the screen with the bulbs I plan to show the 26 characters on discs and using the ZX Spectrum screen attributes change the colors. It will possibly also show an output of the processed character so you can see the encrypted or decrypted values for longer than you hold the key.

Optional extras

  • Show the rotor and plug-board settings on the main view. So you can also see the rotor positions progress.
  • Add a function to send the processed text to the printer.
  • Add the usage procedure instructions so you can follow these without having them externally.
  • Add support for the navy version of the Enigma (4 rotor positions and 8 rotors) or any of the others
  • Add code book generation. Since the ZX Spectrum has no persisted memory, we can’t store them.
    So they could be generated using a pseudo random value that the user enters. Or we could print them. The ZX Spectrum compatible printers have only a small amount of characters per line (the ZX Spectrum screen itself has the same problem) so printing the full settings on a single line won’t be possible (The plug-board settings take quite a bit of space)

Having original code books in the program won’t be possible due to size. And I don’t think the Germans used a pseudo random number generator to generate their code-books. (Joke)