Can anyone help with Z80 project? - Page 1
Forum section: electronics / general

author: MrWifiHifi
author_rank: Regular Contributor
timestamp: June 09, 2019, 06:16:58 pm
content: HelloI'm new here on this forum.I'm currently working on project with Z80 and there are few thing that i don't know how to doI want to redesign singleboard computer PMI-80 made back in 80' in SlovakiaIt uses MHB8080 aka Intel 8080 equivalent as CPU running at incredible speed of 1,111MHz !!!Can anyone help me?

author: Andy Watson
author_rank: Super Contributor
timestamp: June 10, 2019, 04:02:35 pm
content: Welcome.There are many here that may be able to help you. Do you have a specific problem?

author: Ampera
author_rank: Super Contributor
timestamp: June 10, 2019, 04:25:37 pm
content: >1,111MhzIs that 1.1Ghz, or 1.1Mhz to my American eyes? Considering it's the 1980's, I'd imagine 1.1Mhz.First things to do is to locate a board, someone with the board, or the original schematics (or even better board layout) for the computer. Since it's a low power Z80, it's likely not anything special, so if the goal is to throw your own one together, stuff like that can probably be done with a few purchases and a quick PCB run.

author: MrWifiHifi
author_rank: Regular Contributor
timestamp: June 10, 2019, 08:53:15 pm
content: I uploaded some documentation on Google Dischttps://drive.google.com/drive/folders/1t8YkmnqniPUCZVfWoQ7aAaI-6NDBQA4N?usp=sharing

author: MrWifiHifi
author_rank: Regular Contributor
timestamp: June 10, 2019, 09:11:48 pm
content: I want to tell you something from history of this computer...Back in 80' we have here company named TESLA, they made everything from electronic components to radio, television even computers, their factories were over whole CzechoslovakiaIn Slovakia, in a town named Piešťany, they have factory that made integrated circuits. Ing. Roman Kišš was in department were they test them. But Ing. Kišš was very clever so he spend 10% of his work time testing IC's and 90% of the time he was designing coputer circuits. He had an idea to create simple single board computer for learning purpose, so during holiday he designed whole computer and write the whole monitor that takes up only 1KB of memory and whole computer had only 10 chips! It is called PMI-80, because PMI means Piešťanský MIkropočítač and 80, because it uses 8080 CPU. This is very short explanation how this computer was born.Computer consist of:MHB8080, MH8228, MH8224 (CPU)MHB8608 (1KB ROM) (there can be 2 ROMs but second was optional)2x MHB2114 (4b x 1K RAM)MH7400MH3205 (74138)2x MHB8255From time when it was created, many vintage computer enthusiasts build replicas of it, they used 8085 and Z80 as CPU but still with original 1KB ROM and 1KB RAM.So i thought what if I design a replica of it but with much more capailities.I want to change things like:- use all adressable 64k of space (it can be splet to 8k sectors, first 8K will be split to 2x 4K because i want to have original software, but other sectors can be spilit to 7x 8K + 8K original, 1x 32K 1x 16K 1x 8K + 8K original and so on....)- make an universal port decoder to decode all port addresses (i might not use all 256 ports but, man never knows)- use Z80 as CPU- make USB interface for program SAVE and LOAD- design similar universal bus pannel like on RC2014 for expansion cards (RAM, ROM, ports, RTC, etc.)- make enclosure, so it look very cool- probably make cartrige slot upgrade for programs written on EPROM to be usedI would be very grateful if you could help my with this.

author: Ampera
author_rank: Super Contributor
timestamp: June 11, 2019, 02:03:26 am
content: Again, help you with /what/ exactly?What have you done? What do you know? What don't you know? YouTube is a good place to start, and working in 8080/Z80 ASM is also not a bad idea.

