Questions tagged [z80]

The Zilog Z80 microprocessor. Prefer [game-boy] instead for questions about the Game Boy CPU nicknamed the ‘GBZ80’.

Filter by
Sorted by
Tagged with
108 votes
10 answers
42k views

Why do C to Z80 compilers produce poor code?

When reading some other questions about compiling C for the Z80, How much benefit should be expected on a more advanced compiler for z80/r800 based computers? Native C compiler for Sinclair ZX ...
Omar and Lorraine's user avatar
57 votes
8 answers
10k views

How were Western computer chips reverse-engineered in USSR?

The British ZX Spectrum computer had many clones in the Eastern Bloc. It seems many of them were built using Russian-made chips from the Angstrem factory in Zelenograd in/near Moscow. The Russian ...
Omar and Lorraine's user avatar
55 votes
13 answers
10k views

What languages are better fit for generating efficient code for 8-bit CPU's than C?

I found Why do C to Z80 compilers produce poor code? very interesting as it pointed out that C (which was leveraged to be an abstraction of a CPU for porting Unix) was not a very easy language to ...
Thorbjørn Ravn Andersen's user avatar
49 votes
2 answers
15k views

How did the Z80 instruction set differ from the 8080?

The Zilog Z80 microprocessor, known for its use in the ZX Spectrum, was designed to be a backwards-compatible extension to the Intel 8080 processor. It introduced several new instructions to the 8080'...
wizzwizz4's user avatar
  • 18.4k
44 votes
10 answers
15k views

Fastest non-emulated CP/M Z80-based computer ever built?

What were the fastest CP/M computers ever built? I'll restrict this to the Z80 variant of CP/M, no CP/M-86, CP/M-68k etc. Z80 compatibles with higher clock frequencies or more instructions/clock or ...
dirkt's user avatar
  • 26k
43 votes
7 answers
8k views

Did any computers use the Z80B?

The Z80 was one of the most popular CPUs of the seventies and eighties. In almost all cases that I know of, the version used was the Z80A, rated for 4 MHz, sometimes clocked a little slower in order ...
rwallace's user avatar
  • 58.4k
41 votes
16 answers
11k views

Did anyone ever use the extra set of registers on the Z80?

The Z80 has the surprising feature of a second set of registers. I suppose these were intended to be used for rapid task switching or interrupt handling, though I think if I were programming a Z80 ...
rwallace's user avatar
  • 58.4k
39 votes
4 answers
8k views

How do I Interface a PS/2 Keyboard without Modern Techniques?

I'm attempting to build a Z80 homebrew computer to teach myself the basis of electronic design. I planned to start from something simple, like a ROM, some SRAM, a video chip and a Z80-PIO. I'd like to ...
比尔盖子's user avatar
  • 3,074
39 votes
1 answer
4k views

Z80 CPU address lines not stable

I just got a Z84C0020PEC and wired it up to test it, using this circuit: Except that I've added LEDs to A0 through A9. It appears that A0 through A6 operate correctly, but A7 though A9 (I've not ...
Mike's user avatar
  • 493
38 votes
7 answers
24k views

Comparing raw performance of the Z80 and the 6502

A lot has been said on the internet about the 6502, at 1MHz, being roughly equivalent in performance to the Z80, at 4 MHz. It is said the Z80 has a typical 4 clock ticks per instruction, while the ...
Biff Iam's user avatar
  • 2,159
35 votes
2 answers
3k views

Can the two CPUs in a Commodore 128 run at the same time?

The Commodore 128 has two CPUs. One is some variant of the 6502, and the other is a Z80. One CPU is there for compatibility with the Commodore 64 and the other is there presumably to give basic ...
Omar and Lorraine's user avatar
34 votes
3 answers
5k views

What are the registers W and Z inside a Z80?

Looking at the Z80's architecture diagram, there is the obvious register file in pink near the middle of the diagram. But four of those registers are not usable by programmers. Those are W, W', Z and ...
Omar and Lorraine's user avatar
33 votes
2 answers
4k views

