Hey everyone,
Another project I'm working on is a simple "video card" for my Z80 system.
Of course I've taken inspiration from Ben Eater, but now that I have the basics I'm looking to actually make this thing functional. I am running 640x480 but I've divided the pixel count by 4, so I'm really only running 160x120, which is 19200 pixels.
I thought about using a modern MCU of some kind for the video controller... I know it is "cheating" on a build this old but I -really- hate composite. I know that's sacrilegious lol
I'd much rather have VGA or something clear. Composite signals and CRTs just hurt my eyes!
So instead of shelling out for old ICs on eBay, I'm just gonna try to homebrew a controller.
So with these old video cards there are usually 2 modes.
Text mode and
Graphics mode.
Text mode doesn't seem so bad, and will be my first goal on this project. This can easily be implemented in I/O space.
Because I plan to do 8x8 pixel characters, my 19200 pixel/byte frame buffer can basically be reduced to a 300 byte frame buffer using character ROM.
Actually less because I would have at least 1 character blank buffer around the perimeter of the screen.
So the pins I would need on my MCU (Likely an Atmega32 or something with a high pin count) would be:
- 8 pins - Z80 to MCU data bus
- 3 pins - Z80 to MCU address lines
- 1 pin - IOREQ
- 1 pin - Z80 WR
- 1 pin - Z80 RD
- 1 pin - Chip Select
- 8 pins - MCU to framebuffer RAM data
- 4 pins - MCU to framebuffer address
- 1 pin - MCU to framebuffer RAM WR
- 1 pin - MCU to framebuffer Enable
Total: 29 pins I think?That leaves me 3 pins if I forgot something, I think it can be done with a 32 IO pin Atmega32.
But
graphics mode on the other hand... this won't really work. I would need 16 bit address space from the MCU to the frame buffer, not to mention the high overhead of writing 1 pixel would need 6 operations.
LD A, VID_ADDRESS_MSB
OUT (VIDEO_WR)
LD A, VID_ADDRESS_LSB
OUT (VIDEO_WR)
LD A, ACTUAL_VID_DATA
OUT (VIDEO_WR)
For text mode this is fine, roughly 131 cycles to write 1 letter on screen isn't a big deal, but if I'm wanting to write an entire frame buffer it is massive.
Let's say I want to fill an entire screen (assuming the video controller doesn't have a blank command or something to do this without all of the overhead) it could take me almost 80ms to blank the frame buffer at 4MHz. Without a raster or DMA this would be awful.
So I'm kind of stuck here. I want a graphics mode but FPGA's are kind of pricey.
Maybe there is a happy medium? Maybe tile graphics or something? I would love to hear yall's thoughts!
EDIT: If I really do have 2-3 pins left over on the MCU I could also use those to trigger latches connected to 2 RAM IC's enable pins and whatnot. Then I could use them to build a double frame buffer and switch between the RAM chips and then there would be seamless writing to the screen.