How to build your own VGA-adapter
My lifetime project: building an 8-bit computer using Z80 CPU. This week I had a bad flu and could not do anything useful so I decided to dig up my old plans for this project. I first re-designed many things, like power, CPU-board, IO-board and so on (my old plans were around 10 to 15 years old). After some thought I realized: When I get even the CPU-board working, I want to display some stuff! So why not build the display adapter first. Plus I planned to build the adapter in a way that it can be used separately from the computer itself. Easy thing to start with.
VGA as a standard was quite obvious choice. Composite-connection is getting quite old and there ain’t especially many monitors (or none?) supporting it anymore. VGA is old too, but it will still be around many years. Though VGA is bit too recent to be used in an 8-bit old-school computer, I decided that it is a good trade off between old and something still around. And I also decided to cheat a little bit on this part of my totally old-school computer.
Next thing was to find out about signalling. There are many resolutions and frequencies that can be used. After a lot of thought, 640 * 480 @ 60 Hz seemed the best as it is kind of a industry standard and uses the lowest pixel clock frequency, 25.175 MHz, supported by standard VGA resolutions. After looking around and thinking of ways to implement the adapter, I dug up some old GAL re-programmable logic IC’s which I got from an old Cisco(?) router/switch/whatever it was and some that I had bought from ebay. They seemed a very nice solution for this project because of their speed and flexibility, plus they are old going back to mid 1980 (they are based on PAL’s which are from late 1970).
Then came probably the biggest problem: Memory amount needed to display picture with 640*480 resolution. Monochrome picture would take 38400 bytes and 16 color (4-bit) image would take 153600 bytes. The monochrome picture would be ok, but the memory required for a 16 colors was just too much. I still wanted to be able to display 16 colors, but not with that amount of memory. I had some 128 kB SRAM’s lying around which was about the maximum I wanted this thing to have. Even that 128 kB is almost too much for a thing that is supposed to be old-school. But still, 16 colors would be nice.. So, thinking and thinking some more. Ping! I realized, I don’t have to draw all the pixel data from the memory. After some calculations I ended up with 512 * 384 resolution. Both numbers are nice round numbers in base-2 space. This leaves 128 horizontal pixels and 96 vertical lines empty, which means 64 pixels on right and left and 48 lines on top and bottom. Remember that quite large border in old computer screens on which there was no graphics? Heh, some accidents are nice. 512 * 384 resolution needs 98304 bytes when using 16 colors per pixel which fits nicely into 128 kB (24576 bytes for monochrome). I was kinda hoping to use 64 kB or less memory in this adapter but sometimes compromises are required.
For more detail: Building a simple VGA-adapter for 8-bit self made computer