Z80
Contents
Introduction
Wanting to start sizecoding on a Z80 platform in this day and age can be tough.
So here is a bit of help to get you started:
Z80 for X86 programmers
Z80 can be seen as the little 8bit brother of X86 chipsets, with many similarities. If you are coming from a X86 background, this might help you get a bit more grip on the Z80.
ZX Spectrum
The ZX Spectrum consists of a Z80A @ 3.5 MHz CPU with either 16k, 48k or 128K of RAM.
Setting up
Setting up your development platform for the ZX Spectrum is quite easy, first get the following tools:
- Assembler: SJASMPLUS -This assembler has nice macros for creating Binaries and SNA snapshot files out of the box. You can download it at https://sourceforge.net/projects/sjasmplus/
- Emulator(s): I Found FUSE, UnrealSpeccy and EightyOne to work best for my usecase. Most emulators can read TAP, SNA and TRD files out of the box.
Video diplay
Video display on the ZX Spectrum is mostly CPU based with little hardware features. No hardware sprites, no specific text or video modes, only a 256x192 byte screenbuffer with 1bit pixeldata located at $4000 in memory. It is ordened a bit strange in 3 sections of 256x64 pixels, then character rows, then subrows.
ScreenPosition = (page<<11) + (character row<<8) + (subrow<<5)
It has has 8 colors (INK and PAPER) with 2 brightness settings that can be set like this.
color = brightness(64) | (PAPER<<3) | INK
Getting something on screen
Video display on the
Sound
The original Spectrum has only a 1 bit sound capability (BEEP) through its internal speaker. Later models included the AY-3-8910 Soundchip which provides 3 channels of PSG sound.