Article View: comp.arch
Article #5726502 vs Z80 (was: carry-in)
From: Anton Ertl
Date: Sat, 07 Nov 2026 18:35
Date: Sat, 07 Nov 2026 18:35
92 lines
4866 bytes
4866 bytes
Thomas Koenig <tkoenig@netcologne.de> writes: >I *had* wondered why the 6502 got similar performance at 1 MHz as >the Z80 at 3 to 4. <https://en.wikipedia.org/wiki/Z80#Instruction_execution> says: |Each instruction is executed in steps that are usually termed machine |cycles (M-cycles), each of which can take between three and six clock |periods (T-states). It gives examples, e.g. INC B takes 1 M-cycle consisting of 4 T-states. On the 6502 INX and INY take 2 cycles. ADD HL, DE takes 3 M-cycles consisting of 11 T-states. The 6502 does not do reg-reg adds and does not have 16-bit registers, but the minimum would be something like: #L in A # C is known to be clear, otherwise preprend CLC at 2 cycles adc E # E in zero page sta L lda H # H in zero page adc D # D in zero page #H in A with a total of 12 cycles. INC (IY+d) takes 6 M-cycles and 23 T-states On the 6502 this might be either # IY in x, but x can only hold 8 bits INC d,x # 6 cycles with d in zero page, 7 otherwise or, if that's too restrictive, # IY in zero page # C is known to be clear, otherwise preprend CLC at 2 cycles ldy #d lda (IY),y adc #1 sta (IY),y with a total of 14 or 16 cycles. So even this sequence beats the Z80 in terms of cycles (but not by a factor of 3 or 4). The restricted version beats it by a factor of 3-4 in cycles. So if the 6502 programmer could arrange to use of INC d,x for INC (IY+d) often, and the Z80 progammer could not make use of ADD HL,DE often, the factor of 3-4 in cycles is possible. However, my impression is that there is a lot of cherry-picking in such reports. For a more recent and, I think, more balanced report, but still using only one particular task popular in benchmarking during the period, <https://www.ele.uva.es/~jesus/sieves/update.pdf> reports a factor 1.9 more cycles on the Z80 than the 6502 (so a TRS-80 Model I (1.78MHz Z80) would perform very similar to a PET or Apple II (1MHz 6502)); however, 4MHz became a more common clock rate for Z80 systems, while even the 1982-vintage C64 still has only 1MHz. More on the sieve comparison can be found on <https://www.ele.uva.es/~jesus/sieves/sievetst.html>. This also points to an earlier paper by Jesus Arias <https://www.ele.uva.es/~jesus/sieves/onthe6502.pdf> where the benchmark programs were less optimized, but the relations between 6502 and Z80 are similar. But the interesting thing for an earlier discussion here is that he also compares to the BN16, a 16-bit RISC processor he designed. It takes 7678 transistors in CMOS, and he estimates that it would be 3000-4000 transistors in NMOS, which would be similar to the 6502. With that the task takes a similar number of executed instructions as on the 6502, but many fewer clock cycles. Apparently the BN16 uses a 16-bit data bus (it achieves 1.11 CPI), so it would be too expensive to use at the time. Designing it for an 8-bit data bus would take some more transistors and increase the CPI to 2.11 (with the same instruction set), but that's still better than the 6502's CPI of 3.04. Maybe one could design a CPU with lessons from RISCs, but also including 8-bit-wide instructions for a better CPI and smaller programs, without too many additional transistors. - anton -- 'Anyone trying for "industrial quality" ISA should avoid undefined behavior.' Mitch Alsup, <c17fcd89-f024-40e7-a594-88a85ac10d20o@googlegroups.com>
Technical Details
Message-ID:
<2026Nov7.193528@mips.complang.tuwien.ac.at>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<10uks4f$1dqo$1@gal.iecc.com> <6ae8eec0.35320218@news.eternal-september.org> <11cjh58$1flq$4@gal.iecc.com> <2026Nov6.072410@mips.complang.tuwien.ac.at> <11cl9d6$464$1@gal.iecc.com> <2026Nov7.084134@mips.complang.tuwien.ac.at> <11cn4dv$3d6gj$1@dont-email.me> <2026Nov7.171914@mips.complang.tuwien.ac.at> <11cnq5j$3mb2u$1@dont-email.me>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: anton@mips.complang.tuwien.ac.at (Anton Ertl) Newsgroups: comp.arch Subject: 6502 vs Z80 (was: carry-in) Date: Sat, 07 Nov 2026 18:35:28 GMT Organization: Institut fuer Computersprachen, Technische Universitaet Wien Lines: 92 Message-ID: <2026Nov7.193528@mips.complang.tuwien.ac.at> References: <10uks4f$1dqo$1@gal.iecc.com> <6ae8eec0.35320218@news.eternal-september.org> <11cjh58$1flq$4@gal.iecc.com> <2026Nov6.072410@mips.complang.tuwien.ac.at> <11cl9d6$464$1@gal.iecc.com> <2026Nov7.084134@mips.complang.tuwien.ac.at> <11cn4dv$3d6gj$1@dont-email.me> <2026Nov7.171914@mips.complang.tuwien.ac.at> <11cnq5j$3mb2u$1@dont-email.me> Injection-Date: Sat, 07 Nov 2026 19:53:51 +0000 (UTC) Injection-Info: dont-email.me; logging-data="3951308"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18OGPkuObyY2MMM3XHX3XM2"; posting-host="311f2d42f8002bf9ed9618beacf20f3c" Cancel-Lock: sha1:gA64Pa25UT/o8gZsYZS/OF79Iis= sha256:VKXkSjOuDpMsdQFWyhR9AoCM8EQ1Vor/0H/l016ETiQ= sha1:gvf/hxeV+iRLiSsQQtNUHnya40k= sha256:Q41jNFRNulQpr53dKXsNsnPE5QT5Pa0URwkE4Bbi/Ko= X-newsreader: xrn 10.11