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,...
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];
...
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 ...
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 ...
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 ...
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 ...
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) ...
Community wiki
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 ...
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 ...
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? :))
...
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), ...
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 ...
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, ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 (...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
z80 × 202assembly × 31
zx-spectrum × 19
8080 × 18
hardware × 15
6502 × 15
cp-m × 14
history × 12
interrupt × 12
emulation × 7
performance × 7
homemade × 7
memory × 6
basic × 6
cpu × 6
instruction-set × 6
8-bit-microcomputers × 6
c × 5
compilers × 5
disassembly × 4
graphics × 3
programming × 3
chip × 3
memory-layout × 3
commodore-128 × 3