How close is the ZX80/81, Jupiter Ace and Spectrum in machine code backwards hardware compatibility?

Discussions about Sinclair ZX80 and ZX81 Hardware
Post Reply
WayneM
Posts: 2
Joined: Thu Jun 09, 2022 5:20 am

How close is the ZX80/81, Jupiter Ace and Spectrum in machine code backwards hardware compatibility?

Post by WayneM »

Hi, I'm curious in how backwards compatible programming in machine code, is between hardware in the ZX80, ZX81, Jupiter Ace and Spectrum?

I'm curious if a machine can made to run all 4 sets of software?

Is it a matter of different address mapping, such as it would work if you had a system that remapped the address space when running a program for another system, or are they fundamentally different?

Is the components structure similar enough to make a machine from components which could run all 4 sets of software?

External peripherals hardware compatibility doesn't matter, except for joysticks of course.

I ask because I'm curious about new hardware, or the possibility of modifying existing hardware to do this.
User avatar
1024MAK
Posts: 5118
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...

Re: How close is the ZX80/81, Jupiter Ace and Spectrum in machine code backwards hardware compatibility?

Post by 1024MAK »

WayneM wrote: Sun Feb 25, 2024 12:49 am Hi, I'm curious in how backwards compatible programming in machine code, is between hardware in the ZX80, ZX81, Jupiter Ace and Spectrum?
Not very is the generic answer.

Let's take the ZX80 and ZX81 first, If you are careful, the same program can run on both of these. However, the tape format is different. The ZX80 does not have the hardware to support 'SLOW' (compute and display) mode, it only has 'FAST' mode. If you take this into account, the same machine code program can run on either machine. Its BASIC is more limited, but you can use a ZX81 ROM in it. If you do this (fit a ZX81 ROM), then you can LOAD and run ZX81 programs, but they will always run in 'FAST' mode. The memory map is almost the same from a hardware point of view. As is the I/O circuitry.

Comparing a ZX80/ZX81 with a ZX Spectrum: there are significant differences in hardware and in the BASIC. The memory map is not too much of a problem except that in a ZX80/ZX81 the 'display file' is determined by software. But in the ZX Spectrum, it's fixed in the 'lower' RAM area. It also is much larger. Yes you can store data and run machine code in the screen memory area, but you will see it on screen and if the program returns to BASIC, it will likely overwrite it... The system variables used by BASIC are different. Combined, this means that a ZX80/ZX81 machine code program has to be carefully designed if you want to run it on all these computers.

The keyboard layout is different, that is, the matrix is wired differently, as is the rest of the I/O. The screen is laid out very differently, being bit mapped rather than character mapped. BASIC has changed a lot, and the ZX Spectrum BASIC cannot LOAD ZX80 or ZX81 programs.

With all three (ZX80, ZX81 and ZX Spectrum), as long as you only use compatible BASIC, type-ins will work across all three. But this does rather limit what you can do.

Yes, the same machine code program can run on all three, but you have to take the different hardware into account. By the time you have done this, it would have been more practical to write a different version for each machine...

The Jupiter Ace is different again, The memory map is different, as is the I/O. The screen is very different to the Sinclair computers. It's fixed in the memory map, is character based, but nothing like the system used by the ZX80/ZX81. And it runs Forth rather than BASIC.

Again, yes, it's possible for a machine code program to be written that will run on a Jupiter Ace as well as a Sinclair 8 bit computer, But realistically, now you will have so much conditional code, its not really practical.
WayneM wrote: Sun Feb 25, 2024 12:49 am I'm curious if a machine can made to run all 4 sets of software?
So the answer is, yes, but in practice, it's not worth it.

Mark
ZX81 Variations
ZX81 Chip Pin-outs
ZX81 Video Transistor Buffer Amp

:!: Standby alert :!:
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb :!:
Looking forward to summer later in the year.
User avatar
1024MAK
Posts: 5118
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...

Re: How close is the ZX80/81, Jupiter Ace and Spectrum in machine code backwards hardware compatibility?

Post by 1024MAK »

Memory Maps compared

ZX80 / ZX81

Code: Select all

