Questions tagged [z80]

For questions regarding the Zilog Z80 microprocessor

Filter by
Sorted by
Tagged with
95
votes
9answers
35k 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 ...
55
votes
8answers
9k 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 ...
49
votes
13answers
7k 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 designed to be an abstraction of a CPU for porting Unix) was not a very easy language to ...
45
votes
2answers
12k 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'...
40
votes
10answers
13k 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 ...
40
votes
6answers
7k 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 ...
38
votes
1answer
3k 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 ...
37
votes
16answers
10k 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 ...
36
votes
5answers
6k 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 ...
34
votes
2answers
2k 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 ...
32
votes
3answers
4k 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 ...
31
votes
2answers
3k 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 ...
30
votes
2answers
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)...
29
votes
4answers
8k 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 ...
29
votes
2answers
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 ...
28
votes
4answers
14k 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 ...
27
votes
1answer
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 ...
25
votes
4answers
13k views

Z80 x 6502 raw performance

A lot have been said in the internet about the 6502 at 1MHz being roughly equivalent in performance to the Z80 at 4 MHz. Is said that the Z80 have a typical 4 clock ticks per instruction while the ...
25
votes
4answers
5k 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 ...
24
votes
4answers
3k 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 ...
24
votes
5answers
6k views

Why did Pokémon Red have so many overflow bugs?

(This question also applies to other Game Boy games, but Pokémon seems to be one of the best-documented.) Pokémon Red & Blue (Red & Green in Japan) is a pair of Game Boy games about capturing &...
24
votes
4answers
4k 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 ...
24
votes
5answers
2k 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,...
24
votes
5answers
4k 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'...
24
votes
1answer
4k 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 ...
24
votes
2answers
4k 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 ...
22
votes
7answers
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 ...
22
votes
4answers
4k 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 ...
21
votes
3answers
6k 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 ...
19
votes
4answers
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 ...
19
votes
4answers
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 ...
19
votes
5answers
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 ...
19
votes
2answers
2k 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 ...
19
votes
2answers
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 ...
18
votes
6answers
6k 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 ...
18
votes
5answers
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 ...
18
votes
1answer
1k 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 (...
17
votes
4answers
5k 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 ...
17
votes
6answers
3k 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 ...
17
votes
3answers
4k 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?
16
votes
12answers
7k 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 ...
15
votes
11answers
3k views

Commercially available computer with single-step feature?

Was there ever a commercially available hobbyist/teaching computer with the ability to single-step the processor? Maybe a Z80-based machine?
15
votes
8answers
3k 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. ...
15
votes
2answers
4k 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 ...
15
votes
1answer
1k views

What are the "ports" used via IN/OUT, vs. the PEEK/POKE address space?

This is something of a followup to How much control of TRS-80 Model III disk drives was possible from its Cassette (ROM) BASIC? but on a more general topic: I know that PEEK and POKE enable direct ...
15
votes
2answers
695 views

What is known about the internal workings of the Z80?

There is a wonderful project called Visual6502, and I've used it from time to time to figure things out, like exactly the difference between rti and rts. It is good to see which control lines were ...
14
votes
3answers
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 ...
14
votes
3answers
1k views

Are there games for the C128 that run (mainly) on the Z80 rather than the 6502?

The Commodore 128 was a version of the Commodore 64 that also had a Z80 CPU along with its "native" 6502 CPU so the system could run CP/M as well as C64 software. (As well as more RAM and ...
14
votes
1answer
1k views

How can a Z80 assembly program find out the address stored in the SP register?

I'm wondering how to write a program in Z80 assembler that discovers the value stored in the SP register. From what I've seen, the only instructions that touch the SP register are: LD SP, HL/IX/IY EX ...
14
votes
2answers
843 views

Does the Z80 allow interrupts after processing and ignoring a 0xdd prefix?

I read here that if the Z80 encounters e.g. multiple 0xdd prefixes in sequence, for each 0xxdd except the last it acts almost like a NOP, but does not allow interrupts to occur immediately after "...