Resources
Datasheet: http://www.vintagecomputer.net/fjkraan/comp/qx10/doc/nec7220.pdf
This is best used for designing a circuit with the uPD7220 and for understanding how to initialize and draw with it.
Programming Manual? : http://www.vintagecomputer.net/fjkraan/comp/qx10/doc/nec7220.pdf
This will explain how to send commands and generally how the CPU to uPD7220 interface works.
My Z80 code: https://github.com/NuclearManD/z80-code/blob/master/G00nOS/upd7220.z80
This is the graphics driver I am writing for my Z80 computer. It's good example code, but it currently has numerous limitations, so look at the arduino sketch I uploaded to this project as well.
Why?
I want a graphics card for my Z80 computer so it can operate completely independently, as in, without a serial monitor.
I don't want to use a propeller chip or other powerful microcontroller because those chips don't go with the rest of my Z80 computer. Besides, something about this design just feels really... pure, I suppose. Clean.
NOTE: The information provided in this details section is very condensed. There is much, much more to be understood. I recommend STUDYING the documents I linked and uploaded. The following information is just a brief overview.
How does the hardware work?
The uPD7220 generates VSYNC, HSYNC, and BLANK signals. It generates a few other signals for the memory interface, but these must be interpreted. The uPD7220 address and data lines share a bus, so the address has to be latched. Also, to write to memory, there are special cycles which require external hardware to generate a write enable.
There are two clocks. The pixel clock, which is currently 8Mhz, is used to output pixels. The uPD7220 takes lower frequencies, so the pixel clock is halved to make the 2xWCLK clock, which is sent to the uPD7220.
The uPD7220 reads the pixel data onto the data bus, where it is latched every fourth pixel clock rising edge. The shift registers output pixel data while the uPD7220 prepares for the next set of pixels.
The port which goes to the system microprocessor is directly connected to the uPD7220, except for two OR gates which generate the WE and RD signals.
How does the software work?
There are two ports that can be written/read on the uPD7220:
READ | WRITE | |
0 | Status register | Parameter load |
1 | Data to CPU FIFO | Command load |
Before each write, the status register FIFO full flag must be checked first. If the FIFO is full, then a write will create undefined behaviour.
The uPD7220 must be initialized properly first. If it is not initiallized right, then random commands will crash it when it is least expected. These commands all must be used in initialization:
0x00 : reset (followed by graphics parameters)
0x47 : pitch (aka tell the GDC the number of horizontal words there are per line)
0x70 : set up PRAM so drawing operations work
0x4B : CCHAR : set up character parameters.
0x46 : set the zoom. Otherwise zoom may be random.
0x6B : start the display! YEET!
I have a small problem (my wife says it's a problem) with collecting interesting chips from the 70's and 80s. A recent acquisition is a lovely NEC uPD7220. A bit of googling led to your project. This is awesome. I think it's way over my head at this point (I've been playing with z80s and 6502 projects for a couple of years, but I'm a slow learner)
Perhaps I'll order a pcb from your design just so the chip has an appropriate home!