Z ZX Spectrum Emulator

The Z ZX Spectrum Emulator allows you to load and run
ZX Spectrum Basic programs on an MTX.
You appear to have a ZX Spectrum with 40KB of usable memory.
Not bad for 2.5KB of code.

How it works

When Z loads, it loads itself into the top 8KB of memory.

Z then loads an image of the Spectrum ROM saved in Sinclair tape
format to low memory.
Z didn't include a copy of the Spectrum ROM because this was
(C) Sinclair Research.
The idea was the customer would buy a tape with my code on it, then save
their own copy of the Sinclair ROM, from their own ZX Spectrum,
onto the end of it, thus neatly avoiding any licensing issue.
As it turns out, Z was never sold.
Nowadays, Amstrad allow the distribution of the Spectrum ROM,
and many emulators do.
There is also an improved replacement known as the
Gosh Wonderful ROM.

Z would then patch key ZX Spectrum specific portions of the ROM with
equivelent MTX code.
For example, the code in the Sinclair ROM to read the Spectrum keyboard
would be replaced by the code to read the MTX keyboard.
I even had code to load and save Sinclair format tapes,
and to print to the DMX-80 printer.

Z also includes an interrupt handler, called on a regular basis,
which read ZX Spectrum screen memory and converted it and sent it to
the MTX VDP chip.
This handler also read the MTX keyboard and computed scan values
to be given to Spectrum Basic when it reads the Spectrum keyboard.

Limitations

Games written in machine code, which don't use a recognised Sinclair ROM
entrypoint to access hardware won't work properly.
Z doesn't know where to patch them, and can't intercept direct port accesses
to Spectrum hardware.

Z runs in IM 2 whereas a real Spectrum usually runs in IM 1.
This means that if you use MEMU to take a .sna snapshot of Z
the result won't work in other emulators, and vice versa.
Some monkeying around with the .sna header is required.

ROM board

For fun, I made ROM board where the first ROM contained Z
and the next two ROMs contained the Spectrum ROM.
The Z ROM was an autoboot ROM which loaded the Spectrum ROM from the
other two ROMs.

Net result: A Memotech MTX that boots directly to Spectrum Basic.

Z2

Z2 is a slightly updated version of Z, with the following changes :-

It has the Gosh Wonderful ROM built-in,
so that doesn't have to loaded from tape

It supports slow and fast mode screen refresh (Z only has slow mode)

It includes various speed increases

It displays visual feedback to hot keys when pressed

It displays a picture of the Spectrum keyboard on the 80 column
screen when it runs

It doesn't cheekily patch the sign-on message, like Z does

It has better documented source code

Here is the keyboard map screen :-

Z2 supports these hotkeys :-

Volume down =F1

Volume up=F5

Switch between MEMU (the default) and real tape media =F2

Switch between fast (the default) and slow screen redraw =F8

Z will remain frozen as a record of what I built all those years ago,
but Z2 will likely evolve further as I think of ways to improve it.

Use in MEMU

Z can be assembled so that rather than access real cassette tape
hardware, it asks MEMU
to load or save a block of data from a .tap file.
This is a assembly time choice.

Z2 allows you to toggle between MEMU mode and real tape mode using F2.
Of course on real hardware, MEMU isn't there to help, and on MEMU,
the cassette ports aren't emulated at present.

Yes, you can run Sinclair BASIC, on virtualised MTX, on Linux or Windows.

Speculator

Tony Brewer made a product called the "Speculator".
This was a hardware and software combination.
The hardware provided memory behind Spectrum ports, and a mechanism
to convert the maskable interrupt signal /INT into /NMI.
The software includes loaders and an NMI handler to update the fake
Spectrum keyboard from the Memotech keyboard, and Memotech VDP from
the Spectrum screen.

REMEMOrizer
now includes Speculator hardware, and includes a program called
REZSPEC, based upon Z2, which exploits it.
This can not only load and run Spectrum BASIC programs, it can also
run many games which make direct access to Spectrum hardware.

Package

The Z package includes :-

Source code
- so you can see how it works

Z.COM binary using tape hardware
- so you can run it on real hardware

Z.COM binary asking MEMU to access .tap files
- so you can run it on MEMU

Z.mtx file equivelents
- made by wrapping the .COM file in a MTX BASIC loader

ROM images as .tap files, as needed by Z

Z2.COM binary using MEMU to access .tap files
- so you can run it on MEMU

BE initialisation files
- so you can poke around inside Z or Z2 as it runs in MEMU