Skip to main content
104 votes
Accepted

Why do C to Z80 compilers produce poor code?

Quite often people don't know how to use the compilers or don't understand fully the consequences of code they write. There is optimization going on in the Z80 C compilers but it's not as complete as,...
aralbrec's user avatar
  • 1,156
66 votes

Why do C to Z80 compilers produce poor code?

If you try translating C into Z80, you'll see that Z80 index registers and stack don't behave quite as you expect. So, let us begin with Arrays Suppose you have a standard C construction int c[10]; ...
introspec's user avatar
  • 4,197
59 votes
Accepted

How did the Z80 instruction set differ from the 8080?

For the most part the Z-80 extends the 8080 instruction set. If we consider just the 8080 instructions themselves there are a few incompatibilities: Overflow flag. On the 8080 bit 2 of the flags ...
George Phillips's user avatar
59 votes

Why do C to Z80 compilers produce poor code?

The main downside of "historic" CPU's (non?)-suitability for C programs is the lack of capability to form more than one register into an address without using the ALU. Most more modern CPUs can use ...
tofro's user avatar
  • 36.4k
58 votes

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

One language that was popular on early 8-bit micros, including those that used the 6502 CPU, was Forth. Forth is exceptionally good for this use case, and superior to a C compiler, because Forth can ...
Brian H's user avatar
  • 61.2k
56 votes
Accepted

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

There are many issues here. As it is already said in comments, decoupling capacitor is a must! 555 (non-CMOS) timer output is very much like the output of TTL ICs, however Z80 requires a firm logic ...
lvd's user avatar
  • 10.9k
55 votes

Did any computers use the Z80B?

A number of computers shipped with the Z80B, including: Brascom BR1000M IPTVT TIM-S (Romanian ZX Spectrum clone) M.G.T. Sam Coupé Osborne Executive Panasonic FS A1 WX (MSX) Sharp MZ-2500 (SuperMZ) ...
49 votes
Accepted

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

Sinclair didn't always use the Z80 for its computers. The MK14 computer, sold in kit form (like the ZX80 was), used a National Semiconductor INS8060. The ZX range of home computers have a video ...
mcleod_ideafix's user avatar
46 votes
Accepted

Managing registers/memory effectively on the Z80

It's quite a while since I did any Z80, but there's an important difference between classic Z80 systems and modern kinds of computer. Memory is fast. Unlike modern systems where memory accesses take ...
John Dallman's user avatar
  • 13.9k
45 votes
Accepted

Z80 CPU address lines not stable

It appears that A0 through A6 operate correctly, but A7 though A9 (I've not tested the rest of the upper bits) are only active on the clock edge. Doesn't that exactly look like refresh cycles? :)) ...
Raffzahn's user avatar
  • 232k
44 votes
Accepted

How did 8 bit processors perform 16 bit arithmetic?

In the case of the Z80, the ALU is only 4 bits wide. That's no problem, since the internals of the CPU are controlled by a program internal to the processor, called the microprogram (or microcode), ...
Omar and Lorraine's user avatar
44 votes
Accepted

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

The Z80 has an address space of 64KB. That means it can perform 8 bit reads or writes to 65,536 distinct locations as specified by the 16 address pins on the CPU. As far as the Z80 is concerned that's ...
David's user avatar
  • 2,822
43 votes
Accepted

Did any computers use the Z80B?

One reason you didn't see many Z80B machines is that not much was available in the way of affordable support chips for it. For example, look at the advert you cite: it has prices for PIO, CTC, DMA, ...
Jules's user avatar
  • 13k
43 votes
Accepted

Comparing raw performance of the Z80 and the 6502

Both processors are cacheless. So the process is fetch instruction, decode instruction, execute instruction, forget what you saw. That provides a first line of comparison. The Z80's fastest memory ...
Tommy's user avatar
  • 38k
43 votes

Why do C to Z80 compilers produce poor code?

Simple answers one easily gets to this question are The Z80 Sucks and C Sucks - depending on the side someone is on. While they are of course, untrue (*1), there are real issues. A major argument for ...
Raffzahn's user avatar
  • 232k
