Questions tagged [z80]

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

The Z80 8-bit microprocessor was introduced by Zilog in 1976.

Its instruction set is a superset of the , with several additional registers and a few backwards-incompatible modifications to instruction timing.

Use in preference to both this tag and to ask questions about the Sharp LR35902/SM83 CPU (nicknamed the ‘GBZ80’) found in the Game Boy.

Useful resources

193 questions
42
votes
16 answers

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 retrocomputer, I would be more likely to use them…
rwallace
  • 60,953
  • 17
  • 229
  • 552
34
votes
3 answers

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 Z'. So what operations did these registers…
Omar and Lorraine
  • 38,883
  • 14
  • 134
  • 274
26
votes
1 answer

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 question is simply: when the Z80 just turns on,…
Jacob Garby
  • 425
  • 5
  • 7
19
votes
4 answers

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 then in some seemingly random order, but you…
Greenonline
  • 4,296
  • 2
  • 19
  • 57
13
votes
1 answer

Z80 refresh pin, is it tri-state or not

I'm planning out a protocol bridge between ZX Spectrum clone system bus and an FPGA-based extension device. I am considering adding bus request/acknowledge support for DMA purposes, but reading "Z80 CPU User Manual" pdf (UM008011-0816) I see a…
Vlad
  • 1,541
  • 9
  • 14
13
votes
2 answers

In 2020 are there fully assembled z80 devices available at reasonable cost?

I'm wondering if it is possible to buy an sort of device currently in production that uses a z80 compatible CPU - not an FPGA. I don't want to build a kit or use a soldering iron. I'm also looking for something that is commercially produced rather…
Duke Dougal
  • 457
  • 3
  • 10
11
votes
2 answers

Faulty M1 line on the Z80A

It is well known that some Z80A processors with non functioning M1 signals were assembled into many ZX Spectrums. As this signal is not used in the main board and not everyone bought interfaces that used it, this fault may pass unnoticed during the…
mcleod_ideafix
  • 18,784
  • 2
  • 70
  • 102
10
votes
2 answers

Single-stepping a Z80 - only first instruction is successful

I've wired up a simple Z80 circuit, and I've encountered a strange issue: after successfully executing one instruction, the M1 cycle of the NEXT instruction never completes successfully. Here are some facts: I can execute indefinitely many M1-only…
newbie21
  • 129
  • 6
9
votes
2 answers

How costly is it to put things on the stack with the Z80?

Programming languages like C, where any function has the potential to be called recursively, are effectively designed on the assumption that it's okay for all local variables to go on the stack. On the 6502, this is not a good assumption. The stack…
rwallace
  • 60,953
  • 17
  • 229
  • 552
9
votes
2 answers

ZiLOG Z80 fan-out (CMOS version, Z84C0006PEC)

I am building a z80 based 8 bit computer, and I really don't want to fry my chip. I was looking at this datasheet, but I couldn't find the fan-out specified. There are some electrical characteristics on page 30, but that's about it. In the book…
Njubster
  • 91
  • 5
8
votes
3 answers

Z80 16-bit I/O port addresses

The Z80 indirect I/O instructions are a little quirky: the instructions with the standard mnemonic in r, (c) (where r is a stand-in for any of the normal registers) actually puts the register pair bc on the address bus, not just c as implied in the…
Jules
  • 12,898
  • 2
  • 42
  • 65
8
votes
1 answer

z80 CPU User Manual AND P/V Flag

I'm writing an emulator for the z80 CPU using the "z80 CPU User Manual" from zilog.com as reference. When I got into the AND operator I got confused. In the Condition Bits Affected is declared "P/V is reset if overflow; otherwise, it is reset." I've…
h0m3
  • 155
  • 6
7
votes
3 answers

Which Z80 opcodes can I use without a stack?

Quick question, as the title implies. I'm in the process of writing an 'OS' for my DIY Z80 computer and one of the things I need to do to help debug any issues during the boot process is send a repeating sequence of data to an IO port in the event…
nockieboy
  • 173
  • 3
7
votes
2 answers

Floating control during bus sharing

I'm building a simple Z80 breadboard computer for my hobby. In this question I use Z80 as an example, but I think this may apply to many CPUs that allow for bus sharing. The problem is as follows. Z80 has a pin called BUSREQ, which after being…
JamMaster
  • 173
  • 3
5
votes
1 answer

Z80 Bus Control by External Device: /BUSRQ or /RESET?

I'm designing a Z80 system from scratch. My approach is to only have one memory device, a big SRAM, that covers the entire 64 KB memory block. A sub-system on the board will be a microcontroller (MCU). It will be connected to a PC by a UART and have…
Smith
  • 153
  • 4
1
2