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
34 votes
6 answers
17k 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 ...
4 votes
3 answers
297 views

What would be the value on the data bus for a Jupiter ACE with the Z80 Interrupt Mode 2?

I am writing an emulator for the Jupiter ACE. I assumed the idle bus value would be 0xFF like the ZX Spectrum. Other emulators for the Jupiter ACE seem to assume the same. If there are no peripherals ...
2 votes
2 answers
254 views

From an electrical and software engineering perspective, ignoring available software, should I go for the Z80 or 65C02? [closed]

This might be a weird title but I noticed that recommendations for one over the other usually go into a direction that is not too helpful for me. I would like to build an 8 bit computer and picked ...
41 votes
7 answers
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 ...
14 votes
3 answers
4k views

Role of the Z80 co-processor in GBA games

The Nintendo Game Boy Advance had a Z80-like processor which was typically used for backwards compatibility with GB and GBC games. According to its Wikipedia page, an uncited comment claims that this ...
16 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 ...
13 votes
5 answers
3k views

How did early video terminals convert ASCII into font graphics?

I'm building a Z80-based breadboard computer from scratch to learn more about simple processors, and I'm a bit stumped when it comes to the base concepts of building a text-based terminal. I've got an ...
10 votes
2 answers
518 views

Simulating a 8085 using a Z80?

I am studying the replacement of a 8085 with a Z80 (I am aware that they are not pin-compatible, the solution is to be made in a board of new design rather than on the old board). The sole reason is ...
20 votes
5 answers
3k 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 ...
5 votes
1 answer
232 views

Z80 CPU and nested/reentrant NMI

According to multiple documentation sources, non-maskable interrupts (NMIs) can be nested (or reentrant) in a Z80 microprocessor. This is, upon a /NMI signal pulse, the CPU will interrupt the current ...
43 votes
10 answers
14k 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 ...
13 votes
1 answer
629 views

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 "...
21 votes
3 answers
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 ...
21 votes
6 answers
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 ...
27 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 ...
3 votes
2 answers
243 views

How does the serial port on the RC2014 get addressed?

I see on the schematic that /M1 and A7 go to CS0 and CS1 respectively. As I recall, both of these need to be high for the chip to be selected. And A6 goes to CS2, which needs to be low for the chip to ...
11 votes
4 answers
1k views

Could the Z80 do interference-free video as the 6502 could?

Technically this isn't just about video since it applies to any regularly scheduled DMA¹ from a non-CPU subsystem, but video is the most common application of this technique so I'll use that as the ...
4 votes
0 answers
291 views

Source code for Logo in z80

I look for a source code for Logo written in z80 (the complete language, not only the turtle part). I found the dissasembly of Terrapin Logo for Apple 2e but it is 6502. Ideally, it would fit in 16K. ...
1 vote
1 answer
204 views

How does RETN return from NMI on the Z80 in the event of nested NMI?

I was trying to learn how the Sega Master System works. The NMI occurs when the pause button on the console is pressed. So I wrote an NMI handler that makes a beep when the NMI occurs, then waits for ...
34 votes
3 answers
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 ...
8 votes
1 answer
1k views

Why does the Z80 JP (absolute) instruction always take 10 states to execute?

