CLC ; 2
LDA&70 ADC&74 STA&70 ; 3 3 3 = 9
LDA&71 ADC&75 STA&71 ; 3 3 3 = 9
LDA&72 ADC&76 STA&72 ; 3 3 3 = 9
LDA&73 ADC&77 STA&73 ; 3 3 3 = 9
That's for a total of 38 cycles. So on the computer I started programming on, you could do ~52,000 32-bit adds per second.By comparison, for a modern Pentium, according to Intel's docs, a 32-bit add (again, on data you're using) takes 1 cycle, end to end.
ADD ESI,EDX
So on the laptop that's in front of me, which is a crap one, you could do 2,530,000,000 32-bit adds per second. A 48,000-fold performance increase. Maybe 96,000 times, if you have no dependency chain (ADD throughput is 2 per cycle).This ignores the fact my modern computer has 2 cores.
But, "ADD ESI,EDX" is adding two registers isn't it? So I think you need to include the loading/storing of those registers back to memory for a more fair comparison.
I haven't touched 6502 assembly in over 20 years. Brings back memories. :-)
CLC ; 2
ADC #b1 STA&70 ; 0 2 3 = 5
LDA #a2 ADC #b2 TAY ; 2 2 2 = 6
LDA #a3 ADC #b3 TAX ; 2 2 2 = 6
LDA #a4 ADC #b4 ; 2 2 = 4
; total 23 cyclesPerhaps the code is intended to be modified at runtime, but then you'd then still want one of the operands loaded from memory, I think (otherwise why not just precalculate the results?), and I've generally found the (fairly substantial) fixed expense not to be worth it anyway.
Anyway, overall I think you're being a bit unfair to the x86 with this comparison.
You're even playing nice against the 6502, you're using a simple add, now compare with SIMD instructions
Things felt faster in the 80's than they did now, even doing the same tasks.
Waiting a few seconds every time I hit save was fun. Didn't stop me from developing a ferocious ^S reflex. Fortunately, save is fast enough not to be noticeable these days, to the extent that it usually happens automatically now.
Watching a WYSIWYG font menu draw each individual entry was fun. We certainly don't get that pleasure now.
But yes, things certainly felt faster in the 80s.... /s