Some VGA design decisions

In order to generate a VGA signal that a monitor can interpret, there are a number of pieces of information you need to decide beforehand.

Firstly, what resolution do you want your display to have? Secondly, how many bits per pixel (bpp) do you want to have?

To decide on those values, we need to think about the address space of the computer.

For a Z80, there is a 16-bit address bus ( 0x0000 – 0xFFFF [ 0-65535] ).

HD is 1920×1080 which is 2,073,600 possible pixels. If we were to use 1 byte per pixel, that’s 16,588,500 bytes ( approximately 16MB ). Even if we were to use 1 BIT per pixel ( a monochrome image ) there would be no way physically address each of those pixel locations with a Z80 unless we had some clever banking circuitry to switch between a number of memory chips.

The standard VGA timings don’t go lower than 640×480 ( see https://www.digikey.com/eewiki/pages/viewpage.action?pageId=15925278#VGAController(VHDL)-Appendix:VGATimingSpecifications ) for those details. A 640×480 resolution at 8bpp would be roughly 2.3MB. At 1bpp, it’s 300KB.

So, what could we do? Well, we could double the height and width of the pixels and have a 320×240 resolution. This would give us a 76,800 byte memory requirement for 8bpp which is 9,600 bytes at 1bpp.

I’d like to compromise at 4pp ( 1 each for R,G and B and 1 for future use like transparency ). That would give us 38,400 bytes of video space.

Something to consider as part of this is how much memory is left available for programs and data.

The TOTAL address space of the Z80 is 64K ( 0-65535 ). If we have, say, 8K ( 8192 bytes ) for ROM plus the 38,400 bytes of video space, that gives us 46592 bytes already used. Out of 64K, that gives us 18,943 bytes available ( roughly 18K )

That’s not too bad. I had considered using the IORQ pin of the Z80 to indicate we would write to some dedicated memory on the video card but taking that pin low indicates only the least significant 8 bits (7-0) of the address bus contain a valid address so we can’t address all 38,400 using that method plus there are other devices using IORQ such as the serial output.

That said, I could use IORQ to switch between video and regular memory using a flip-flop but that will be for a future version.

All these things I need to think about. With my current design of the Z80 computer I have, the video memory will need to be reserved.

Leave a Reply

Your email address will not be published. Required fields are marked *