ZX Spectrum Assembly, Pong – 0xFF Introduction
Translation by Felipe Monge Corbalán
Table of contents
ZX Spectrum Assembly
The aim of this tutorial is to learn the basic concepts that will allow us making our own developments in the Z80 Assembly for the ZX Spectrum later on.
To make the learning process more enjoyable, I propose to develop, step by step, a version of a video game that is perhaps one of the most famous of all time, Pong, compatible with 16, 48 and 128K ZX Spectrum computers.
At each stage we will have something new and functional, we will make things and then change them until development is complete.
The code we will develop will in many cases not be the most optimal, the aim is to learn how to do things in different ways, to know many of the Z80 instructions and some of the ZX Spectrum hardware.
Tools we will use
The tools we will use throughout the book are described below.
Text editor
Any text editor will do, no matter how simple, such as Windows Notepad. There are other free editors, more powerful and with syntax highlighting:
- NotePad++
- Visual Studio Code, with the Z80 assembly extension (imanolea.z80-asm)
- Sublime Text, install the z80asm-ti package
ZX Spectrum Emulator
There are many ZX Spectrum emulators, with the free ones being perhaps the best. I use ZEsarUX, a Spanish-developed emulator available for Linux, MacOS and Windows systems, and a few others.
Assembly compiler
We will use PASMO, a cross-assembler with versions for Linux, MacOS and Windows, which generates executable code for the ZX Spectrum, among other things.
PASMO works from the command line, if you are using Windows you need to add it to the Path system variable to be able to run it from any directory. In this video I explain how to do this.
Source code control
It is good practice to have some form of source control so that if something stops working, you can see how it was in a previous version.
In this case I chose Git, created a local repository and installed the Git Graph extension in Visual Studio Code. This is not essential, but highly recommended.
mhutchie.git-graph.
Visual Studio Code Extensions
If you are using Visual Studio Code, you will find it very interesting to install the Z80 Assembly Meter extension, it provides the size and clock cycles of each instruction.
thenestruo.z80-asm-meter
I also installed the Hex Editor to be able to open the contents of the binaries we will generate.
ms-vscode.hexeditor
Useful links
ZX Spectrum Assembly, Pong by Juan Antonio Rubio García.
Translation by Felipe Monge Corbalán.
This work is licensed to Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0).
Any comments are always welcome.
Pingback: ZX Spectrum Assembly, Space Battle - 0x00 Introduction - Espamática