I did a bit of experimenting with setting different resolutions on the raspberry Pi for arcade emulation. This was in preparation for getting my standalone MAME image for the PJ adapter.
So the idea here is that the video output would be set to the exact resolution of the game, before emulation is started. Now, there are emulators that already do this, but I wanted to be able to possibly use emulators that don’t, and have full control of the process.
I started looking at the most commonly used resolution in arcade games. This came from MAME’s game info xml dump. Here’s the list:
Popular Horizontal Arcade Video Modes
Number of Games | Resolution |
399 | 256x224 |
391 | 320x224 |
302 | 384x224 |
248 | 320x240 |
197 | 256x240 |
186 | 288x224 |
146 | 304x224 |
132 | 336x240 |
64 | 384x240 |
57 | 512x240 |
53 | 320x232 |
53 | 256x480 |
53 | 256x256 |
47 | 704x480 |
43 | 384x256 |
41 | 480x480 |
41 | 240x224 |
40 | 640x240 |
33 | 512x224 |
33 | 400x254 |
30 | 512x480 |
27 | 352x240 |
27 | 320x416 |
26 | 256x192 |
25 | 640x480 |
24 | 512x384 |
23 | 292x240 |
22 | 512x400 |
20 | 248x256 |
18 | 512x288 |
18 | 240x240 |
17 | 638x240 |
16 | 512x256 |
15 | 448x224 |
13 | 496x384 |
12 | 432x224 |
12 | 256x232 |
11 | 508x384 |
11 | 500x384 |
11 | 240x192 |
10 | 384x255 |
Popular Vertical Arcade Video Modes
Number of Games | Resolution |
540 | 224x256 |
175 | 224x288 |
106 | 240x256 |
86 | 240x320 |
74 | 224x240 |
64 | 224x320 |
60 | 240x240 |
47 | 224x384 |
36 | 240x384 |
24 | 248x256 |
19 | 192x240 |
18 | 192x256 |
16 | 256x256 |
16 | 208x248 |
15 | 384x512 |
13 | 224x272 |
12 | 224x280 |
10 | 216x288 |
So, there are some things that are worth noting. Most games will run in a resolution of 320×240 without scaling. It just means that the screen size may be reduced. We have popular horizontal resolutions of 256 and 288 and 320. We also have a large quantity of games at 336 and 384 which will not display correctly at 320×240 unless rescaled, which we are trying to avoid.
For vertical resolution or line count, we have most games displaying either 224 or 240 lines. This is expected, due to the limitations of an arcade monitor. More on this later.
What we need to do is come up with a scheme to display most of these games at native resolution. Here’s my solution:
The raspberry Pi has 3 low frequency pixel clocks 4.8MHz, 6.8Mhz and 9.6Mhz.
- For horizontal resolutions <=288 pixels, we use 4.8Mhz
- For horizontal resolutions >288 and <=384 pixels, we use 6.8Mhz
- For horizontal resolutions >384 pixels, we use 9.6Mhz
This works out quite well with most games displaying properly and fitting nicely to the available horizontal screen real estate.
Vertical line count is less of a problem. It can almost be ignored except for a few games that display at 248 and 256 lines like Irem’s R-Type and Midway’s Mortal Kombat and other games. Games that go over 240 lines break the rules somewhat (see my video generation tutorial here) and will likely have problems being displayed on anything but adjustable arcade monitors.
What we do in these cases is to reduce the front and back porch portion of the video signal and use that to get the addition line count. In my testing this worked fairly well.
This is the basis of my video mode switching algorithm for emulation going forward. It will be implemented in my standalone minimalist MAME image that can be found here.
One issue with this, console games that switch resolutions on the fly (Seiken Densentsu 3 / the unreleased Secret of Mana 3?) can not take advantage of this.