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
33
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 ...
8
votes
1answer
653 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 ...
5
votes
2answers
343 views

How can I detect signed integer overflow on the Game Boy?

Unlike a normal Z80, the Game Boy has no CALL pe/po, JP pe/po or RET pe/po instructions. I've been trying to figure out how to detect integer overflow on the Game Boy. (It doesn't have those ...
21
votes
2answers
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 (...
10
votes
1answer
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
4answers
684 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 ...
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 ...
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 ...
9
votes
3answers
675 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
1answer
219 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
2answers
197 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 ...
3
votes
3answers
606 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 ...
10
votes
1answer
869 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
2answers
292 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 ...
49
votes
13answers
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
2answers
952 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
1answer
481 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 ...
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 ...
4
votes
0answers
187 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. ...
6
votes
2answers
652 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
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 ...
96
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 ...
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 ...
6
votes
3answers
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
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. ...
4
votes
2answers
252 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:...
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 ...
0
votes
1answer
198 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
2answers
178 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
1answer
301 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....
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 ...
10
votes
2answers
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
2answers
417 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
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 ...
8
votes
1answer
527 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
1answer
348 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....
6
votes
3answers
2k views

Z80 string iteration failing

First Z80 project after 6502, a simple looking piece of code giving me hard time. print_char is a working function which prints contents of A to the screen. My first issue is that the following code (...
6
votes
1answer
311 views

Z80, do I need a resistor for pins to Vcc?

Building a Z80 computer after completing one with 65c02. Z80 on my project needs some pins to be tied high (INT, NMI, WAIT, BUSRQ), these are the ones that I don't need for the time being. There are ...
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 &...
2
votes
0answers
309 views

Why did the Spectrum Next choose Z80 on FPGA? [closed]

I'm curious to understand why the Spectrum Next uses Z80 on an FPGA instead of something like at eZ80? I would have imagined they would choose the eZ80 since it is still a production part. Anyone ...
4
votes
2answers
761 views

Z80 PIO Keyboard [closed]

I am working on designing a Z80 computer and I would like to use a PS/2 Keyboard for input. I would like to use a PIO to communicate with it, but I am having trouble finding any documentation online ...
14
votes
1answer
2k 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 ...
5
votes
1answer
377 views

Why is my program outputting only zeros to the data bus during I/O operations?

I'm building a breadboard Z80-based computer. As now, I have the CPU hooked up to an EEPROM and an I/O device (an HD44780 character display) with appropriate decoding logic. The ROM chip starts at ...
9
votes
3answers
1k views

Make the "z80asm" assembler place an instruction at a known memory address

I'm writing a very basic OS for my homebrew Z80 computer. As an absolute assembly language beginner, I managed to obtain a working "os plus memory monitor" that can show memory content and ...
4
votes
2answers
185 views

Replacing an 8" disk drive with a newer/smaller drive on an old 8-bit computer?

I used to have an out-phased Danish 8-bit computer as a hobby machine back in the 90's. It had two external 8" floppy drives, and I have kept the old floppies. Now I'd like to salvage my old ...
3
votes
2answers
300 views

Z80: Interrupt (IM2) daisy chain for "foreign" peripherals

I'm looking for a way (apart from manually wiring up Fig.15 of The Z80 Family Program Interrupt Structure) to daisy chain "non-Z80-family" devices in an IM2 Z80 system i'm designing. So far ...
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 ...
12
votes
1answer
375 views

Ratio of code density between 8080 and Z80

The Z80 was (except for a handful of tiny incompatibilities) a superset of the 8080, adding a number of new instructions as well as the alternate register set. It seems therefore that it must have at ...
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?
0
votes
4answers
240 views

How did graphics processing for old 8/16bit consoles work & what are the differences between an FPU/maths co processor & a graphics card? [closed]

When looking on the internet at information about old consoles it's pretty easy to find out information on CPUs like the 6502, 65816, 68000 & Z80 used in retro computers & consoles like the ...