What is the relative code density of 8-bit microprocessors?

When RAM is at a premium, as it was in the old days, a greater code density of an instruction set can be a substantial advantage. (Click saver: Code density refers loosely to how many microprocessor ...
Leo B.'s user avatar
  • 18.3k
32 votes
2 answers
4k views

Why did the Z80 break 8080 compatibility?

Although the Z80 is nearly fully backward compatible with the Intel 8080, there are minor differences such as the Z80 handling the parity flag differently with certain operations. Why? Would providing ...
Paolo Amoroso's user avatar
31 votes
6 answers
3k views

Managing registers/memory effectively on the Z80

I've been writing assembly for the Z80 for some time, lately. Initially, I had no experience with working with 8-bit processors, but after going through a tutorial for my platform and spending a lot ...
v-rob's user avatar
  • 455
30 votes
2 answers
5k views

Zilog Z80 freezes while binary counting up to 65 536 (2^16)

A few days ago, I got Z80A CPU from eBay. So I tried to run it with classic 555 timer as a clock signal generator. I connected the 8-bit data bus of the CPU to the ground to "simulate ROM" (00 for NOP)...
Nogard's user avatar
  • 533
29 votes
4 answers
10k views

What's the difference between "opcode" and "instruction" in this Zilog ad?

In a Zilog ad from 1976 comparing the Z80 and Intel 8080, the following table is presented: What is the difference here between "Instructions" and "OP Codes"? In my experience, the two terms are ...
Psychonaut's user avatar
  • 7,023
29 votes
2 answers
5k views

Why did Sinclair choose the Z80 for its range of home computers?

The Sinclair computers are known for their low cost compared with other computers that were popular in the early 1980s. This is why they had membrane keyboards, or that rubber stuff in the case of the ...
Omar and Lorraine's user avatar
29 votes
1 answer
2k views

In the original Z80 layout, where are the "traps" located? And what are their effects?

According to Zilog Oral History, Zilog only had a tight schedule to design the Z80. Facing the potential competition, Federico Faggin and Masatoshi Shima were worrying about Japanese semiconductor ...
比尔盖子's user avatar
  • 3,074
27 votes
4 answers
4k views

Use of undocumented opcodes

I figure this is fitting for Retrocomputing.SE because CPUs like the 6502 and Z80 and the PDP-8, and probably others, have undocumented instructions and will happily execute them, in contrast with ...
Omar and Lorraine's user avatar
27 votes
4 answers
17k views

How did 8 bit processors perform 16 bit arithmetic?

How did 8 bit processors such as the Z80 and 8080 perform 16 bit arithmetic? They have an 8 bit data bus, so how does the ALU perform 16 bit arithmetic on the register pairs? Z80 architecture diagram ...
Jet Blue's user avatar
  • 1,985
27 votes
5 answers
5k views

Did underclocking the early Z80 chips improve yield?

The Z80, one of the most successful and well-known of the 8-bit microprocessors, was released in July 1976 at an initial clock speed of 2.5 MHz. The TRS-80 Model I, released the following year, is ...
rwallace's user avatar
  • 58.4k
27 votes
5 answers
5k views

DIY Project using 1970s 8-bit CPU, is it possible?

I've recently really wanted to try and design a computer system around a retro 8-bit CPU such as the Zilog Z80 or the Intel 8080, and I would appreciate some sanity checks! I was inspired by Ben Eater'...
Zee2's user avatar
  • 373
26 votes
5 answers
5k views

Why does the Z80 include the RLD and RRD instructions?

The Z80 has an instruction RLD, which apparently treats the lower 4 bits in the accumulator and the full 8 bits in (HL) as a twelve bit integer which it then rotates left by 4 bits. The carry flag ...
Omar and Lorraine's user avatar
26 votes
2 answers
5k views

How did Z80 multiprocessing work in the Namco Galaga hardware?

Galaga was a popular arcade game developed and released by Namco (Midway in N. America) in 1981. It had amazing, fast, smooth 2D-sprite graphics, and relied on Namco hardware that utilized 3 Z80 CPUs ...
Brian H's user avatar
  • 60.1k
26 votes
1 answer
5k views

Where does the Z80 processor start executing from?

Strangely I can't find this information anywhere online -- I've thoroughly looked at the datasheet, and I've searched things like "Z80 program counter initial value" -- but I can't find anything! My ...
Jacob Garby's user avatar
25 votes
8 answers
2k views

Separate code and data address spaces on the Z80

Reading through the Z80 datasheet, I noticed something interesting. The Z80 separates its instruction execution into separate phases (which are called "machine cycles" in the official literature, but ...
Jules's user avatar
  • 12.8k
25 votes
4 answers
6k views

Z8410 DMA chip as GPU?

There are basically two ways to design a 2D graphics system: Provide lots of hardware support in the form of tiles, hardware scrolling and sprites, to put together each frame on the fly from a small ...
rwallace's user avatar
  • 58.4k
24 votes
4 answers
5k views

How did the Apple II forward binary instructions to the Z80 software card with CPM?

Microsoft produced the Z80 Softcard for the Apple II enabling it to run CPM and many Z80 binary programs. This seems to be an unthinkable achievement. (For a kid who had an Apple IIe but was only a ...
hawkeye's user avatar
  • 2,565
24 votes
5 answers
3k views

How much benefit should be expected on a more advanced compiler for z80/r800 based computers?

I am self studying about compilers, and get hands on very good textbooks about the subject. I am thinking in develop a compiler using the almighty llvm infrastructure to cross compile to old computers,...
flavio's user avatar
  • 580
24 votes
3 answers
8k views

Wiring a Zilog Z80

I've recently got hold of an old Zilog Z80 microprocessor and I know how to clock and test it. I do not however know how to connect RAM, I/O ports, control switches (for programming instructions into ...
DevelopedLogic's user avatar
22 votes
6 answers
7k views

Why did the Z80 with 4-bit ALU out-perform the fully 8-bit Intel 8080?

Looking at the development and architecture of the Z80, it appears to be a scaled-down, cost-reduced (in terms of total system cost), clone of the Intel 8080. It only used a 4-bit ALU. I assume this ...
Brian H's user avatar
  • 60.1k
22 votes
2 answers
2k views

Will disassembling an 8080 program as Z80 code work?

The Z80 is "binary compatible" with the 8080. It adds a bunch of new instructions, but places them all in unused (well, undocumented) opcodes. Does this mean that if I disassemble an 8080 program (...
tobiasvl's user avatar
  • 1,459
21 votes
3 answers
3k views

Z80 to x86 asm translator?

8086 is source code compatible with 8080. Zilog Z80 extended Intel 8080 with: An enhanced instruction set including bit manipulation, block move, block I/O, and byte search instructions New IX and IY ...
Schezuk's user avatar
  • 3,732
20 votes
5 answers
4k views

Why does the Z80 have a half-carry bit?

The Z80 apparently had a 4-bit ALU, and computes 8-bit values in two stages. The half-carry bit preserves the carry from bits 3 to 4. Why did the designers of this chip choose to preserve that value ...
Omar and Lorraine's user avatar
20 votes
5 answers
4k views

How did old computers address far more than 64K of memory despite only having a 16 bit address bus?

I have an old Sharp PC-G830 pocket computer from the '80s that has 32K of RAM and 256K of ROM. I also have a simple single board computer I built with 128K of RAM and a few megabytes of ROM from a ...
Shades's user avatar
  • 311
20 votes
4 answers
4k views

How did integer multiplication work in 8-bit BASIC without CPU support

I've recently been teaching my 11 year old binary multiplication, which is on the UK maths syllabus at secondary school. We have used long multiplication, eg shift and add. This has made me wonder ...
Mark Williams's user avatar
20 votes
3 answers
6k views

How much did the 6502 and Z80 cost?

It is said that the 6502 was cheaper than the Z80. As of 1978, what were the actual prices of the two chips, in wholesale quantity?
rwallace's user avatar
  • 58.4k
19 votes
4 answers
4k views

Why is the Z80's supply pin in the middle of the data pins?

I recently came across this question, Why are IC pinouts often so illogical?, which asks: Another example - the Z80's data bus: I mean, that one just makes no sense to me whatsoever. Not only are ...
Greenonline's user avatar
  • 3,309
19 votes
5 answers
2k views

Uptime in ZX BASIC

How can I obtain the uptime of a Sinclair ZX Spectrum machine (ZX48, ZX128, or Pentagon clone) via their BASIC interpreter? Specifically, the same value used by RANDOMIZE 0 to seed its PRNG. I would ...
forest's user avatar
  • 1,999
19 votes
2 answers
2k views

First computer emulator in Windows

I released my ZX Spectrum emulation Wspecem, and GPL sources first time publicly in the Internet at large, the 15th May 1996, for Windows 95. I am quite sure it was the first ZX Spectrum emulation ...
Rui F Ribeiro's user avatar
18 votes
4 answers
6k views

How fast is memcpy on the Z80?

I gather the fastest way to implement memcpy (copy a certain number of bytes from one place in memory to another) on the Z80 is to use an instruction called LDIR. But how fast is the result, when ...
rwallace's user avatar
  • 58.4k
18 votes
6 answers
4k views

Are there other examples of CPU architectures mostly compatible with Intel 8080 other than Z80?

When the Zilog Z80 was released, it was marketed as being mostly ISA compatible with Intel 8080, while also providing enhanced features. Likewise, the CPU of the Nintendo Game Boy is a custom ...
nitro2k01's user avatar
  • 706
17 votes
9 answers
4k views

Z80 and video chip contending for random access

Back in the 8-bit days, I used 6502 computers, where the story about memory access was easy to understand. RAM chips of the late seventies and early eighties could do 2 MHz (or a bit more e.g. 2.6 in ...
rwallace's user avatar
  • 58.4k
17 votes
3 answers
3k views

Why do only the low 7-bits of the R register increment?

On the Z80 the R register is 8 bits wide, as evidenced by LD A,R and LD R,A And every M1 cycle, R increments by 1. But the uppermost bit does not participate in this increment. R will not go from 0x7F ...
Omar and Lorraine's user avatar
17 votes
2 answers
5k views

Why was the 6809 so expensive?

The 6809 was released in 1978, but looking at the usual source for price quotes for old computer components, Byte magazine, I cannot find any quotes for 1979. December 1980 lists it at $38, compared ...
rwallace's user avatar
  • 58.4k
16 votes
12 answers
8k views

How can a Z80 assembly program find out its own memory address?

I'm wondering how to write a program in Z80 assembler that discovers its own memory location. I thought that maybe I could somehow load the program counter PC into, for example, BC. Is there a way ...
twisted's user avatar
  • 263
16 votes
8 answers
5k views

Could a Z80 address a total of 128 KB of ROM and RAM?

In a nutshell, could the Z80 address 64 KB of ROM and 64 KB of RAM, or just 64 KB for both RAM and ROM? Unfortunately, I couldn't find an exact and a direct answer to my question while searching. ...
Shams M.Monem's user avatar
16 votes
4 answers
4k views

Was the ZX Spectrum used for serious number crunching?

From Eurogamer’s obituary of Sir Clive Sinclair: Sinclair never intended for his computers to be games machines, but that was what the market decided they were. Within the space of a few years, the ...
user1095108's user avatar
16 votes
3 answers
3k views

Z80 is making weird relative jump errors. How can that be?

My little Z80 breadboard project got stuck in the mud where I am pulling my hair out. It looks like the CPU is making a calculation error on a relative jump. Here is my code, and I don't think ZX ...
Gunther Schadow's user avatar