Z80 Project Updates and Revision Control
Last updated: 26 Mar 2010 - 22:39
It's been a (very) long time since the last update to this project. I've been busy on loads of new stuff for the project. The system is now capable of booting a binary from SD card or USB memory stick formatted in either FAT16 or FAT32. There's also full PS/2 keyboard support, a much more sophisticated interrupt control mechanism and a VGA display now.
I'm planning to go through all these new features and write-up how I've got there but for now I'm just going to do a summary. Since my last update, I have built a basic chassis to contain the growing number of boards and hold all the connectors, there's a new connector board which has the USB host sockets, an SD card slot, PS/2 keyboard connector a composite video output connector and a 3.3V and 5V power supply. This connects up to the original pair of boards providing power and two LEDs (one is driven by the PIC as a "hard disk light" when accessing the SD, the other is driven by a transistor from the Z80's HALT line), the 5-pin
Z80 Project Mark 2: More UART Shenanigans
Last updated: 18 Jan 2010 - 22:38
A couple of minor updates you might be interested in. I got a quick demo echoing characters back to the PC working last week. This uses the interrupt on receive feature of the UART setup to trigger a send routine as soon as a character is received. The demo code is available on the Z80 Project page.
It's all fairly simple but there are a few delay loops and things involved. It's also worth checking out the updated Memory and IO schematic as I've updated it with the software reset control for the UART. The only problem I had with this new bit of code was that the compiler wasn't doing exactly what I expected. After a bit of fiddling and dis-assembly I discovered that (probably fairly logically) the org statement doesn't pad the output with anything when generating the binary file, it just offsets the current count for calculating jumps. This of course meant that when I downloaded the binary file I'd generated the first instruction was a jump that missed the entire block of cod
Nathan's Z80 Project Mark 2: Serial bug killer
Last updated: 10 Jan 2010 - 21:50
I left my Z80 project behind when I went to see family over Christmas, I did do a tiny bit of coding while I was on holiday but not much. Back in snowy Bath this weekend I got some more done on the project. I've spent a lot of time on the documentation. The main reason for this is the fact that I keep doing bits then not looking at it for a couple of weeks and I forget where I was and what changes I'd made. I'm also hoping to use a lot of the circuit designs in the Mark 3 project at some point in the future and if they're out of date and un-documented it could result in some expensive and useless PCBs.
Actual real progress: Update BIOS image via debug port. A python library to make comms with the PIC easier. UART fitted and debugged. Some additional commands in the PIC firmware including the ability to perform a system reboot from the host PC.
After some head-scratching I managed to get the BIOS update via the serial port working. I basically copied the code examples fro
Nathan's Z80 Project Mark 2: An actual Z80!!
Last updated: 06 Dec 2009 - 18:20
At long last I've fitted a Z80 into the Z80 computer. I know shocking isn't it. After months of tinkering with it and fiddling with things using the on-board PIC I finally got the boot code sorted out and the clock generation (in the new file called boot.asm). After some serious head scratching about why id didn't work, I got it all running smoothly and counting on the debug port LEDs.
New Code I've added the boot.asm file which contains the code to copy the top 8K of flash from the PIC into the system memory starting at address 0. This, along with the rest of the boot setup happens faster than you can see so it looks like the system is booting straight from ROM. The clock generation is also in the new code, I've used one of the PWM peripherals in the PIC to generate a 50% duty ratio square wave at a software selectable rate. At the moment it's hard coded into the PIC assembly code, and it's only running at 250kHz because my scope is pretty slow and I was hav
Nathan's Z80 Project Mark 2: Memory Installed!
Last updated: 18 Oct 2009 - 21:08
More progress on the Z80 project; I have fitted the first RAM chips tonight. After sorting the code so far into 3 source files, I implemented the memory read and memory write functions. These appeared to work on single memory locations, so I implemented the block read and write functions. Using a Python script (see the Z80 Project page for the file) I wrote the XOR combination of the high and low address bytes to each memory location, then read the memory back and tested it against this value.
So far I've fitted one 32K RAM chip in the lower half of the address space and an 8K chip in the upper half. This shows up correctly on the memory check. The script writes address from the top down, so when the 8K chip gets written with the data for the top 8K of memory this is subsequently over written with the chip in its lowest possible space. Hence the memory scan determines that there is memory up to address 0x9FFF (40K).
Due to the maximum packet size of 256 bytes, the maximum d
Nathan's Z80 Project Mark 2: Comms Protocol
Last updated: 09 Oct 2009 - 20:54
More progress has happened already!! I managed to get a basic comms protocol up and running to allow a flexible command structure for accessing the PIC's debug functions. The comms protocol makes considerable use of the 18F's additional commands and indirect addressing, and is quite generous with RAM since the 4520 version has 1.5KB available.
Z80 Project Mark 2: More Dodgy Mods
Last updated: 06 Oct 2009 - 15:18
So, I got some lights flashing over two weeks ago and then went quiet, "what's been going on?" you may well ask. Once I got the lights flashing, I wrote another demo that does a chase across the row of LEDs, this would show up if any of the tracks on the data bus were shorted as each led is lit individually and is driven by a single bus line. Once I'd done that I started work on the serial port code for the PIC's onboard serial port. The basic send and interrupt on receive code is working so it echoes each character it receives back at the moment. However to test the code in the PIC I needed a nice serial-terminal application so decided to write one with PyGTK, threading and python-serial. I've got that working fairly well now, once I've developed it a bit more I will probably release it somewhere.
However, I hit something of a problem while studying data sheets. It explains why no one has tried this whole running DMA while the Z80 is in reset idea before. Basically while the
Z80 Homebrew Progress
Last updated: 02 Sep 2009 - 22:26
I've made some progress on the Mark 2 project and started the Mark 3!! First the Mark 2, I've built the system that I detailed in the articles on the Mark 2. There are a few odd bugs that I spotted as I tidied the circuit diagrams to add to the articles, these will need minor re-wiring of a bit of the glue logic. I kept the system on two bits of strip-board with the CPU and the PIC on the top layer with a bit of glue logic, the rest of the system (I/O decode, memory and peripherals are all on a lower layer, interfaced with 4 ten-way pin headers and receptacles. (Pics will follow soon). The pin-outs of the connectors can be seen in the circuit diagrams.
I've done electrical testing on the system so far. All of the power pins have the right voltages on them, including the +/-10V outputs on the MAX232 chip. The clock output on the 74HC4060 chip that provides the clock for the UART is stable and at the correct frequency. The PIC also registers with the correct part number when c
Nathan's Z80 Project Mark 2: CPU
Last updated: 26 Aug 2009 - 23:06
The CPU in this system is a Z80 of course. There isn't much to this section in way of technical content, just a few explanations of what pins I've ignored and why really. I'm not using the RFSH pin as I'm using static RAM, I can't think of a reason to use this in a modern system, and can think of lots of reasons not to, DRAM is just too much like hard work if you ask me. I've not connected anything to halt as I didn't really have room on the board in the end, it is often handy to put an LED on here (although it should be driven with a transistor as this pin can't sink/source much current). I've not used the non-mask-able interrupt so that's tied high to stop it going off by accident, the M1 line is not used in this simple system, so is left un-connected.
There are two interrupt sources in the system, the clock and the UART, so the interrupt signals are combined with a simple AND gate, (remember if you want a trigger on either one OR another active low signal you must AND them, l
Nathan's Z80 Project Mark 2: CPU Supervisor
Last updated: 24 Aug 2009 - 22:43
A large amount of the usual faff found in Z80 systems has been avoided in my design by including a PIC next to the Z80. This PIC replaces the reset timing circuit, the clock generation circuit for the Z80 and the need for ROM and associated decode logic to select the ROM chip. In addition it provides mass storage (via an SD card interface) and a useful in-circuit emulator for debugging.
All this is achieved by giving the PIC ultimate control over the Z80 by controlling the reset and clock lines, as well as the DMA control lines. The PIC can then control the system while the Z80 is in reset or DMA mode. Since PICs can turn their pins from input to output, several pins function both as input and output depending on what the PIC is doing (e.g. RD, WR, WAIT etc.) Others have been added specifically for debugging or booting (e.g. MREQ, IORQ, and address pins). To be able to drive the whole 16bit address bus the PIC uses a latch for the high 8bits. The lower 8 are driven directly b