Closed wa2mze closed 1 week ago
The PICO can easily interface with a CPU bus with its PIOs. But it depends on the speed. Monitoring write cycles is easier, since you have the full cycle time available. And since there is a FIFO for messages between PIOs and the main CPU cores, you just need to make sure the average processing time for a write cycle is below a bus clock period.
Responding to read cycles is possible - but much more demanding. You only have less than half a CPU cycle to respond - then the result must be visible on the bus. And you cannot accept any delays. For slower bus cycle times (1-2 MHz clock) it's possible. If you're aiming for higher speeds, it's probably better to stick to snooping write cycles. And just shadow the memory - which is otherwise available in a real RAM outside the PICO.
Concerning video output: have a look at Luke Wren's PicoDVI project. He has various examples for different resolutions and modes. Some of them will be close to what you need for VGA.
For A2DVI, I only used parts of Luke's library. Basically only the DMA code + interrupt handler + PIO code to blast out the data with the correct timing. Generating the data is mostly custom code. Apple II graphics use an absolutely insane memory layout/bit encoding - correction - "uses a highly proprietary encoding, truely showing off Steve Wozniak's genius". There was no way this would have worked by first rendering a bitmap, and then using Luke's methods to generate the DVI stream. For Apple II, it required custom code to directly convert "Apple II graphics data to DVI TMDS data". But for VGA, you may be able to use some of Luke's encoding code directly.
I just found this project from a link on Adrians Digital Basement. I knew that the Pico could be used to generate both DVI and VGA video, but wasn't sure how to use it AS a GPU with a retro micro computer. I liked the 8 Bit Guy's retro 6502 computer project, but I wish he'd have used the 65C816 processor instead, and I've had a project idea in the back of my head to design my own machine using that cpu, if I could find a video solution.
Perhaps I can fork the A2DVI into a general purpose video solution, it just has to look like a memory mapped video controller that responds to "standard" micro controller signals such as A0-Axx, D0-D7, R/W, Ph2(clk), and VMA. Actual video memory could either be "real" static ram OR be provided by the pico, IF it can write back fast enough with required hold time for the microprocessor to grab it. In the case of a non-Apple II application, I wonder if the pico A2DVI could provide video modes similar to the PC VGA standard(s)? Would the RP2350's higher speed and sram provide for that over the RP2040?