Hot answers tagged

79 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,...
user avatar
  • 906
61 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]; ...
user avatar
  • 3,812
56 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 ...
user avatar
  • 28.4k
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 ...
user avatar
  • 9,326
56 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 ...
user avatar
  • 57.3k
55 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 ...
user avatar
52 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) ...
46 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 ...
user avatar
44 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? :)) ...
user avatar
  • 173k
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 ...
user avatar
  • 1,770
42 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 ...
user avatar
  • 32.5k
41 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 ...
user avatar
  • 1,334
39 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 ...
user avatar
  • 5,155
39 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 ...
user avatar
  • 173k
39 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), ...
user avatar
  • 34.8k
38 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 ...
user avatar
  • 9,380
38 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 ...
user avatar
  • 3,812
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 ...
user avatar
  • 28.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 ...
user avatar
37 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, ...
user avatar
  • 12.4k
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 ...
user avatar
  • 173k
34 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 ...
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 ...
user avatar
  • 9,380
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 ...
user avatar
  • 16.4k
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 ...
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 ...
user avatar
  • 28.4k
31 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 ...
user avatar
  • 1,035
31 votes
Accepted

What are the registers W and Z inside a Z80?

But four of those registers are not usable by programmers. Those are W, W', Z and Z'. First of all there is no W'/Z'. There is only a single W/Z pair (*1). Second, of course they are usable by ...
user avatar
  • 173k
30 votes

Why did the Z80 break 8080 compatibility?

Would providing full 8080 compatibility have interfered with or made more complicated implementing new features the Z80 designers wanted? It would have made it impossible. Any extension adding ...
user avatar
  • 173k
30 votes
Accepted

How did old computers address far more than 64K of memory despite only having a 16 bit address bus?

I don't know details of the Sharp PC-G830 specifically but the technique used to address more than 64K with a 16-bit address bus is called "bank switching". This involves setting up some ...
user avatar
  • 1,614

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