Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - Game Gear SMS mode video scaling

Reply to topic
Author Message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12910
  • Location: London
Reply with quote
Game Gear SMS mode video scaling
Post Posted: Tue Jan 09, 2007 2:48 pm
I thought I'd start up a new thread for this since (1) it seems only to be documented as side-notes in other threads, or not at all, and (2) I was discussing it with benryves via PM and it seems worth sharing.

The Game Gear screen is 160x144 pixels, the SMS screen is 256x192 pixels (ignoring extended height modes and left column blanking). To display SMS mode games on the Game Gear (and SMS games via the Master Gear adaptor):

1. The leftmost and rightmost 8 pixels of the SMS screen are discarded
2. The uppermost and lowermost 8 pixels of the GG screen are left blank.

This leaves 240x192 SMS pixels mapping onto 160x128 GG pixels, an exact 3:2 mapping.

Horizontally, the Game Gear's LCD subpixels (in BGR format) are divided; for each horizontal pair of pixels, the elements are mapped as follows:
GG   [R][G][B][R][G][B]
      | _|  |__|  |  |
      ||    | |    ||
SMS  [RGB] [RGB] [RGB]

so a single white pixel will never appear white unless there is an appropriate colour next to it - most games tend to use 2-pixel verticals in their fonts so it is merely colour-fringed, rather than multi-colour.

(Based on this post by Charles MacDonald.)

Vertically, there are no sub-pixels. Instead, there seems to be some kind of blurry cross-sampling.

benryves wrote
Moving a single pixel up and down, you get a repeating pattern every three rows (which fits), like this:
[#] <- at top top, you get two stacked grey pixels.
[#]
[ ] <- off

[.] <- dim
[#] <- bright
[.] <- dim

[ ] <- off
[#]
[#]

That's moving an "SMS" pixel down three steps, and the result of a group of three GG LCD pixels.

I'm sure images (or photos) would help here. As I understand it, there's two types of SMS pixel - one that lines up with a GG pixel, which results in most of its "power" going to the one that lines up, but the neighbouring GG pixels are dimly lit; and one that lines up with more than one GG pixel, which seems to light the two corresponding pixels equally. This seems rather inaccurate to me, but maybe it looks OK in practice (disclaimer: I don't have a GG).

Does this sound like any likely hardware arrangement? Would it be possible to nail it down more accurately than "a bit"?

It'd also help to get the extended video modes figured out; presumably, the 224 pixel mode has its top and bottom 4 (SMS) pixels cut off to scale 3:2 down to the GG screen's 144 vertical pixels, it will just take a test program to make sure.
  View user's profile Send private message Visit poster's website
  • Joined: 12 Apr 2005
  • Posts: 372
  • Location: London, United Kingdom
Reply with quote
Post Posted: Tue Jan 09, 2007 3:53 pm
I've found it rather difficult to get clear photographs of the LCD (and don't have a scanner). I'll see if I can get any clearer information. The low contrast of the display doesn't help. :-)
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12910
  • Location: London
Reply with quote
Post Posted: Tue Jan 09, 2007 4:13 pm
A (mini-)tripod and macro mode seems to do the trick for me, at least for photographing my DS; I can even make out the pixels reasonably well with a hand-held mobile phone camera photo. Photographing a TV seems to be trickier in my experience.
  View user's profile Send private message Visit poster's website
  • Joined: 26 Dec 2004
  • Posts: 374
  • Location: Japan
Reply with quote
Post Posted: Wed Jan 10, 2007 2:48 am
Also, does anybody know how the vertical sub-sampling works in GG mode? There are clearly not 144 distinct lines, but some kind of blurring between successive "lines" as well.
  View user's profile Send private message Visit poster's website
  • Joined: 12 Apr 2005
  • Posts: 372
  • Location: London, United Kingdom
Reply with quote
Post Posted: Wed Jan 10, 2007 12:04 pm
Last edited by benryves on Wed Jan 10, 2007 2:39 pm; edited 1 time in total
Here's what I've worked out from taking photographs. Let's start with the easy one, which is the 224-line extended resolution.

Lines 0 to 2 (inclusive) and 221 to 223 (also inclusive) do not appear to have any influence over what appears on the LCD.

As of line 3, the following scaling takes place:



I hope the diagram isn't too confusing. The small boxes vertically grouped in threes represent a source pixel ("SMS pixel") and the larger boxes grouped in fours are the destination pixels ("LCD pixel").

The scaling turns three scanlines into two rows of LCD pixels; I have drawn four as the colour also bleeds vertically into the rows above and below the 2-line groups.

Line 3 appears as the top line of the LCD, but bleeds down into the second and also bleeds upwards into the row above the LCD.



For 192 pixels, the top 8 and bottom 8 LCD lines are filled with the backdrop colour (noticably purple on the Codemasters intro).

The following scaling takes place, as of "SMS" row 0 (LCD row 8):



This time the alignment is slightly different.



As far as emulating the LCD goes, I'd probably do the following:

Where SmsLine = (LCD row number / 2) * 3, so for the top two rows it's 0, for the next two it's 3, for the next two 6 and so on.

Even rows -> ( 1/6 Rows[SmsLine - 2] ) + ( 1/3 Rows[SmsLine - 1] ) + ( 1/3 Rows[SmsLine] ) + ( 1/6 Rows[SmsLine + 1] )
Odd rows -> ( 1/3 Rows[SmsLine] ) + ( 1/3 Rows[SmsLine + 1] ) + ( 1/3 Rows[SmsLine + 2] )

The exact ratios are a guess. However, the results seem pretty close (SMS-GG Prince of Persia):



The 224-line version could look like this:

Even rows -> ( 1/6 Rows[SmsLine - 1] ) + ( 1/3 Rows[SmsLine] ) + ( 1/3 Rows[SmsLine + 1] ) + ( 1/6 Rows[SmsLine + 2] )
Odd rows -> ( 1/6 Rows[SmsLine] ) + ( 1/3 Rows[SmsLine + 1] ) + ( 1/3 Rows[SmsLine + 2] ) + ( 1/6 Rows[SmsLine + 3] )



So, I get:



As for the vertical bleeding in Game Gear mode, I currently just blend each pair of lines together evenly; it appears that this is what the Game Gear does (I have no proof of that, though). It also looks a lot crisper when the TV Tuner is connected (as if this bleeding isn't there) but I haven't tested too much. I'll hook up my PC to the tuner and try a few test patterns on it and post the findings here.

EDIT: I should mention that in 240 line mode the display loses brightness and goes out of synch, as you'd expect.

EDIT2: "221 to 224 inclusive" changed to "221 to 223 inclusive".
  View user's profile Send private message Visit poster's website
  • Joined: 26 Dec 2004
  • Posts: 374
  • Location: Japan
Reply with quote
Post Posted: Wed Jan 10, 2007 1:46 pm
No, in GG mode, 2 lines don't blend evenly into one "line" on-screen; that's why I asked if anybody knew how it is done.

One thing I tried was Victor Kemp's (?) GG-Windows demo, with the sketchpad tool. Combinations of successive horizontal lines didn't seem to combine easily 2->1, as I remember.
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12910
  • Location: London
Reply with quote
Post Posted: Wed Jan 10, 2007 2:15 pm
I'm just making some backups of benryves' images above, nothing to see here.
not_only_words.gif (11.96 KB)
not_only_words.gif
moving_pixel_192.gif (55.34 KB)
moving_pixel_192.gif
moving_pixel_224.gif (32.13 KB)
moving_pixel_224.gif
pop_comparison.jpg (20.59 KB)
pop_comparison.jpg

  View user's profile Send private message Visit poster's website
  • Joined: 12 Apr 2005
  • Posts: 372
  • Location: London, United Kingdom
Reply with quote
Post Posted: Thu Jan 11, 2007 11:06 am
From what I can tell, only lines 24..167 make any sort of difference. When a pixel is lit, it lights up both itself and the pixel directly below itself evenly; so it's not quite as easy as half the vertical resolution then scale back up.
  View user's profile Send private message Visit poster's website
  • Joined: 29 Apr 2007
  • Posts: 27
Reply with quote
Post Posted: Sun May 15, 2016 11:36 pm
Lately I did some comparisons of benryves's photographs and this RetroRGB image with emulated images scaled using the formulas proposed by benryves.

Initially the horizontal scaling looked wrong to me, but the color sequence seems to match RetroRGB's image, so now I think it is right and just requires subpixel rendering to look better.

About the vertical scaling, the formulas proposed for 192-line resolution does not look right when comparing with RetroRGB's image of Altered Beast, that uses only that screen mode. It's easy to check by looking at the hyphen signal of HI-SCORE, that has original height of 1 pixel and is displayed using 2 pixel height on a GG screen, but benryves's formulas shows three pixels (dim, bright, dim). I got a correct (bright, bright) hyphen when used the 224-line version of the formulas.

Also, benryves's image that compares results of Prince of Persia's "LICENCED BY SEGA" text also do not look right to me. By example, looking at bottom of the L letter, its height must have three pixels (dim, bright, dim) instead only two (dim, bright) got by benryves. I obtained a closer result using the following formulas:

Even rows -> ( 1/6 Rows[SmsLine - 2] ) + ( 1/3 Rows[SmsLine - 1] ) + ( 1/3 Rows[SmsLine] ) + ( 1/6 Rows[SmsLine + 1] )
Odd rows -> ( 1/6 Rows[SmsLine - 1] ) + ( 1/3 Rows[SmsLine] ) + ( 1/3 Rows[SmsLine + 1] ) + ( 1/6 Rows[SmsLine + 2] )

However, those formulas doesn't seem right for other cases like the HI-SCORE text of Altered Beast. I attached one image to this post that shows my result with the Prince of Persia text.

I think benryves did a very good job to obtain the photographs and use them to figure the patterns used to vertically scale the lines. So, I guess the pattern may change for different parts of the screen. I also guess the scaling is done by the LCD circuit without knowing which screen mode is set inside the VDP chip, so my assumption might explain why benryves found two different patterns. Too bad he isn't around, maybe he could do more tests to confirm.

As time passes, I think figuring out how correctly simulate how the Game Gear scaled the image of a SMS game becomes more important, for historical purposes, because the LCD screens are being replaced or become damaged and would be good to have a response when 10 or 20 years from now somebody asks how the original scaled image looked.

  View user's profile Send private message
Reply to topic



Back to the top of this page

Back to SMS Power!