Many people got started with computing in my age group with the Sinclair ZX81 (which in the US was sold as the Timex Sinclair 1000).

Reading through Allan Bromley's excellent papers on Babbage's Analytical Engine (as described in 1847) I thought it might be fun to compare the two machines.

The ZX81 has 1KB of memory in which programs and data had to be stored. The Analytical Engine as first imagined would have had 50 variables capable of each storing a 30 digit decimal number. That's equivalent to each variable having 100 bits and hence the memory for the Analytical Engine would have been 5000 bits (675 bytes). Later Babbage proposed much larger memory sizes with up to 50 decimal digits per variables and 1000 variables: that would have been a memory of 166 bits per variable or over 20 KB of memory.

Critically, the Analytical Engine's programs would be stored on punched cards and executed directly from them so that entire memory space was for data (not the program). In contrast the ZX81 had to load the program from magnetic tape into its 1KB of RAM.

But the ZX81 was much, much faster than Babbage's machine. It had a clock speed of 3.25 MHz. The Analytical Engine was based around a standard cycle time of 1/7s which is the same as 7Hz. To get an idea of the speed of the machines, here's a comparison of a 100 bit add on the two machines.

On the Analytical Engine it would take about three seconds to fetch the two numbers from memory (the store) and perform the addition. Although this is long Babbage added the ability to do a pipeline of multiple additions with overlapped reads from memory and addition happened in parallel. The ZX81 does not have that ability.

On the ZX81 in Z80 assembler a 100 bit addition (which I've done as 13 8-bit additions here) could be implemented as follows. I've assumed that

Each instruction there takes 19 clock cycles and there are a total of 39 instructions giving 741 clock cycles. With the Z80 running at 3.25MHz that set of instructions takes 0.228 ms. So for that addition the ZX81 would have been 13,000x faster.

Obviously, this is slightly bogus because there are other more complex and slow instructions in the Analytical Engine (such as division) but it gives an idea of the scale.

So, the ZX81 had much less RAM than the Analytical Engine (and who doesn't remember all the trouble of fitting everything into RAM on those machines) and was forced to use it to hold programs, but the Analytical Engine was slow in comparison.

PS If you'd like to see the Analytical Engine built, read this.

Reading through Allan Bromley's excellent papers on Babbage's Analytical Engine (as described in 1847) I thought it might be fun to compare the two machines.

The ZX81 has 1KB of memory in which programs and data had to be stored. The Analytical Engine as first imagined would have had 50 variables capable of each storing a 30 digit decimal number. That's equivalent to each variable having 100 bits and hence the memory for the Analytical Engine would have been 5000 bits (675 bytes). Later Babbage proposed much larger memory sizes with up to 50 decimal digits per variables and 1000 variables: that would have been a memory of 166 bits per variable or over 20 KB of memory.

Critically, the Analytical Engine's programs would be stored on punched cards and executed directly from them so that entire memory space was for data (not the program). In contrast the ZX81 had to load the program from magnetic tape into its 1KB of RAM.

But the ZX81 was much, much faster than Babbage's machine. It had a clock speed of 3.25 MHz. The Analytical Engine was based around a standard cycle time of 1/7s which is the same as 7Hz. To get an idea of the speed of the machines, here's a comparison of a 100 bit add on the two machines.

On the Analytical Engine it would take about three seconds to fetch the two numbers from memory (the store) and perform the addition. Although this is long Babbage added the ability to do a pipeline of multiple additions with overlapped reads from memory and addition happened in parallel. The ZX81 does not have that ability.

On the ZX81 in Z80 assembler a 100 bit addition (which I've done as 13 8-bit additions here) could be implemented as follows. I've assumed that

`IX`and`IY`are pointing to the operands in memory and that the result will be stored in the memory addressed by`IY`.

LD A,(IX+0)

ADD A,(IY+0)

LD (IY+0),A

LD A,(IX+1)

ADC A,(IY+1)

LD (IY+1),A

LD A,(IX+2)

ADC A,(IY+2)

LD (IY+2),A

[...]

LD A,(IX+12)

ADC A,(IY+12)

LD (IY+12),A

Each instruction there takes 19 clock cycles and there are a total of 39 instructions giving 741 clock cycles. With the Z80 running at 3.25MHz that set of instructions takes 0.228 ms. So for that addition the ZX81 would have been 13,000x faster.

Obviously, this is slightly bogus because there are other more complex and slow instructions in the Analytical Engine (such as division) but it gives an idea of the scale.

So, the ZX81 had much less RAM than the Analytical Engine (and who doesn't remember all the trouble of fitting everything into RAM on those machines) and was forced to use it to hold programs, but the Analytical Engine was slow in comparison.

PS If you'd like to see the Analytical Engine built, read this.

## Comments

I thought I read from your description that the ZX81 had 1KB of RAM and the AE 0.375KB - am I missing something?

LD A,(DE)

ADD A,(HL)

LD (HL),A

INC DE

INC HL

...

7+7+7+6+6=26T compared to 19+19+19=57T for the index register method – twice as fast!

You can save a further 4T by incrementing only the low byte of the pair, if the values are arranged so they don't span 256-byte boundaries.

..for those of you whose elder brother let you use his tape recorded -- I had to type my programs

a laBabbage :-)See: http://www.z80.info/z80arki.htm

Load Store to Mill

Load Store to Mill

Add

Load Mill to Store

If that is 4 cycles @ 7Hz= 0.57s

The Z80 is "only" 1124 times faster

HOWEVER

If the AE performs a multiplication in the same time as an addition (I am trying to find this out) I think the AE possibly could beat the Z80 here!!!

Now how about division, that is more complex/slower than multiplication.

Again how many cycles does the AE take to do a division?

The AE is (of course) multicyclic on multiplications and divisions.

Babbage had invented some clever look ahead mechanics but it looks like it would still take 59 cycles @ 7Hz ie 8.5 seconds to do a 50 x 50 decimal multiplication. The Z80 is going to beat it.

HOWEVER what about comparing it to the "first" microprocessor- the Intel 4040........