rpiguy2 wrote:
I have not seen a good example of using an MCU for graphics coupled with an external master CPU - how do you get the 6502 to efficiently write to the RAM onboard the MCU. Directly interfacing with the 6502 bus eats cycles. You end up attaching a several hundred Mhz MCU to the 6502, which seems like cheating. The 6502 could send data over SPI or similar, but that is not ideal for graphics/games. It is fine for pure text modes.
Not suggesting this is a good example, but my Ruby board originally used an ATmega to generate composite video. 320x240 monochrome.
Rubishy video here:
https://www.youtube.com/watch?v=09zhGUbVxdUIt communicated to the 6502 via - well, let's just say a parallel interface. The 6502 sent it standard ASCII text which the ATmega printed to the screen, there were commands to move the cursor, clear the screen, plot points, lines, circles, triangles, and read points back from the screen.
The VDU codes I used are the exact same codes that the BBC Micro used. This was by design so I could run BBC Basic.
What let that down was the free cycles left over on the ATmega after the beam racing video generator. Not a lot. It averaged something like 70% of all CPU cycles were used to just maintain the display, so it wasn't fast at accepting commands and doing the video update. Yes, a faster MCU would have been much better, however with having a large amount of experience with ATmegas that's what I chose.
It used the 2nd SPI channel clocked at 8Mhz to output bytes back to back. you have a total of 64µS per line to include the front porch, backporch and hsync, so there were cycles left over with just 40 bytes of video data and a few more to make the timings up, so keeping the image to the left of centre gave you free cycles there, then at the end of the frame, you have all the free cycles during the vertical sync before it starts again. It was all done on a single 64µS interrupt.
What I then did was move the display over a serial line (still through the AVR which could now buffer the data very efficiently) to a "smart" terminal running on my Linux desktop. Same commands, but now I had up to 1280x1024 pixels and many colours (actually much more, but that's the limit of the Acorn MOS which was fine in 1981).
It is much faster - and can handle sprites (when I can be bothered to code them on the 65xx side) as well as sound.
Some examples:
https://www.youtube.com/watch?v=rPGCT0lah4Qhttps://www.youtube.com/watch?v=ZL1VI8ezgYcRight now it's a 115200 baud serial line from the 65xx (via the AVR) to the terminal. It's not that different in principle to the TMS9918, or the Commander x16 'VERA' chip or Gameduino, or the old Tek. 4014 terminal, or the BLIT windowing terminal (c1982).
It takes 6 bytes to plot a point, (VDU command, point command, X & Y as 16-bit numbers) Lines are drawn from the last point plotted (there is also a 'move' command, similar for circles. I can redefine characters by sending the code then 8 bytes of character data.
Moving to SPI or a parallel port through the VIA would make it much faster.
The terminal is actually the screen & keyboard handler from my BASIC interpreter - which is written in C and uses the SDL librarys. I just added in a handler for the Acorn MOS VDU commands. I could probably run the serial line faster, but I don't feel the need right now.
The next plan, if I continue with the Ruby '816 project is to use a parallel interface off the VIA to a "graphics card" which may be a Pi Zero running some bare-metal code, or an FPGA, or who knows what...
Cheers,
-Gordon
_________________
--
Gordon Henderson.
See my
Ruby 6502 and 65816 SBC projects here:
https://projects.drogon.net/ruby/