author: Ian.M
author_rank: Super Contributor
timestamp: June 11, 2019, 03:47:50 am
content: If possible, avoid using the Intel 8080, as it needs three supplies (+12V +5V and -5V) and a two phase non-overlapping clock. A Zilog Z80 is much less hassle as it only needs a single +5V supply and a single clock. They are binary code compatible as long as you stick to officially documented 8080 instructions. However the Z80's extended instruction set makes it likely that code that uses undocumented 8080 instructions wont run on a Z80.There have been several topics here for Z80 projects of varying degrees of complexity. Search the forum for them. One in particular proposed a MMU using a 8 bit wide fast cache RAM chip (as used on 486 era PC motherboards) to translate the Z80 16 bit address bus to a 20 bit one (1 Megabyte memory space), by taking A12:A15 and using them to look up a 4K page address from the fast RAM , with separate translations for memory reads and writes. Add a big battery backed SRAM chip, and some method of loading code into it and you can emulate the memory map of most Z80 systems. If you want an area to appear to be ROM, simply map writes to it to an unimplemented area.Its also possible to use an Arduino (controlled by a PC) + a couple of logic chips to emulate some or all of the I/O chips in a Z80 system. When /IORQ goes active, the logic asserts /WAIT, and signals the Arduino, which looks at the Z80 address and data bus and control signals, and decides what to do to emulate the I/O chip that's supposed to be at that address. The Arduino code transfers data to/from the data bus fro/to the emulated I/O chip registers (with the aid of a buffer with tristate outputs so the Z80 /RD signal can control when it drives the data bus). Finally the Arduino signals the logic to release /WAIT so Z80 execution can continue. With a few more control line connections, the Arduino can also seize the bus to transfer blocks of data to/from the Z80 memory map, eliminating the need for any ROM to boot the system. Such a system can start off with an emulated UART providing a serial console used by an image of a Z80 monitor ROM, and, if you put enough time and effort into it be extended till it can run CP/M+ with a large paged memory map and many emulated and/or real peripherals.A couple of things you need to be careful of in a large Z80 system are fan-out, propagation delays and power distribution.Fan-out is the number of logic chip inputs a logic chip output (or MCU pin) can drive and still provide valid signal levels and acceptable risetime. The Z80 doesn't have very strong output pin drive capability, so runs into trouble driving large multi-board system buses unless you buffer all its signals on your CPU card. That's fairly easy for the address bus and control lines, as they are uni-directional, but the data bus is bidirectional and enabling the buffer with the right direction active so it never conflicts with the Z80 and peripheral chips access to the data bus is non-trivial.If your memory and I/O address decoding logic (and any bus buffering) is over-complex its propagation delay can seriously limit the maximum clock speed you can run at without data corruption.Distributing a single 5V rail across multiple cards in a large Z80 system can be problematic due to the large total 5V current requirement and voltage drops at the inter-card connectors. It may well be easier to distribute power at a higher voltage and give each card its own 5V regulator, (either linear from a 8V rail or switching from +12V).

author: MrWifiHifi
author_rank: Regular Contributor
timestamp: June 11, 2019, 06:07:54 am
content: So far I've solved:- first 8k memory banking (original page have 1k but i need 4x 2K or 2x 4K, it is just because Chips I've got and I plan to use)- use 74138 for 8K memory addressing- plan to use address and data bus buffer (maybe I use 74244 or 8216)- I've got bunch of 8KB RAM (6264) and 4,8,16,32KB ROM (2732, 2764, 27128, 27256) chips and I plan to use them- designed and now building input terminal (original input is 5x5 keypad and 9x 7 segment display as output, so I designed external terminal, so it won't be part of PCB but as separate thing)And there are thing I don't know or I didn't start working on:- USB interface with Z80 code for it- PCB design, because I didn't solve some problems with it- don't know how to decode adresses for ports- what oscillator to choose for Z80 (original run on 1.111MHz) and I want to run it on orignal 1MHz, and faster on 2 maybe even on 4MHz

author: MrWifiHifi
author_rank: Regular Contributor
timestamp: June 11, 2019, 06:09:49 am
content: And how does the 1Megabyte memory banking works?I heard it first time, can you explain to me how does it work and how to work with it?