42 votes
Accepted

How were Western computer chips reverse-engineered in USSR?

Little is known about how these computers and chips were made, because their development was top secret in the Soviet Union. As far as I know, Soviet Western-compatible ICs were made by copying ...
Algimantas's user avatar
  • 1,344
41 votes

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

They both shared the same memory so it didn't really forward instructions. The Z80 card stopped the 6502 running using the DMA signals and the system swapped between the two by writing to $CN00 where ...
PeterI's user avatar
  • 5,327
40 votes
Accepted

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

The key to efficient programming on Z80 is to use registers as much as possible. I can easily believe that designers of Z80 intended the use of the alternative set of registers as an efficient way of ...
introspec's user avatar
  • 4,197
40 votes
Accepted

Did underclocking the early Z80 chips improve yield?

That would be a rather unusual move. The 2.5 MHz Z80 is well within Mostek's (*1) base technology of 1976 (*2). In fact, already the the very first mask set of 1976 yielded 20% good for 4 MHz (*3). So ...
Raffzahn's user avatar
  • 232k
39 votes
Accepted

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

An instruction set can be considered as a Huffman coding of an idealised instruction stream. So the question is really asking which CPUs have a good balance of short encodings for common tasks to ...
pndc's user avatar
  • 11.6k
39 votes
Accepted

Why does the Z80 include the RLD and RRD instructions?

Per Zilog's Z80 user manual: Two BCD digit rotate instructions (RRD and RLD) allow a digit in the accumulator to be rotated with the two digits in a memory location pointed to by register pair HL (...
Tommy's user avatar
  • 38k
38 votes
Accepted

Why did the Z80 break 8080 compatibility?

The designers of the Z80 thought it would be useful for code to quickly determine whether signed arithmetic operations overflowed. There were a few ways they could have accommodated this: Add a new ...
supercat's user avatar
  • 38.1k
37 votes

How were Western computer chips reverse-engineered in USSR?

It seems to be pretty much accepted wisdom that the Soviets completely cloned the Western chips and did not simply develop reimplementations of the same instruction sets. Since at the time it was ...
Igor Skochinsky's user avatar
36 votes

How did 8 bit processors perform 16 bit arithmetic?

How did 8 bit processors such as the Z80 and 8080 perform 16 bit arithmetic? Same way one adds multiple digit numbers on paper. One digit (-pair) at a time and iterating over all digits while ...
Raffzahn's user avatar
  • 232k
35 votes

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

If we consider only real Z80 (i.e. no emulation and no FPGA), probably the fastest Z80 compatible CPU is eZ80 (runs at 50 MHz, but has 3-stage pipeline, so in theory it could reach 3× the speed of Z80 ...
Radovan Garabík's user avatar
34 votes
Accepted

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

The definition of "instruction" and "OP code" (aka operation code) is a bit fuzzy because it depends on how humans view the CPU. So the designers and their marketing department mostly get to pick the ...
pndc's user avatar
  • 11.6k
33 votes
Accepted

Use of undocumented opcodes

In some cases undocumented instructions may be useful as shortcuts to accomplish tasks that are "difficult" to achieve with the official instructions. Going with the Z80, it is common practice ...
Konamiman's user avatar
  • 1,115
33 votes

Why does the Z80 have a half-carry bit?

The intermediate carry flag, or "adjust flag", or half-carry flag is used to facilitate binary-coded decimal (BCD) arithmetic, where each decimal digit of a number is represented as a nibble ...
Leo B.'s user avatar
  • 20.6k
32 votes

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

... a scaled-down, cost-reduced, clone of the Intel 8080. The Z80 had a massively extended instruction set, featured more addressing modes and had more registers than the 8080. It also had a built-in ...
Martin Rosenau's user avatar
31 votes
Accepted

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

No, they cannot. They share both the data and the address bus of the C128, so they can only run exclusively at any one point in time. The address bus is apparently directly connected, the data bus ...
tofro's user avatar
  • 36.4k

Only top scored, non community-wiki answers of a minimum length are eligible