ZX Spectrum ROM Source

Using the link below you can download the 1982 ZX Spectrum ROM package.

The package provides the source code for the 1982 Sinclair Research ZX Spectrum ROM. The source and annotations are taken over from The Complete SPECTRUM ROM DISASSEMBLY by Dr Ian Logan > Dr Frank O'Hara. This copy is available on The World Of Spectrum (http://www.worldofspectrum.org/)

Reason for me to it get re-acquainted with the ASZ80 assembler linker, which is a brilliant piece of software. There is also reasonable support. I like it mostly because is gives me full control, let me break down the assemblies and the linker can relocate the result wherever you want. The ASZ80 assembler also has extensive documentation. The only drawback seems to be that it does not use ZILOG's assembler directives.

Although it was fun to do and brushed up my knowledge about ASZ80, of course changing the ROM has no practical purpose really. I make it available because the ROM source could be a show case what can be done and may get you into using this assembler too. I found it more versatile than z80asm, but this could also be lack of knowledge of that assembler. Any way, here you have it.

The following link points to the ZX Spectrum ROM source: ZXSpectrumRomSource.zip Read README.txt for more information.

Spectrum Shadow ROM Source

Using the link below you can download the 1983 Spectrum Shadow ROM package.

The package provides the source code for the 1983 Sinclair Research Spectrum Shadow ROM as used in the ZX Interface 1. It containts a combined source for the two versions of the ROM known to exist. The source and annotations are taken over from the Spectrum Shadow ROM Disassembly by Gianluca Carri. This copy is available on The World Of Spectrum (http://www.worldofspectrum.org/)

After doing the ZX Spectrum ROM, I just wanted to complete the set. Besides that the book describes in detail the ROM version 1 but only handles ROM version 2 in the appendix. So with this we now have an editable plain ASCII copy of the second ROM version too, which as far as I know did not exist until now.

By making the code compile and comparing the output with the actual ROMs also some mistakes in the book were corrected. There are a few errors in the book and in one case a complete statment was lost at a page break. But also some other minor differences. Also some errors were cause in the ASCII scan of the book when the code was correct in the actual book. For example number 1 is sometimes scanned as a lowercase 'l' in the scan. I'm not sure I caught them all but at least it is consitent now to be able to get it assembled.

The output of this source gives a byte for byte identical ROM. Also it became clear that although the second version of the ROM has mostly identical code compared to the first version, the order in which they are assembled in the ROM is completely mixed up. With ASZ80/ASLINK it is just a matter of changing the order in the link file. When using another assembler this might be something that is not as simple. With only a few conditional code parts we have the source for both ROMs in one set of source files.

Like the ZX Spectrum ROM changing the ROM has no practical purpose really. For the Interface 1 even less so that for the ZX Spectrum ROM. Still some parts may come in handy, for example if you want to read from the Microdrive without using the Shadow ROM by having a copy of the read code in your own program. Any way, just like the ZX Spectrum ROM, here you have it.

The following link points to the ZX Spectrum ROM source: SpectrumShadowRomSources.zip Read README.txt for more information.

ZX Spectrum ROM and Spectrum Shadow ROM labels

If you want to create your own program but want to call procedures in the ROM or shadow ROM or need to access system variables or locations in the memory map it would be nice to call the procedures by name instead of by address. For example the Shadow ROM source calls procedures in the main 48k ROM; to do this it uses the labels defined in "rom.asm" so for example the code can just call print_a_1 to call the print_a_1 routine in the ROM. Or use label "screen" as start address for the screen etc. Also the labels for the shadow ROM are present. When you create a program for the first issue ROM and use "shadow1.asm" for the labels then by swapping "shadow1.asm" for "shadow2.asm" you can assemble your source for the second edition of the Shadow ROM.

All labels originate from the sources that build the ROMs, which means that all addresses are correct because they were generated and not manually entered.

The labels are in ASZ80 assembly but I think it is easy to adjust the file for use with another assembler. Just grab it if you think it might be useful.

The following link points to the ZX Spectrum ROM source: RomAndSysvarLabels.zip

Links to the ASZ80/ASLINK assembler and linker

The following link points to the ASxxxx Cross Assembler ROM source: http://shop-pdp.net/ashtml/asxxxx.htm

World of Spectrum with much, much information about the ZX Spectrum: http://www.worldofspectrum.org/

Creating tbblue.mmc file

ZX Spectrum Next emulators ZEsarUX and CSpect need an SD card image to work. I made a script to create such an image since the one supplied with the emulators was outdated at the time.

Below you find a link to a zip with a script I used to create a tbblue.mmc image. You need to be on a Linux system for this to work, I just use Linux Mint but I think it will work on most others as well. You need to edit creat_tbblue.sh if you want to define a different destination folder, currently it will create a folder "sd" in the current directory to put the results into. You can also adjust the size you want. I used 256 MB.

Prerequisites: In the folder where I run this script I have a folder "tbblue" with the latest pull from the GIT repository. I also have a folder "extra" with additional files I want to have in the image like the CP/M files.

Run the script by:
> bash ./creat_tbblue.sh
Besides tbblue.mmc, which the script will generate, also the Next ROM files are needed for CSpect. They are copied too to the destination folder besides the tbblue.mmc image.

The image works for both ZEsarUX as CSpect last time I tried. There is no guarantee if either the emulator or tbblue files changes. This is just provided AS-IS. If you are unsure just use the official releases.

Note that previously I had a pre-buid tbblue.mmc in the zip file, I removed it because it is outdated fast as development continues.

Zip file with the script to create it, including this readme.txt: tbblue_mmc.zip

The tbblue GIT repository (use "git clone" to clone it to your local disk and "git pull" to update): https://gitlab.com/thesmog358/tbblue.git

Other tools from the past

Using the link below you can download 2 files I made back in the day.

First file is "newrom.zip" which was my modification of the ZX spectrum ROM. This version floats on The Internet as "groot.rom" with the remark that it infringes the Amstrad copyright, however the file "newrom.zip" is how I released it. It was never uploaded as patched ROM by me.

The "newrom.zip" file containts the description of the changes and a file and DOS program to patch the original 48K Spectrum ROM. It does not contain the ROM. You need to have the ROM to be able to modify it. This way, nothing in "newrom.zip" is owned by Amstrad.

The second file "spec232.zip" is a set of tools to communicate from a (DOS) PC to the Sinclair Interface 1 serial port. It's written for DOS and has direct access to the UART. I don't know if it successfully works under windows since you need access to the hardware flowcontrol without any delay.

The "spec232.zip" also contains a wiring diagram, how to connect IF1 to the PC's COM port.

The RS232 connection.

Drawing for a COM port with a 9 Pin D connector. You need one male and one
female connector.

               Both connectors shown at the wire side!

    Female (COM port)                     Male (ZX Interface 1)
  │      ____  │                              ____
  │     /   1| │                             |1   \
  │   /6   O───┤                             | O   6\
  └─────O   2| │                             |2   O  |
     | 7   O────────────────────┐ ┌────────────O   7 |
     |  O   3| │              ┌─│─┘          |3   O───────┐
     | 8   O──────────────────┘ └─────────────-O   8 |    │
  ┌─────O   4| │                             |4   O  |    │
  │  | 9   O───┴───────────────────────────────O   9 |    │
  │  |  O   5|                               |5   O  |    │
  │   \    O─────────────────────────┐     ┌───O    /     │
  │     \____|                       │     │ |____/       │
  │                                  │     │              │
  └────────────────────────────────────────┘              │
                                     │                    │

Signal names:

COM port:                                   ZX Interface 1 port
pin 1 (in) : Carrier Detect (DCD)           pin 1 (---) No connection
pin 2 (in) : Recieved Data (RXD)            pin 2 (in)  TX data
pin 3 (out): Transmitted Data (TXD)         pin 3 (out) RX data
pin 4 (out): Data Terminal Ready (DTR)      pin 4 (in)  DTR
pin 5 (---): Signal Ground (SG)             pin 5 (out) CTS
pin 6 (in) : Data Set Ready (DSR)           pin 6 (---) n.c.
pin 7 (out): Request To Send (RTS)          pin 7 (---) Ground
pin 8 (in) : Clear To Send (CTS)            pin 8 (---) n.c.
pin 9 (in) : Ring indicator (RI)            pin 9 (---) 9 Volt

Don't comment to me if you find the names at the Interface 1 side funny.
I didn't invent them, they come straight out of Clive's "Microdrive and
Interface 1 manual" page 49.

It also contains an early version of SPConv. This program is also available on the World Of Spectrum, the one included here was at the time sufficient to make snapshots from saves.

Both are written way back when, but maybe they are usefull to somebody.

The following link points to a file to modify the ZX Spectrum ROM (with source): newrom.zip

The following link points to the RS232 Interface 1 to PC tools (with source): spec232.zip

Henk de Groot (pe1dnn@amsat.org)

Valid HTML 4.01 Transitional