IX

IY

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



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 thatandare pointing to the operands in memory and that the result will be stored in the memory addressed byEach 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