0000-1FFF   ROM (8K bytes for ZX81, 4K bytes for ZX80
2000-3FFF   Echo of the ROM
4000-7FFF   RAM (1K or 16K bytes)
8000-BFFF   Echo of the ROM
C000-FFFF   Echo of the RAM, used for generating the display
Spectrum 16K/48K/Spectrum+ Memory Map

Code: Select all

0000-3FFF   ROM (BASIC)
4000-7FFF   RAM ('lower' includes display from 4000 to 5AFF)               
8000-FFFF   RAM ('upper'/expansion for 48K/+ models)
Jupiter ACE Memory Map

Code: Select all

0000-1FFF R   BIOS ROM (8K) (FORTH Interpreter)
2000-23FF R/W VRAM BgMap/Pad with CPU priority (video DMA shows garbage)
2400-27FF R/W VRAM BgMap/Pad with DMA priority (CPU gets paused by /WAIT)
2800-2BFF W   VRAM Charset with CPU priority   (video DMA shows garbage)
2C00-2FFF W   VRAM Charset with DMA priority   (CPU gets paused by /WAIT)
3000      R/W Unused (mirrors of 1K Work RAM)
3C00      R/W Work RAM (1K)
4000-FFFF R/W Expansion RAM (or open-bus if none such)
The total amount of internal RAM is 3K (the CPU/DMA priority regions mirror to a single 1K VRAM block).
Note: BgMap/Pad contains 300h bytes BgMap, followed by 100h bytes Pad (the Pad is used to HOLD characters during formatted output, and to store filenames and fileheaders during load/save).

Mark
ZX81 Variations
ZX81 Chip Pin-outs
ZX81 Video Transistor Buffer Amp

:!: Standby alert :!:
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb :!:
Looking forward to summer later in the year.
dr beep
Posts: 2079
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: How close is the ZX80/81, Jupiter Ace and Spectrum in machine code backwards hardware compatibility?

Post by dr beep »

Hi, I'm curious in how backwards compatible programming in machine code, is between hardware in the ZX80, ZX81, Jupiter Ace and Spectrum?
Define compatible. As said. Storage on tape is already different so you need additional software to load from tape.
Another problem is the fact that ROM is on the same addresses on all devices.
On a SAM Coupe you can page other memory to the ROM-locations making the machine capable of running
all 4 machines with just a small part of extra software; during intrupt reading keyboard and display screen.

Back to a ZX Spectrum. If you accept some less fast machine then you can use my ZX81 and ZX80 emulators I have coded to turn a 48K ZX Spectrum into a 16K ZX81 or 16K ZX80. Not all games will run but lowresgames will run.
dr beep
Posts: 2079
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: How close is the ZX80/81, Jupiter Ace and Spectrum in machine code backwards hardware compatibility?

Post by dr beep »

Is it a matter of different address mapping, such as it would work if you had a system that remapped the address space when running a program for another system, or are they fundamentally different?
My emulators remap all memoryaddresses up 32K.


In (very) short:

Code: Select all

ZX81/ZX80
#0000-#1FFF ROM
#4000-#7FFF RAM

ZX Spectrum
#0000-#1FFF ROM
#4000-#5AFF Screen

#8000-#FFFF ZX81 reserved memory (except #A000-#BFFF where emulator code is coded)
dr beep
Posts: 2079
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: How close is the ZX80/81, Jupiter Ace and Spectrum in machine code backwards hardware compatibility?

Post by dr beep »

1024MAK wrote: Sun Feb 25, 2024 9:07 am Comparing a ZX80/ZX81 with a ZX Spectrum: there are significant differences in hardware and in the BASIC. The memory map is not too much of a problem except that in a ZX80/ZX81 the 'display file' is determined by software. But in the ZX Spectrum, it's fixed in the 'lower' RAM area. It also is much larger. Yes you can store data and run machine code in the screen memory area, but you will see it on screen and if the program returns to BASIC, it will likely overwrite it... The system variables used by BASIC are different. Combined, this means that a ZX80/ZX81 machine code program has to be carefully designed if you want to run it on all these computers.

The keyboard layout is different, that is, the matrix is wired differently, as is the rest of the I/O.
The keyboardlayout is the same. Only difference are the additional 3 bits for the hardware cassetteport
The screen is laid out very differently, being bit mapped rather than character mapped.
With an intrupt you can update the screen as if it was a ZX81, some software needed
BASIC has changed a lot, and the ZX Spectrum BASIC cannot LOAD ZX80 or ZX81 programs.
Again there is software to load ZX81 programs on the ZX Spectrum
With all three (ZX80, ZX81 and ZX Spectrum), as long as you only use compatible BASIC, type-ins will work across all three. But this does rather limit what you can do.
Even the BASIC is quite different UNPLOT. PLOT is pixelsize, etc...
Yes, the same machine code program can run on all three, but you have to take the different hardware into account. By the time you have done this, it would have been more practical to write a different version for each machine...
I used the source of a ZX Spectrumgame and altered it on the points needed for the ZX81.
I altered input and display but also the use of IX is prohibited on a ZX81.
The Jupiter Ace is different again, The memory map is different, as is the I/O. The screen is very different to the Sinclair computers. It's fixed in the memory map, is character based, but nothing like the system used by the ZX80/ZX81. And it runs Forth rather than BASIC.
A Jupiter ACE can be emulated like the ZX81 and the ZX80. Not done yet on a ZX Spectrum.
(well I did but did not release it due to speed problems, today it would be better coded)
Post Reply