• Please review our updated Terms and Rules here

How important are Z80-specific instructions?

carangil

Experienced Member
Joined
Jun 3, 2009
Messages
285
Location
Oakland, CA
I have gotten interested in CP/M lately, and might build something, so I'm looking at the 8085, which should run 8080 code just fine. The Z80 was another popular choice, but had enhanced instructions. How much software out there depends on the Z80? Would an 808x be 'crippled' in any way?
 
There's plenty of CP/M software that will run on an 8080, but as far as I know there's really no reason not to go with a Z80 design - I don't think the 8085 is all that much simpler to work with, and you get so much additional functionality out of the Z80 that you might as well.
 
If you like the 8085 bus structure, consider the NSC800. Basically an almost-8085 with Z80 ISA. Lacks RIM and SIM, but does implement the "half" restarts.
 
Lots of stuff runs on CP/M-80 on an 8080/8085. The 8085 is nice and simple to work with (really just a crystal, reset circuit, and latch) and the instruction set is simpler for someone just starting to hack at the machine code/ASM level. My first real homebrew computer project was 8085 based:

http://www.glitchwrks.com/8085projects.html

If you like the 8085 bus structure, consider the NSC800. Basically an almost-8085 with Z80 ISA. Lacks RIM and SIM, but does implement the "half" restarts.

Yep, there's this, it's mostly like an 8085. Except with Z80 instructions.
 
There was a good reason to use a Z80, other than the ISA--dynamic RAM. The Z80 has a "refresh" counter that keeps DRAM busy when the CPU isn't doing anything.

But the refresh register (R) in the Z80 is only 7 bits wide, so its use is pretty much restricted to 16Kbit DRAM. Unless you're really into retro construction, this isn't an important feature any longer--64KB-512KB static RAM is cheaply available, so the DRAM issue isn't a good argument for use. Back in the day, I can remember cursing at the Intel 8202 DRAM controller... :rolleyes:

Z80 vectored interrupts require either an 8259 interrupt controller (Intel mode) or specialized Z80 peripheral chips that support the Mode 2 interrupt feature. On the other hand, the 8085 has three "half RST" (5.5 6.5 and 7.5) interrupts built in, as well as a serial "bit banger" interface. As glitch mentioned, there are specific 8085 support chips with ROM and RAM and timers that make for very compact implementations, but again, are mostly useful for small embedded applications.

As far as software--most general titles were written with the 8080 set in mind. There are some specialized Z80 ISA only titles however.
 
But the refresh register (R) in the Z80 is only 7 bits wide, so its use is pretty much restricted to 16Kbit DRAM. Unless you're really into retro construction, this isn't an important feature any longer--64KB-512KB static RAM is cheaply available, so the DRAM issue isn't a good argument for use.
All true but the simple solution for those that want 64KB on a Z80 using period correct DRAM is to use MCM6665* chips. 64Kbit x1 but with a 16K compatible 128 cycle refresh. I still have a bunch of MCM6665BP20's if someone is serious about designing with them.
 
We'd bought some standard bus CPU cards with 64Kx1 parts and a Z80 processor.
The chips turned out to be 256 cycle parts. We needed to ship the system and couldn't
wait for the 128 cycle chips so we added to our time interrupt to loop read the
128 addresses that didn't get refreshed.
It worked fine. A little clunky but such things can be done.
Dwight
 
If you like the 8085 bus structure, consider the NSC800. Basically an almost-8085 with Z80 ISA. Lacks RIM and SIM, but does implement the "half" restarts.

What does "ISA" in this case mean? I guess you did not mention PC ISA bus but something else.

Was there at least 5MHz version of NSC800? Is it NMOS or CMOS chip? I never heard about this chip but now I am curious.
 
ISA == Instruction Set Architecture, the machine instructions that the CPU supports.
 
What does "ISA" in this case mean? I guess you did not mention PC ISA bus but something else.

Was there at least 5MHz version of NSC800? Is it NMOS or CMOS chip? I never heard about this chip but now I am curious.

Glitch already answered (1). I figured that since this wasn't the PC forum, ISA could mean only one thing. My apologies. Brevis esse laboro, obscurus fio

There was a 4MHz version of the NSC800, the -4, but no 5MHz version that I'm aware of.

The good news is that it's CMOS and even has a POWER SAVE pin, so the quiescent current draw is fairly low when not actively executing.
 
What is your definition of 'build'? At the card or component level? if at the component level - I would suggest checking out Grant's excellent website at http://searle.hostei.com/grant/cpm/index.html.

Generally, CP/M software was designed to be portable across as much hardware as possible - that way software houses could sell the maximum amount of product! Therefore, the lowest common denominator CPU was used (the 8080). Sure, there were packages that would only run on Z80 machines - but (in general) I would have said these were sold/supplied by hardware vendors (buy our hardware and you can run this nice software package that won't run on anyone else's hardware). OK, I am simplifying things - but you get the idea...

There are a few incompatibilities between the 8080 and Z80 (in the area of flag usage) if memory serves me correctly - so just stay away from these areas. Again, these issues were well-known in the software world of old, so software writers stayed away from them for maximum portability. I have written a post on VCFED somewhere about these slight differences at the machine code level.

Dave
 
The only incompatibility when executing 8080 code on a Z80 is the difference in use of the parity flag in the status register. On 8080, this bit is used only to indicate the parity of a result. On the Z80, the same bit serves to indicate parity, but also to indicate arithmetic overflow. Fortunately, few programs make extensive use of this flag--and even fewer get confused by the Z80's overloading of its use.

Microsoft BASIC was an early casualty of this (it expected strict 8080 operation), but the fix was simple.

If you decide to use a genuine 8080 CPU, be careful of the very early NEC 8080s--they treated the carry flag differently when a subtract was involved. I'd heard that IMSAI picked the old NEC CPUs up cheap for use in their floppy controller, since apparently the difference didn't matter in that application. Fortunately, it's pretty hard to find those early NEC CPUs.
 
The P/V flag difference in the Z80 is the only difference of note. You are extremely unlikely to run into problems with the other two.

The DAA operation difference doesn't matter, as the DAA after subtract on an 8080 doesn't work.
The bit about AC on the rotate instructions is obscure and not likely to raise any issues, as the DAA instruction is the only one that uses the AC flag--and that's executed immediately after an addition operation.

Program for the 8080 and you'll be fine.
 
Thanks, I'm convinced now that whatever z80/8080 variant I get my hands one will work out with plenty of software to play with. I'm not sure when I'll get around to building it, but CP/M has been on my radar for a while. I would like to build it on the component level. I would not be opposed to a kit, but I usually build a mess of wires out of perf board.
 
By the sound of it - Grant's website Z80 design will be right up your street then... And you have pre-built boot ROMS (including a simple monitor and downline loader from a PC host) and a pre-configured CP/M and BIOS to boot (no pun intended - well alright then, a little pun intended).

Dave
 
Back
Top