PDA

View Full Version : How important are Z80-specific instructions?



carangil
August 7th, 2017, 12:13 PM
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?

commodorejohn
August 7th, 2017, 12:28 PM
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.

Chuck(G)
August 7th, 2017, 01:23 PM
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.

glitch
August 7th, 2017, 02:08 PM
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.

Chuck(G)
August 7th, 2017, 02:19 PM
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.

WSM
August 7th, 2017, 04:03 PM
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.

gertk
August 7th, 2017, 11:57 PM
There are lots of 64k x 1 bit chips which support 128 cycle refresh: http://www.minuszerodegrees.net/memory/4164.htm

But still I would not bother and use a static ram chip, much easier and more reliable.

Dwight Elvey
August 8th, 2017, 06:48 AM
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

archeocomp
August 8th, 2017, 09:21 AM
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.

glitch
August 8th, 2017, 09:26 AM
ISA == Instruction Set Architecture, the machine instructions that the CPU supports.

archeocomp
August 8th, 2017, 10:14 AM
Thanks, it is clear now.

Chuck(G)
August 8th, 2017, 10:23 AM
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.

daver2
August 8th, 2017, 10:30 AM
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

Chuck(G)
August 8th, 2017, 11:55 AM
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.

daver2
August 8th, 2017, 12:07 PM
Here is a useful reference http://www.msxarchive.nl/pub/msx/mirrors/hanso/datasheets/chipsz80leventhal3.pdf.

Dave

Chuck(G)
August 8th, 2017, 12:31 PM
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.

carangil
August 9th, 2017, 08:43 AM
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.

daver2
August 9th, 2017, 09:32 AM
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