Project: 8-bit computer system.
the main idea behind this project is to build my own personal computer based on a classic 8-bit processor , like Z80 or 6502. (The suggested choice is Z80, as I allready have 2 pieces. 6502 I could use and explore in my Atari 2600 box)
The main design goals:
1) ROM memory based on EPROM/ EEPROM / FLASH containing monitor program with functions to load code to RAM and execute it. The ROM memory will most probably contain all basic functions like keyboard readout, UART operation, text/graphics output, etc.
2) RAM memory based on a SRAM chip(s)
3) Modular architecture, which will allow future expansion cards to be added to the system.
4) HD44780 based LCD module (as an expansion card) for communicating with the monitor program and the whole system as well. 4-bit mode should be enough to controll the LCD with only one 8-bit latch/buffer, with something like 8255 chip or just directly from system bus. The LCD can be an integral part of the system, or just an optional add-on board – in the latter case it could be replaced with VGA in the next monitor version.
5) Sound – expansion card. I allready have one piece of AY chip, which I could use for this purpose. Other options include other dedicated sound chips, custom circuits (timers maybe). Expansion card form of the sound moudle will give me more flexibility – I could change the whole idea or just discard the sound board if not needed.
6) VGA display – add-on card or some level of integration with motherboard. I choose the VGA standard, because of broad availability of cheap monitors, very detailed descriptions of timmings and protocols, and because it is fairly easy to implement – hovewer it will still be the most challenging part of the whole construction. I consider to research the VGA display as a separate topic along with the main system, in order not to block the main design. There are several ways to achieve VGA display for 8-bit system. One of them is mocrocontroller (AVR-Atmega) + SPI shifting of display data + UART for communicating with main CPU. Other way would be a design based on CPLD, RAM, and a buch of buffers, latches and counters.Here are some design considerations and possible problems I can think of:
Resolution and color depth: affects the needed amount of RAM for video buffer and the memory control circuity.
Transfering data to Video RAM: serial (Atmega+SPI+UART) or parallel. In the first case there will be a need for UART chip in the system, dedicated to video data transfers. The second case involves more problems with vertical/ horizontal sync, RAM bank switching, CPU and display card memory sharing problems. Maybe a separate address space for Video RAM ?
Integration with the system: based on memory or I/O address space ? Maybe both ? Is there a need for interrupt driven operation ? bitmap graphics or ROM-generator based text display ?
7) Keyboard: hex matrix keyboard would be the easiest way. A better idea is to use a matrix keyboard with much larger number of keys. There are lots of examples how to use a PC keyboard for this, but it is not trivial. One should design a serial to parrallel converter (based on AVR or other microcontrollers) for the keyboard or replace the 8048 chip with some custom circuit (maybe just a simple cable) . This subjest is to be discussed later anyway. There is also one more possibility – to use a keyboard from Commodore C64 computer – it is an easy 2x8bit parallel interface (just a matrix). The mechanical construction is solid and easy to reuse in a custom system. There is also a goldpin header with 2.54mm raster. Keyboard routines could be integrated in ROM, maybe with interrupt mechanism.
8) System bus: I could go with the ZX Spectrum example and place all the CPU bus on one connector: address, data, control lines, power supply, clock, reset signal. Suggested hardware solution: an add-on board could have 2 sets of connectors: one for system bus side, the other: as a pass trough connector for daisy-chaining with other expansions. There is still a problem with address decoding: should it be done on the mainboard (with help of some 74xx138 chips) or on every card alone ? In the first case we have a fixed number of expansion devices with certain addresses. The advantage is that the expansion boards desing would be a little simplified (no address decoding – maybe even no need for any address lines at all on the bus!). The second option is to decode address on every board. The decisions made here will affect the expansion bus final form and limitations.
9) I/O ports: There could be an 8255-like chip integrated on the motherboard, or the I/O functions could be done entirely on the expansion boards. I/O ports could a joystick readout for example. For a joystick function I could use something like Spectrum`s kempston interface circuit.
10) Loading programs: RS232 port and downloading form PC. I may consider a tape loading circuit as well (some more research in the subject would be needed). There is a very attractive option of using an Atmega328 based SD card interface with FAT support. Atmega could communicate with the CPU using UART or some dedicated protocol. SD-card module could be attached to the system using system bus, on an expansion card, or integrated on the motherboard. The system could make use of the FAT system with some custom protocols / commands. The routines could be integrated into ROM monitor as a simple DOS.
11)Other devices: EEPROM for configuration variables, RTC clock (could be integrated into ROM monitor functions).
Suggested stages of building the system:
It would be great to be able to develop most of the functionalities in parallell. However, some of the functions require a definite system bus specifications.
- -> Obtaining and testing of a Z80 CPU. a NOP machine used on the internet would do the trick (completed 19.03.2014 – both pieces of Z80 are operational)
- -> Checking the SD card interface fuctions with Atmega238. I only need to finish a previously started prototype and test it. (checked on 19.03.2014)
- -> Writing an initial version of ROM monitor with keyboard and LCD support.
- -> LCD interface design – needed in in the initial stages of the project.
- -> ROM memory problem: There is a need of a EEPROM / FLASH programmer. I could build a custom one and use an LPT port of a PC. I could also buy a Willem programmer, and use it for ATARI 2600 development as well. (Willem bought in meantime)
- -> mainboard: first a prototype, then a production of a PCB. The mainboard should be a solid non-prototype build. The add-on modules would be made in any fashion desired. We can assume at this point that a motherboard should include: CPU, ROM, RAM, address decoder (for RAM/ROM and IO , maybe I`ll check how they made it in ZX Spectrum…), expanstion connector, system bus, keyboard port, power supply , clock source, reset circuit.
Some usefull resources on the web:
Some chips that could be useful for VGA adapter development: