Video display controller with VGA output
Re: Video display controller with VGA output
drogon wrote:
Going back to direct (memory mapped) video - the issue now is how much RAM? 320x240 is about 9KB per bit depth. So 4 colours (2 bits), almost 20K. 8 bits per pixel? That's 80KB of RAM - in a 6502... Oops. Going to a 65816, great - we have the addressing, but not the speed of a modern system. clearing that at 7 cycles per byte is half a million cycles, or 0.04 seconds - barely 25fps achievable just on screen clears.
Re: Video display controller with VGA output
mojo wrote:
drogon wrote:
Otherwise - you're making the ARM/FPGA into some sort of memory mapped register device? From what I've read on the PiTubeDirect project that's do-able, but only just at the BBC Micros 2Mhz speed and who wants a 2Mhz 6502 these days...
Then there's the OS - PiTubeDirect is a "bare metal" system, but Linux is the default for most people.
So a nice little ARM chip with a meg of static RAM and on-board video generator, lots of GPIO and off you go...
-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Re: Video display controller with VGA output
Doing some research the only issue with that ARM is that there is some bus contention and no way to prioritize the video generation DMA. This is the basic problem with every MCU - even when you have DMA, it's never able to take priority and precise timing.
Re: Video display controller with VGA output
drogon wrote:
The ARM isn't slow, but the Pi has other considerations. DRAM for a start which gets refreshed independently of the ARM, so the ARM gets stalled when that happens. There is also the video refresh too which I think also stalls the ARM. you have no real control over this. The net result is that if you're polling (or taking an interrupt) on a signal, there is every chance you might miss it. The Pi is essentially a GPU with an ARM bolted on the side, almost as a secondary consideration.
It may stall, sure, but the handshaking should prevent actual data loss, right?
What do y'all feel is the minimum processor that can drive VGA effectively? What frame rate would you look for?
According to the Wiki VGA is:
- 640x480 16 color (4bit/pixel 153,600 BpF, Bytes per Frame), 4.3MB/s for 30 FPS (It also says monochrome, but I don't know if that means gray scale)
- 320x200 256 color (64,000 BpF), 1.8MB/s for 30 FPS
But either way that's a lot of bandwidth for legacy micro to drive.
Re: Video display controller with VGA output
The minimum CPU is determined by the pixel clock. 640 pixels is about 25MHz, 320 is obviously half that. So for a typical game you need to pump out pixels at about 12.5MHz, for 80 column text you need 25MHz.
Now look at how fast your CPU can pump pixels. For monochrome you might be able to use an SPI port running at half the clock speed, so you need 25MHz to do 320 pixels. SPI is nice because it's often buffered, which makes timing a lot easier.
But for colour you probably need to push 8 bits at once to GPIOs. You can either make your CPU use an interrupt and copy data from RAM to the GPIO port as fast as possible, but then your CPU is tied up for about 80% of the time and can't manage the 6502 bus. So really you need DMA to do it, and on most MCUs DMA is not very consistent (lots of jitter) and rarely runs at anywhere near the clock speed.
It's kind of a pain actually, maybe an FPGA is the way to go. But they are expensive and there are not many open source tools for them.
Now look at how fast your CPU can pump pixels. For monochrome you might be able to use an SPI port running at half the clock speed, so you need 25MHz to do 320 pixels. SPI is nice because it's often buffered, which makes timing a lot easier.
But for colour you probably need to push 8 bits at once to GPIOs. You can either make your CPU use an interrupt and copy data from RAM to the GPIO port as fast as possible, but then your CPU is tied up for about 80% of the time and can't manage the 6502 bus. So really you need DMA to do it, and on most MCUs DMA is not very consistent (lots of jitter) and rarely runs at anywhere near the clock speed.
It's kind of a pain actually, maybe an FPGA is the way to go. But they are expensive and there are not many open source tools for them.
Re: Video display controller with VGA output
mojo wrote:
It's kind of a pain actually, maybe an FPGA is the way to go. But they are expensive and there are not many open source tools for them.
- GARTHWILSON
- Forum Moderator
- Posts: 8773
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: Video display controller with VGA output
mojo wrote:
The minimum CPU is determined by the pixel clock. 640 pixels is about 25MHz, 320 is obviously half that. So for a typical game you need to pump out pixels at about 12.5MHz, for 80 column text you need 25MHz.
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
Re: Video display controller with VGA output
whartung wrote:
drogon wrote:
The ARM isn't slow, but the Pi has other considerations. DRAM for a start which gets refreshed independently of the ARM, so the ARM gets stalled when that happens. There is also the video refresh too which I think also stalls the ARM. you have no real control over this. The net result is that if you're polling (or taking an interrupt) on a signal, there is every chance you might miss it. The Pi is essentially a GPU with an ARM bolted on the side, almost as a secondary consideration.
whartung wrote:
It may stall, sure, but the handshaking should prevent actual data loss, right?
What I'm getting at is using the Pi or some other SBC as a 6502 CPU level bus interface device. So your 6502/816 writes to a memory location - the Pi/SBC has to listen to the Ph2 clock, the R/W line, the address lines (or "IO" decoded signal and - e.g. some address lines for a register), then sample (or write) the data at the appropriate interval to emulate a cpu-bus level device or memory. There are a lot of people who still want to poke pixels into a framebuffer... This thing is easier with an FPGA than a Pi/SBC device.
Stick it at the end of a strobe+ack 8/16 bit bus like what a 6522 can give you and it's trivial, if a few cycles slower.
whartung wrote:
What do y'all feel is the minimum processor that can drive VGA effectively? What frame rate would you look for?
According to the Wiki VGA is:
But either way that's a lot of bandwidth for legacy micro to drive.
According to the Wiki VGA is:
- 640x480 16 color (4bit/pixel 153,600 BpF, Bytes per Frame), 4.3MB/s for 30 FPS (It also says monochrome, but I don't know if that means gray scale)
- 320x200 256 color (64,000 BpF), 1.8MB/s for 30 FPS
But either way that's a lot of bandwidth for legacy micro to drive.
And going over 255x255 resolution, you're already into needing 2 bytes per co-ordinate too. It all adds up and increases the code complexity for our little 8-bit micro, so sure, I could hook a $5 micro to a 6502 and get it to display 1920x1080x32bpp but what would a 6502 be able to do with it? Even loading a static background image - that's 8MB, so quite a lot to pull through an 8-bit micros 'disk' interface...
However, without a blitter, some of the later games on the Apple II look very good, given the Apple II's video memory arrangement. Same for the Beeb. (ie. Elite) When was the first blitter? I think Atari had something, certainly the Amiga. (Just checked - seems 1985 in the Amiga for a 'home' type system) The C64 has sprite control though, but I note from the wikipedia entry that pixel poking while possible is very slow... (I've never owned a C64)
I'm also starting to think that we ought to abandon VGA too, or at least worry less about the physical connection. Even though retro'r'us we can't stop some of the physical stuff from getting away from us. I started looking at composite... Today I have just 2 displays that have composite inputs. (My 3rd old green tube monitor died) TTL RGB, anyone? I think I'm going to be happy with a device that generates HDMI knowing that there are good HDMI to VGA adapters out there now.
Cheers,
-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Re: Video display controller with VGA output
drogon wrote:
What I'm getting at is using the Pi or some other SBC as a 6502 CPU level bus interface device. So your 6502/816 writes to a memory location - the Pi/SBC has to listen to the Ph2 clock, the R/W line, the address lines (or "IO" decoded signal and - e.g. some address lines for a register), then sample (or write) the data at the appropriate interval to emulate a cpu-bus level device or memory. There are a lot of people who still want to poke pixels into a framebuffer... This thing is easier with an FPGA than a Pi/SBC device.
Quote:
I think going above 320x240 (ish) is too much without some sort of hardware assist - like a blitter and off-screen memory, so the blitter can do a 2D move at < one cycle per byte rather than 7 (or whatever) it might take a 6502/816 to do.
And going over 255x255 resolution, you're already into needing 2 bytes per co-ordinate too. It all adds up and increases the code complexity for our little 8-bit micro, so sure, I could hook a $5 micro to a 6502 and get it to display 1920x1080x32bpp but what would a 6502 be able to do with it? Even loading a static background image - that's 8MB, so quite a lot to pull through an 8-bit micros 'disk' interface...
And going over 255x255 resolution, you're already into needing 2 bytes per co-ordinate too. It all adds up and increases the code complexity for our little 8-bit micro, so sure, I could hook a $5 micro to a 6502 and get it to display 1920x1080x32bpp but what would a 6502 be able to do with it? Even loading a static background image - that's 8MB, so quite a lot to pull through an 8-bit micros 'disk' interface...
Quote:
However, without a blitter, some of the later games on the Apple II look very good, given the Apple II's video memory arrangement. Same for the Beeb. (ie. Elite) When was the first blitter? I think Atari had something, certainly the Amiga. (Just checked - seems 1985 in the Amiga for a 'home' type system) The C64 has sprite control though, but I note from the wikipedia entry that pixel poking while possible is very slow... (I've never owned a C64)
Quote:
I'm also starting to think that we ought to abandon VGA too, or at least worry less about the physical connection. Even though retro'r'us we can't stop some of the physical stuff from getting away from us. I started looking at composite... Today I have just 2 displays that have composite inputs. (My 3rd old green tube monitor died) TTL RGB, anyone? I think I'm going to be happy with a device that generates HDMI knowing that there are good HDMI to VGA adapters out there now.
Your point earlier about the Pi being a GPU with an ARM chip I think is very akin to a lot of the early micros. The graphics hardware was deeply intertwined in to the computer design, and a lot of CPU cycles were dedicated/lost to the graphic hardware trying to feed the voracious and uncompromising composite video demands. In the end the graphics/display hardware was the real master of the bus, and the CPU just got time when it could.
And much of the interface work necessary to pull it off is above many hobbyists, especially if they have to design the graphics part themselves (unless, apparently, you do everything in raw TTL lol).
Re: Video display controller with VGA output
whartung wrote:
drogon wrote:
And going over 255x255 resolution, you're already into needing 2 bytes per co-ordinate too. It all adds up and increases the code complexity for our little 8-bit micro, so sure, I could hook a $5 micro to a 6502 and get it to display 1920x1080x32bpp but what would a 6502 be able to do with it? Even loading a static background image - that's 8MB, so quite a lot to pull through an 8-bit micros 'disk' interface...
I'm going to do effectively the same with a Pi, although I can fix the resolution to something suitable - I did all the graphics code for what I want some 7-8 years ago for my BASIC interpreter then ported it to the Pi as soon as I got one. My graphics driver does sprites, etc. in software - mostly because I didn't know how to do anything more at the time under Linux.
-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Re: Video display controller with VGA output
drogon wrote:
I think it's much more capable than that - there is plenty of spare RAM inside and with clever manipulation of the internal blitter then tiled backgrounds, sprites and text is more than possible. You just need to think differently - think more in terms of a picture than pixels. So load it up with the background, sprites, font and so on, then it's a matter of poking registers than pixels.
Re: Video display controller with VGA output
whartung wrote:
drogon wrote:
Well, that's kind of what crossed my mind regarding that VS23S010D chip.
Re: Video display controller with VGA output
BigEd wrote:
mojo wrote:
It's kind of a pain actually, maybe an FPGA is the way to go. But they are expensive and there are not many open source tools for them.
Re: Video display controller with VGA output
Hmm, OK, that might be a bit of an obstacle. Have you tried a virtual machine? (revaldinho runs a Mac, but uses the linux version of the xilinx tools in a VM.)
Re: Video display controller with VGA output
BigEd wrote:
Hmm, OK, that might be a bit of an obstacle. Have you tried a virtual machine? (revaldinho runs a Mac, but uses the linux version of the xilinx tools in a VM.)
Dave