Exercise 3: Register Count vs. Transistor Budget — Possible Solution ==================================================================== COUNTING THE REGISTERS ------------------------------ 6502 (cpu8bit1-3): A, X, Y = 3 general-purpose 8-bit registers total. Z80 (this chapter): the main set alone is A, B, C, D, E, H, L = 7 general-purpose 8-bit registers. Since the entire main set (A/F and BC/DE/HL) has a complete shadow duplicate, the total climbs to 14 when both sets are counted together (this doesn't even include IX/IY, which this chapter counts separately as dedicated index registers). THE RATIOS ------------------------------ Register count ratio: 14 / 3 ≈ 4.7x more registers on the Z80. Transistor count ratio (cpu8bit1-5): ~8,500 / ~3,500 ≈ 2.4x more transistors on the Z80. WHY THESE NUMBERS ARE CONSISTENT WITHOUT BEING A COINCIDENCE, DESPITE NOT MATCHING EXACTLY ------------------------------ The two ratios don't need to match exactly for the numbers to be "consistent" — the transistor budget isn't spent on registers alone. Per cpu8bit1-5's own breakdown, the Z80's extra ~5,000 transistors also pay for roughly double the instruction count, the CB/DD/ED/FD prefix-decoding logic needed to interpret those extra instructions, and the addressing-mode machinery cpu8bit1-7 covers next. Registers are one real, direct contributor to that budget (more storage circuitry clearly costs more transistors), but they're sharing the overall transistor increase with several other sources of richness at the same time — which is exactly why the register-count ratio (4.7x) comes out higher than the overall transistor-count ratio (2.4x): registers alone don't explain the WHOLE transistor gap, only a meaningful piece of it. THE BROADER POINT ------------------------------ Both numbers point the same direction — the Z80 spending noticeably more silicon than the 6502 — which is exactly what cpu8bit1-5's own framing predicts given the two chips' opposite founding constraints. The registers examined in this chapter are one concrete, traceable instance of that broader spending, not the sole explanation for it. WHY THIS WORKS AS AN ANSWER ------------------------------ It computes both ratios precisely rather than eyeballing "more registers, more transistors," and explains WHY the two ratios differ in magnitude rather than treating a mismatch as a problem — pointing specifically to the other transistor-consuming sources of richness cpu8bit1-5 already named.