Hello everyone! While I wait for boards and parts to come in for my current VGA project (
viewtopic.php?f=12&t=6914), I've been thinking of different ways to access video RAM. I'm going to make a list, perhaps you know of another way I haven't mentioned. The idea is that the processor and the video display BOTH need to access the same RAM somehow. How is this done?
1) Dual Port RAM. Those big hunkin' chips with duplicate ports.
Advantage: All the work is done, just connect both ends and off you go!
Disadvantage: They often are so small on memory size that they would have to be limited to text character data, or perhaps a small monochrome graphic display.
2) Frame Buffer. Basically having twice the amount of RAM, and "ping pong" who gets control of which chip. CPU writes to A but video reads from B during one frame, then CPU writes to B and video reads from A on the next frame.
Advantage: You can write to video RAM any time you like. It also should not cause tearing.
Disadvantage: The software side is tricky since you have alternating images to deal with.
3) Double Duty RAM (like the Apple II). One single RAM chip, but processor accesses on the high phase, and video accesses on the low phase. This is what Bill is doing here:
viewtopic.php?f=4&t=6955Advantage: You can write to the video memory any time. You do not need to have duplicate your RAM, only one image to deal with.
Disadvantage: You must run the CPU at the speed of the 25.175 MHz necessary for VGA, or a dividend of it using latches/flip-flops. This is still very fast for me personally. Also you could get screen tearing.
4) Half FPS, Cached memory. I don't have a good name for this. You simply draw the same image twice in a row, thus not 60 FPS but now 30 FPS. While video is reading the RAM, it is also storing it in a duplicate cache RAM, for the second frame. After the first frame is done, send an interrupt, and you now have almost 1.25 frames worth to write to RAM.
Advantage: You won't have tearing. You have ample time to write to the RAM.
Disadvantage: You can't write anytime you like. You have to have double your RAM. The screen refresh rate is halved (but that's no issue with modern video games btw).
5) Write when Black. This is the style I am using on my VGA project. When off of the visible screen, send an interrupt to tell the CPU it's time to write to video RAM.
Advantage: It's easy to implement. Single RAM chip.
Disadvantage: Depending on how much 'black' you have (including porches and syncs), you might not have a lot of time to write to the RAM. The minimum seems to be 1429 uS.
6) Latch and Wait. Here you don't actually access the RAM directly, you just send data to a latch and wait for video not use the RAM anymore. That could be in the 'black' or 'double duty' style. If you are familiar with The 8-Bit Guy, his "Vera" chip on the Commander X16 is similar to this design.
Advantage: You can write at any time, supposedly.
Disadvantage: If you intend to write at any time, you need to have lots of logic to make sure no data is lost. Also without direct access to RAM you will have to have even more glue logic to keep the process of writing fast and easy to use.
7) Halt the Processor. This is what Ben Eater uses on his "worst video card" series. Use the RDY and BE pins on the 6502 to literally stop all processing while drawing.
Advantage: You write whenever you want. It's not too hard to implement.
Disadvantage: You are REALLY limiting your processing speed, as shown in his videos.
There of course could be alterations to "enhance" one of these methods. For example, you can add some shift registers or latches/flip-flops to use less color bits but also half the speed required to access them.
Any thoughts? Have you used one of these methods, a variant of one of these, or something else entirely? This is not a comprehensive list I'm sure.
Thank you everyone! Just discussion here.
Chad
EDIT:
8 ) Race the Beam. The processor manually draws what is going to the screen. This is what the Atari 2600 did.
Advantage: Um. No need for this discussion at all?
Disadvantage: So many...