Why is the ZX81 so slow?

Y'know, other stuff, Sinclair related.
Post Reply
MrPixel
Microbot
Posts: 170
Joined: Sat Mar 24, 2018 7:42 pm

Re: Why is the ZX81 so slow?

Post by MrPixel »

1024MAK wrote: Fri Apr 13, 2018 4:29 am
MrPixel wrote: Tue Mar 27, 2018 6:37 am i'm curious. the zx81 is a good little computer, why is it that it is so slow in emulation. was it like that during release :?:
The ZX81 is actually faster than a ZX Spectrum for some operations.

Mark
how so?
User avatar
1024MAK
Bugaboo
Posts: 3115
Joined: Wed Nov 15, 2017 2:52 pm
Location: Sunny Somerset in the U.K. in Europe

Re: Why is the ZX81 so slow?

Post by 1024MAK »

MrPixel wrote: Fri Apr 13, 2018 6:13 pm
1024MAK wrote: Fri Apr 13, 2018 4:29 am The ZX81 is actually faster than a ZX Spectrum for some operations.

Mark
how so?
The CPU in a ZX Spectrum runs at a slightly faster clock rate than the CPU in a ZX81, but when the ZX81 is in FAST mode, the differences in the code for the BASIC interpreter mean that for some operations, it is slightly quicker. Also on the ZX Spectrum, the BASIC program runs in RAM that suffers from contention (the ULA chip pauses the Z80 CPU during memory reads when the ULA is generating the video picture). Have a look at this article on BASIC program benchmarks here.

Mark
:!: Standby alert :!:
“There are four lights!”
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb :dance
Looking forward to summer later in the year.
AndyC
Dynamite Dan
Posts: 1403
Joined: Mon Nov 13, 2017 5:12 am

Re: Why is the ZX81 so slow?

Post by AndyC »

1024MAK wrote: Sat Apr 14, 2018 2:01 am The CPU in a ZX Spectrum runs at a slightly faster clock rate than the CPU in a ZX81, but when the ZX81 is in FAST mode, the differences in the code for the BASIC interpreter mean that for some operations, it is slightly quicker. Also on the ZX Spectrum, the BASIC program runs in RAM that suffers from contention (the ULA chip pauses the Z80 CPU during memory reads when the ULA is generating the video picture). Have a look at this article on BASIC program benchmarks here.
From which you could say that BASIC on the ZX81 is faster than on the Spectrum, but not generically that the ZX81 is faster. Even in FAST mode, assembly language running from uncontended ram on the Spectrum will out perform the same Z80 code running on the ZX81.
User avatar
1024MAK
Bugaboo
Posts: 3115
Joined: Wed Nov 15, 2017 2:52 pm
Location: Sunny Somerset in the U.K. in Europe

Re: Why is the ZX81 so slow?

Post by 1024MAK »

Yes, machine code in non-contended RAM will always be faster on a ZX Spectrum than a ZX81 running in FAST mode. Hence why in my original post I worded it very carefully.

With machine code in, or using contended RAM, it very much depends on what it is doing and when it it doing it (compared to where the ULA is with respect to drawing the video image).

The reason that the ZX Spectrum BASIC is rather slow is simple. Sinclair wanted to pack as many features as possible into the 16k byte ROM. So the code was written to be as compact as the software writers could manage. As the code was optimised for a small code size, it's not possible to also code for a fast speed at the same time. Compare this to the Acorn BBC Micro, where it has 16k bytes of ROM dedicated to BASIC alone and nearly another 16k bytes of ROM for all the system routines (the MOS or OS).

Mark
:!: Standby alert :!:
“There are four lights!”
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb :dance
Looking forward to summer later in the year.
Post Reply