author: Ian.M
author_rank: Super Contributor
timestamp: June 11, 2019, 06:52:25 am
content: Basically you put a very fast RAM chip between the top 4 bits of the Z80 address bus and the top 8 bits of the memory address bus (from its data pins). Then there's a fair bit of fiddly logic to also let the fast RAM be accessed in the Z80 I/O address space so you can set and read back its contents. Consider the address in Hex - for any memory access the fast RAM has the high digit of the Z80 address on its low address lines, so its contents provide a two digit translated address on its data pins, that go to the real RAM (and ROM) address bus. As the fast RAM has much more than 16 locations, another of its address pins can be connected to Z80 /RD to get different mappings for reads and writes. Set them to the same physical address block of RAM, and it looks like RAM, set them to different blocks and its handy for copying areas of memory, and if you set the write address to non-implemented or ROM and the read address to RAM after copying data into the RAM, it makes that block of RAM write protected so it acts like ROM. To ease switching between different memory maps, connect an 8 bit latch mapped in the I/O space to eight more of the MMU fast RAM's address lines. Then a simple single write to an I/O port can swap between 256 different memory maps, which may differ by a single 4K page or be so different that *ONLY* the 4K page currently executing remains the same.Seehttps://www.eevblog.com/forum/microcontrollers/retro-z80-project-memory-layout-and-software-management/for the original topic.There's an alternative (and far more limited) MMU design that may be easier for you to understand in this thread:https://www.eevblog.com/forum/projects/z80-memory-banking-for-128k-mmu-design/

author: obiwanjacobi
author_rank: Super Contributor
timestamp: June 14, 2019, 01:24:09 pm
content: Let me warn you: though the solution that Ian talks about is very flexible and works, it does bring a lot of complexity you need to wrap your head around.If you want to start simple / you're a beginner, I would advise against it.Start with what you really need. Do you really need 1MB of RAM? Or perhaps get your first design working with 64kB of RAM (and some ROM to run CPM?)If you really need/want more than 64k, how flexible should it be? Do you need fine-grained control of small memory pages (4k or even smaller)? Or are 4 pages of 16k good enough. The more pages you need to manage to more complex your code is going to be. You need to think about when pages can be swapped out for other pages without crashing your program. If your program is not in ROM but also in RAM, you need to make sure you don't swap out the code pages where the program might jump to...Then how much flexibility do you really need? The more flexibility you design for, the more complexity is introduced into the code. I think you get the point: start simple.BTW: using (2) 4 bit register files (74xx680? somewhere in that range) are sometimes used to make a simpler version with similar characteristics.USB: Simple, pick a modern MCU that has native USB support and a good programming environment and enough pins to let the Z80 interface with in parallel (8 bits). Extra pins for RD/WR and INT for smooth interfacing.PCB design: pick a (free) software program (look online - I use KiCad) and "embrace the suck" - because it will be a learning curve. Post your PCB routing questions in the other forum groups. Dave has a document somewhere on his web site I think, with some good pointers - I never remember where that thing lives... He also made some PCB design related vids. Certainly worth your time.Address decoding: Its a (boolean) logic game of getting the correct pulses (usually active low) at the correct time to the correct place. It starts with the Z80, know what it does when (timing diagrams). The rest is adding logic gates to get what you want. Hint: an OR-gate is an AND-function for 'active-low' logic... (hope you get that one ;-)OSC: get a canned oscilator (a package you apply 5 volt to and produces the clock). BTW: I am using a Z80 that runs at 20MHz, so you can go even faster than 1, 2 or 4...

author: RoGeorge
author_rank: Super Contributor
timestamp: June 14, 2019, 02:55:40 pm
content: 8080 is an Intel processor.Z80 is a Zilog processor.They are different. First it was 8080, then a few engineers from the 8080 team left Intel and open their own company, Zilog, and developed the Z80.Z80 can run 8080 code, it is backward compatible, but I8080 can not run Z80 code. This is for the software part.In hardware, I 8080 requires dedicated chips around it in order to make a computer, while Z80 already has those chips integrated internally, so a Z80 computer is much easy to built in terms of hardware.Intel 8080 and Z80 are very different, and can not be used interchangeably. Yes, Z80 is backward compatible, it can execute Intel 8080 binaries, but the rest is different.Pick a hardware platform, either Z80 or I 8080, then ask specific questions.My recommendation will be to go for a Z80 system. Intel 8080 hardware was a pain when compared with Z80.

author: pcmad
author_rank: Regular Contributor
timestamp: September 03, 2019, 01:02:38 am
content: i got a z80 and supporting chips if you want to buy them off me based in uk

author: nigelwright7557
author_rank: Frequent Contributor
timestamp: September 03, 2019, 01:17:06 am
content: I started programming around the time of Z80's.I did a lot of programs for the Sinclair ZX Spectrum like games and a Teletext adaptor software.A nice processor well ahead of its time.