I've looked at a few different websites and they all agree that a JP nnnn instruction (where nnnn is a 16-bit address) always takes 10 states to execute. According to what I've read, all of the ...
21 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 (...
11 votes
1 answer
1k views

Is I/O port 0xFE reserved on the eZ80?

TL;DR Following on from OmarL's comment, to the closed question, Why did the Spectrum Next choose Z80 on FPGA?: But also, the eZ80 is not compatible with the ZX Spectrum because it uses port FE for ...
9 votes
4 answers
850 views

Better way to do Z80 "bank switch & call"?

I have a memory setup where the whole address space can be exchanged (default 2 slots with 2 banks each, but may change depending on "expansion cards" plugged in). Banks are switched by ...
15 votes
3 answers
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 ...
9 votes
3 answers
928 views

C++ compilation for the Z80 and 6502?

I know it's almost heresy to ask something like this, but ... We have C compilers for the Z80/6502 and there used to exist a thing called the Comeau C++ compiler, that produced C code as output. There ...
4 votes
1 answer
262 views

ZX Spectrum coordinates to bitmap conversion subroutine acting strange

I originally posted this question on stackoverflow, but I wrote a little program that converts coordinates stored in the b and c registers of the z80 into their corresponding memory address for the ZX ...
3 votes
3 answers
739 views

When first CMOS versions of Z80 became available and were they ever used in (non-portable) home computers?

When Z80 first became available on the market in 1976 it was made using NMOS technology. It is the version that is likely to be most familiar to people interested in retro-computers. For example, to ...
12 votes
1 answer
2k views

Good Z80 disassembler/decompiler on modern equipment?

I have a hobby project with an old CP/M-80 system, where I now would like to disassemble/decompile some compiled code – a ROM and some small executables – into assembly source so I can regenerate the ...
5 votes
2 answers
354 views

Is there a way to work around the maximum clock rate of Z80 PIO chips?

I would like to assign a Z80 PIO chip to my homebrew Z80 "computer". Unfortunately, what I've recently noticed in the datasheet, chip version which I actually have: Z0842006PSC can handle ...
50 votes
13 answers
8k 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 ...
11 votes
2 answers
1k views

ZX BASIC REM statement overhead

Since my other question has been answered and has given me a way to do high-precision timing, I've been experimenting with it a bit. The first thing I did was write a simple benchmark using the FRAMES ...
7 votes
1 answer
768 views

The proper way to shift a byte using a Z80

In a nutshell, why can I not shift a byte using this way? LD A, 11110000b ; I want this to be 00001111b LD C, 4 SRA C OUT (0), A ; doesn't give correct number What is the proper way of shifting a ...
32 votes
2 answers
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 ...
6 votes
2 answers
728 views

Did any ZX Spectrum clones use the Z80's interrupt mode zero?

The standard Sinclair ZX Spectrum only used mode 1 and mode 2 interrupts but the Z80 also has a mode 0 interrupt that the original Speccy never used. But there were many exotic clones of the ZX ...
25 votes
4 answers
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 ...
98 votes
9 answers
37k 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 ...
36 votes
5 answers
7k 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 ...
6 votes
3 answers
1k views

How long are interrupt requests remembered on the Amstrad CPC?

I'm trying to emulate an Amstrad CPC 464. Currently, I'm working on interrupt handling and I'm wondering: Some Z80 instructions, like EI or decoding multiple consecutive 0xdd prefixes don't accept ...
15 votes
8 answers
4k 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. ...
4 votes
2 answers
267 views

Cannot assemble BASIC with high memory workspace (Z80)

This is a homebrew Z80 computer, using Z80, 64K RAM, EEPROM as well as SIO/0. I am trying to run BASIC, however I need to set the workspace at 0xC000 or higher. The code I am using is similar to https:...
18 votes
6 answers
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 ...
0 votes
1 answer
256 views

Does this schematic of the Zilog Z80 central unit contain any other errors? [closed]

For an assigment I have to check this schematic of an Z80 and find possible errors. The schematic looks like this: The left side of this schematic is correct, but we have to find errors in the right ...
0 votes
2 answers
230 views

Z80 - "LD (nn), dd" command cycle [closed]

For a university assignment, I have to describe and draw the command cycle of the LD (nn), dd command. To be exact, I was given this command: LD (0x1000), BC which I interpret as putting the low ...
3 votes
1 answer
415 views

Z80 - SIO/0 Frequencies

Z80 board with a SIO/0. I am struggling to understand how CPU and SIO frequencies are related, if they are at all. SIO/0 datasheet didn't help much. If I clock both the CPU and the SIO(TX/RX) from a 1....
10 votes
2 answers
3k views

Is the Game Boy Sharp LR35902 object-compatible with the 8080/Z-80?

(Note: by "object-compatible" I mean that the opcodes and their following operands are the same—the assembler produces the same output for equivalant assembler mnemonics. This of course ...
5 votes
2 answers
527 views

Z80, best way to page out EEPROM

Trying to design a Z80 based computer that starts from an EEPROM, loads CP/M to RAM and pages out (switches off) EEPROM to allow CP/M to access full 64K RAM. What is a good way of achieving this ? My ...
55 votes
8 answers
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 ...
9 votes
1 answer
766 views

How does Master System backwards compatibility work on the Megadrive?

I know that the Megadrive contains the Z80 CPU to help control the soundchips for 16-bit games, and that it provides backwards compatibility for the CPU processing of Master System software, but ...
4 votes
1 answer
500 views

Building a Memory Management Unit to expand the 16Bit Address space [closed]

I'm in the middle of making an 8Bit computer, I've selected Z80, the 20Mhz version, which is cheap and readily available. Since Z80 has a 16bit address line it can only address 64KB of memory location....