View Full Version : Supergun with horizontal/vertical FPGA switch
01-12-2008, 05:47 AM
I am trying to figure out what would go into building a supergun that had a horizontal/vertical FPGA switch that would rotate the output 90 degrees for vertical arcade games such as Pac-Man, Ms. Pacman and others.
This started out just being about Ms. Pacman, but its evolved into a topic about a supergun with a horizontal/vertical FPGA switch, so I am starting a new thread here.
So in the original post,
the last thing that was said was by Stone:
If you did want to use an FPGA it could be done, you'd need to digitise the input video stream at a convenient resolution, store it in a dualport RAM (unless you worked out a convenient interleaving method - much harder than you might think) for one frame, then output it to an ADC. It's mostly complicated by the need to have a full frame stored before you can start outputting it in a different order...
I can give you some tips if you're up to it but I'm not going to do it for you ;)
Heh, about a week ago, I didnít know what superguns and JAMMA are, now in addition to learning about those, Iíve been reading up in Wikipedia about FPGAís, DPRAM, FIFO, etc!
Thereís no way I could do this, but if I can figure out exactly what needs to be done, and maybe even find other people who would like this done, my chances of getting someone to do this vastly improvesÖ
Iíve been poking around to see if anyone has done anything similar and found this:
Itís Robert Norbergís master thesis on Real-Time Video Rotation.
Can this be used as a starting place?
01-13-2008, 12:02 PM
OK, it was a bit of a throwaway comment but I'll explain what I meant in a bit more detail...
My uni dissertation was on a VGA video wall - the idea was that you could plug a VGA input in one end and get 9xVGA outputs, in a 3x3 grid, each showing a small part of the output signal. The input video was digitised by a fast ADC (with a sample clock that was semi-locked to the input - I assumed 640x480 and then started a frame a set number of clocks after a horizontal sync pulse, resetting whenever I got a new sync pulse - worked OK but not as good as using a PLL). I digitised each one of R/G/B channels at 8 bits, then threw away some data so I had RGB565 (6 bits of green, 5 of red and blue, for a 16-bit dataword per pixel). The data went onto a big common databus with 9 output modules hanging off it - each one had a bunch of multiplexers, a VGA DAC/output driver (THS8134B, http://focus.ti.com/docs/prod/folders/print/ths8134b.html) and a big asynchronous SRAM, each capable of storing one frame. The idea was to store the first ninth of the screen in the first sram, then the next ninth in the next sram, then work around until a full frame had been captured, with the output modules spitting out the same pixel three times until the end of the line, then repeating the line three more times so each input pixel became 9 output pixels. An FPGA card coordinated switching data around and doing the read/write signals for the SRAM.
It never quite worked, mainly because I cheaped out and tried to do everything with one SRAM per output - I was double-buffering it by splitting the RAM into two banks, but the chips weren't really fast enough to take the abuse. Also wasn't helped because my board was massive and the short signal rise times turned my main bus into a transmission line which killed a bunch of my chips with overvoltage...
I wish I had the time for a nice side project like this but I have a fulltime job now ;-) Doing a rotation is in principle much simpler than what I did - for the simplest method you'd only need two SRAMs (one in, one out, swapping each frame) and you'd continuously fill one with input pixels while spraying them out the other end in a different order. You'd need to have a good hard think about how you were going to get the aspect ratio right - just swapping the rows and columns would work but the picture would be stretched horizontally. Might be more worthwhile sampling input at TV-res and outputting at VGA so you don't lose any pixels.
Hope that gave you some ideas :icon_bigg
01-13-2008, 11:03 PM
That would be absolute crap since at best you'll loose 66% of the horizontal resolution and you'll be wasting 1/3 of the screen; rotate the monitor!
If I were to do it, I'd do it a field at a time instead of a frame, since DP memory is really expensive and doing it a frame at a time would mess up progressive games which is practically all of them. The idea is to lock onto the horizontal sync and sample the active video 240 times over each of the 240 lines in the field. To get the best results you'd have to sample each line 720 times and interpolate it down to 240 lines, but no matter what it'll look like crap. To rotate the picture and retain the aspect ratio, you'd need to create a 320x240 display, blank the first and last 40 horizontal pixels, and render a vertical row of pixels instead of horizontal. This may sound easy but you'll have to compensate for interlaced games which means keeping track of fields and shifting the picture a pixel based on whether the last field had an even or odd number of lines, this will give you the full 480 lines of vertical resolution but the screen will shimmer in an annoying way. The correct way would be to switch interlaced games to 640x240 and add a blank pixel for an even frame's pixel to interleave into, but this will also look like crap since the blanked lines will be really noticeable since in emulator terminology that's "50% scanlines". To do it nicely, you'd want around "20% scanlines", just so that when the field shifts, there's no shimmer and you can't see the blanked lines. That display is a little more complicated to design, but would be worth it. Anyways, the logic is the least of your problems. Expect this to cost $200+ for the parts, $100+ for the PCB, $200+ to get it built by a pro, and $XXXX for your time or someone else's to design and debug it. All for a horrible picture.
01-16-2008, 05:39 AM
Maybe you should just give in and rotate a monitor. As Calpis pointed out there are technical reasons that pose a problem.
I can think of a few issues. I think Pac-Man is running a resolution of 256x240. Well you want to rotate that so you don't have to rotate your monitor. Well your picture isn't square. And you aren't going to get more than 240 vertical lines. So you're going to have to figure out how to process the image, altering it and reoutputting it. That's going to be complicated if you don't already know what you are doing. And Calpis suggests it'll be expensive.
But you have other options that are easier. #1 Emulation. #2 Console ports. #3 Buy a RGB monitor intended for vertical games.
Even if you don't have a monitor intended for the vertical games you can rotate it and if you do something you can prevent distortion. The money you'd spend on a project like this could easily buy you a monitor. I just think you are biting off more than you can chew. Remember, if it were easy someone else would have done it already.
01-16-2008, 06:37 AM
Agreed. Thanks to Calpis, Stone, and everyone for explaining this so clearly. Its just not worth it from what y'all have said.
I have no idea how we would rotate our television. It's a 40" widescreen LCD. There's no way to turn it on its side that I know of.
Although if it could be done it would actually be cool since it would be closer to the aspect ratio of a vertical game than an old square monitor.
We REALLY don't want to bring in another TV into our apartment, if we had room for that, we'd probably just buy a real Ms. Pacman arcade cabinet.
So I think we are stuck trying to find the very closest port of the game to the original arcade for my wife.
If it captured the aspect ratio of the original (i.e., a small vertical rectangle in the middle of our widescreen), it would look so much more like the real thing.
Having a 4-way joystick made custom would definately make it feel more like the arcade too.
EDIT: It looks like I was saying that vertical games used an aspect ratio other than 4:3... That's what I get typing late at night...
01-16-2008, 11:20 AM
??? Vertical games use "square" (4:3) monitors as do horizontal games.
The closest port you'll find is emulation. Perhaps it's on an Xbox retro collection or something.
01-16-2008, 08:41 PM
Sorry if I wasn't clear. I just meant rotating a 40" widescreen would look really cool, nice to show off to friends, and if I could use a supergun with it even more cool...
Also, asthetically wouldn't a 4:3 Ms. Pacman would look loads more cool on a vertically oriented widescreen with black on the top and bottom than in the middle of a horizontal widescreen?
Hard to say without doing it...
I may check on AVS forum about building a stand like that....
01-17-2008, 02:16 AM
Widescreen monitors rotated vertical look rather weird. I'd rather have black bars and horizontal monitor for something like Pacman. Now for a shooter like Raiden, that'd be different.
01-17-2008, 03:20 AM
I'll have to try and find a picture of a big widescreen TV rotated vertically. Sometimes beauty is in the eye of the beholder, or perhaps we will think its ugly too.
I have no idea if building a stand that would raise it and allow it to rotate without damaging it is even possible yet.
We haven't totally ruled out emulation, but we see that is a last resort after we've ruled out every other possibilty.
Anyway... I'm still researching all my options... and I appreciate people taking the time to help explain the problems with this project.
01-19-2008, 03:59 PM
See if you can get one with TV inputs... or use an xRGB...
01-21-2008, 12:23 PM
See if you can get one with TV inputs... or use an xRGB...
Is'nt that done via Windows? Can it be rotating via the monitor it self?
If so that would be a good answer!
01-21-2008, 11:16 PM
I think it's done via the display adapter, which could care less about how it shifts out the pixels. Windows has to reconfigure the layout so that it's usable however.
01-24-2008, 01:26 AM
WATCH THE WHOLE VIDEO, PEOPLE!!!
Yes, he rotates it by software. But why? It is so, at the end of the vid, he can ROTATE THE MONITOR WITH HIS HAND!!
If you can find one of them with a TV input (OK, more likely to be S-Video or composhite than RGB), then you're onto a winner ;-)
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.