How to setup SNES to display 320x224?

Discussion of hardware and software development for Super NES and Super Famicom.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
User avatar
Hojo_Norem
Posts: 132
Joined: Mon Apr 16, 2007 10:07 am
Contact:

Post by Hojo_Norem »

tepples wrote:The 4x DVD-ROM in the PlayStation 2 console transfers data at about 5 MB per second. A CD-quality VAG compressed audio stream like that seen in DDR series or Katamari series is 50 KB per second. So every 15 seconds or so, the drive just has to take a break from whatever level data it's streaming and go grab another 750 KB of audio from the disc.
AFAIK, the PSX version of Grandia uses this method during the battle sequences. I kind of descovered this when my first laser unit started to give up on me. The music would cut out and restart randomly (telltale sign of streamed music) and whenever magic or a special was activated I could realy hear the laser tracking back and forth a lot. It does this too with a good laser, just the music dosn't cut out at random.

As for the FFVII One Winged Angel track, we all know the cast Regen-open disc lid trick. When you do this whe game dosen't crash, it just sits there and waits until it can read data again. I wouldn't be surprised if the music driver has disc access priority over the main game logic and this trick is just a side effect of it.
Insert witty sig. here...
tomaitheous
Posts: 592
Joined: Thu Aug 28, 2008 1:17 am
Contact:

Re: How to setup SNES to display 320x224?

Post by tomaitheous »

magno wrote:Is there any way to make the SNES output 320x224 resolution?
Thread resurrection!

Mango, if you're still active on this fourm: Neo Geo 320x224 mode is actually fairly close to the SNES standard resolution mode. The 'Geo uses a straight/even 6mhz dot clock for the pixel size. About 11% smaller pixel size than the SNES standard res. With an aspect ratio that close, you could do 1:1 without much, if any, noticeable difference in sizing. Matter of fact, plenty of game developers have done just that and no one has seem to have noticed. Neo Geo might be 320x224, bit it goes further into overscan than the SNES (or even Genesis, relative speaking). So you'll have some clipping. But it should still be within the safe area (after all, they did release the Neo Geo as a home console to work on the same TVs. Which makes me wonder, how they got it to run on NTSC home sets since the NG runs at like 59.18 video frame rate). Neo Geo's 304x224 is the same pixel width as 320x224 - just a clipping mode.

So in other words, there's no reason to try to "emulation" this resolution.
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples »

tomaitheous wrote:The 'Geo uses a straight/even 6mhz dot clock for the pixel size.
The NTSC NES and SNES use 945/176 = 5.369 MHz. The exact scale factor between the two is 945/(6*176) = 315/352 = 89.5%. A 256-pixel-wide screen on SNES would occupy 286 Neo Geo pixels. (Square pixels would be 135/22 = 6.136 MHz.)
With an aspect ratio that close, you could do 1:1 without much, if any, noticeable difference in sizing. Matter of fact, plenty of game developers have done just that and no one has seem to have noticed.
Puzzle games using a grid of objects, like Bust-A-Move and Magical Drop 2, may have a bigger need for resize because the difference is like a whole extra 16-pixel-wide metatile on each side.
Which makes me wonder, how they got it to run on NTSC home sets since the NG runs at like 59.18 video frame rate).
Analog electronics used in classic CRT SDTVs has plenty of slop factor.
tomaitheous
Posts: 592
Joined: Thu Aug 28, 2008 1:17 am
Contact:

Post by tomaitheous »

tepples wrote:
tomaitheous wrote:The 'Geo uses a straight/even 6mhz dot clock for the pixel size.
The NTSC NES and SNES use 945/176 = 5.369 MHz. The exact scale factor between the two is 945/(6*176) = 315/352 = 89.5%. A 256-pixel-wide screen on SNES would occupy 286 Neo Geo pixels.
Yeah, I already did the calculations. (6.00/5.3693) * 256 = 286. I.e. the number of pixels in the same range of clipping area. Pretty close as far as arcade systems to home systems go.
(Square pixels would be 135/22 = 6.136 MHz.)
My calculations put it at ~6.075mhz. If you use the 13.5mhz = 0.9 PAR. Wiki lists it at that, but I've seen old timing sheets that put 0.9 PAR at 13.4234 (which puts square pixels at ~6.0405mhz). At some point, PAR was changed for Adobe After Effects (and some of their other products). So one was probably an old standard and one a newer/updated change (13.5mhz VS 13.4234mz). An NTSC set is bound to have an incorrect PAR setting from the manufacture anyway, but it's still relative to all devices being displayed on it.

BTW, I've love to know what the dot clock is for CPS-1 arcade systems are. I've heard 8mhz, but that sounds a bit too much. I've seen 7.159mhz dot clock display showing exact CPS1 graphics and the PAR looks damn close. Too close for CPS-1 to be 8mhz.

Which makes me wonder, how they got it to run on NTSC home sets since the NG runs at like 59.18 video frame rate).
Analog electronics used in classic CRT SDTVs has plenty of slop factor.
But that's kinda far off spec for the NTSC realm of timings. There's no guarantee all/most sets will be able to output that signal - analog or not. Hell, I've seen NTSC sets that won't even show PS or SNES video correctly (weird jumping of the screen) from the 80's but sets of the 70's (and 90's+) that show them just fine.
User avatar
Memblers
Site Admin
Posts: 3902
Joined: Mon Sep 20, 2004 6:04 am
Location: Indianapolis
Contact:

Post by Memblers »

tomaitheous wrote: BTW, I've love to know what the dot clock is for CPS-1 arcade systems are. I've heard 8mhz, but that sounds a bit too much. I've seen 7.159mhz dot clock display showing exact CPS1 graphics and the PAR looks damn close. Too close for CPS-1 to be 8mhz.
I just happen to have a Street Fighter II CE board right here. It's 3 boards stacked, but on the bottom main board I see 3 oscillators. 16mhz near the C.P.S.-A-01 chip, 12mhz near the 68K, and 3.579Mhz of course near the Z80/YM2151. It was cool to unstack it and see these chips, I hope that helps.
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples »

tomaitheous wrote:
(Square pixels would be 135/22 = 6.136 MHz.)
My calculations put it at ~6.075mhz. If you use the 13.5mhz = 0.9 PAR.
The source I found while doing research for the wiki article about overscan and PAR treats 135/10 MHz as 10/11 PAR (for a 704x480 pixel 4:3 clean area) and 135/11 MHz as square. Then the NES and SNES are 8/7 PAR.
BTW, I've love to know what the dot clock is for CPS-1 arcade systems are. I've heard 8mhz, but that sounds a bit too much. I've seen 7.159mhz dot clock display showing exact CPS1 graphics and the PAR looks damn close.
Apple II also uses twice the NTSC subcarrier.
Hell, I've seen NTSC sets that won't even show PS or SNES video correctly
I've noticed that one digital video recorder I own won't record 240p. (The other one works.) Does this mean that if I ever get into SNESdev, I need to give games an option to run in interlace mode? It's jumpy, but at least it's closer to spec.
tomaitheous
Posts: 592
Joined: Thu Aug 28, 2008 1:17 am
Contact:

Post by tomaitheous »

tepples wrote:
tomaitheous wrote:
(Square pixels would be 135/22 = 6.136 MHz.)
My calculations put it at ~6.075mhz. If you use the 13.5mhz = 0.9 PAR.
The source I found while doing research for the wiki article about overscan and PAR treats 135/10 MHz as 10/11 PAR (for a 704x480 pixel 4:3 clean area) and 135/11 MHz as square.

Oh, nice link (the first one)
Then the NES and SNES are 8/7 PAR.
That would be a little too much. And here's why.

There are a number of scanline timing layouts, but most of them have the exact ratios (or close). Ideally, you would have to sample the scanline on an oscilloscope to get the exact PAR (from the ratio of scanline length and active period length), but you can use a pre-existing popular model for an easy example.

63.56us length for scanline. 53.33us for the active part. Now, the active part has to be an frame aspect ratio of 4:3.

4/3 = 1.3333333333333333333333333333333

That means for 480 scanlines at the correct frame aspect ratio, the square pixels would have to be 640. 480 x 4/3 = 640. Ideally, those would be square pixels.

63.56 / 53.33 = 1.1918244890305644102756422276392

1.1918244890305644102756422276392 *640 = 762.76767297956122257641102568911

762.76767297956122257641102568911 * 15734 = 12001386.6mhz dot clock.

Now, the BT.601 spec says there are 720 samples in 53.33us. Or 13.5mhz

640/720 = 0.888888888888888888888888888889 PAR

Less than 0.909090 PAR or even the straight 0.9 PAR I've seen stated.

We can test is with:
13500000 / 15734 = 858.01449091140205923477818736494
858.01449091140205923477818736494 / 1.1918244890305644102756422276392 = 719.91681561209993421948899830367

I'd say that's pretty darn close given I did it all in decimal instead of leaving it in fraction form.

We can now use 13.5mhz as a base for a ratio for comparing other dot clocks against.

13.5 / 5.3693 = 2.5142942282979159294507663941296

But, we don't have 480 pixel rows, we have 240 pixel rows. So you divide that by 2..

2.5142942282979159294507663941296 / 2 =
1.2571471141489579647253831970648 <- that's our ratio.

Now apply the PAR of 13.5 to get the PAR of the ratio..

1.2571471141489579647253831970648 * 0.8888888888888888888889 =

1.1174641014657404130892434768026 PAR for NES/SNES.

8/7 would give you 1.1428571428571428571428571428571 PAR. A little too much.

If 13.5mhz was exactly 0.9 PAR, that would put the NES/SNES PAR at 1.13. But the problem with that is, if 13.5mhz is 0.9 PAR - then frame aspect ration isn't exactly 4:3. You can't have both. So, if the PAR is going to be 0.9 for 720 samples for the active part of the scanline, the dot clock is going to be less than 13.5mhz. And I think this where why I saw reference to 13.4234mhz (which puts NES par at 1.125). It was an old scan - probably pre 90's. 4:3 frame ratio is fixed, everything else changes around it. 13.4234mhz also corresponds to almost exactly half the Genesis dot clock for mid res mode (6.71165mhz). Might just be coincidence, but it just doesn't feel like it ;) (or (5.36932 * 10) / 8 = 6.71165)



But like I said, you'd have to get the exact scanline and active period values. I've seen 63.5/52.6, 63.55/52.9, etc. And then set your set properly for 4:3 (but regardless, everything will fall into place). But nothing I've seen gives as much as 8/7 PAR. We're talking in terms of absolutes, but all things are relative on that set for PAR (even if incorrect frame aspect ratio) - if you're measuring against other res' of other systems on the same TV set.

Apple II also uses twice the NTSC subcarrier.
Wasn't that so they could exploit a side effect of that? I.e. to get more colors or such? Like CGA and CoCo computers did? PCE doesn't have the same artifacts (it keeps shifting the color burst signal 180 degrees every other line, not to mention it does half pixel shifting every other line and then the next set on the next frame - if you turn on that filter).
I've noticed that one digital video recorder I own won't record 240p. (The other one works.) Does this mean that if I ever get into SNESdev, I need to give games an option to run in interlace mode? It's jumpy, but at least it's closer to spec.
Dunno. I've heard of people running the composite signal through certain VCRs and outputting to the DVR to get the 240p signal capture-able. My analog capture card doesn't care. And it will capture the frame as 480i if you set it to that high of a res. That's how I capture at 240p 60fps from my consoles. I just separate the fields back into frames afterwards in post.

I just happen to have a Street Fighter II CE board right here. It's 3 boards stacked, but on the bottom main board I see 3 oscillators. 16mhz near the C.P.S.-A-01 chip, 12mhz near the 68K, and 3.579Mhz of course near the Z80/YM2151. It was cool to unstack it and see these chips, I hope that helps.
PCE mid res has a PAR of ~0.8381. But the problem is, I don't think CPS-1 arcade system use NTSC. But the PAR of 8mhz is like 0.75. That's huge. It's possible, but that means pictures should be really stretched out on the PCE when they used direct tiles/sprite from CPS-1 games (pixel for pixel minus some master palette depth reduction 12bit -> 9bit).

A full 4:3 correct NTSC frame for PCE 7.159090mhz dot clock is ~382 pixels (that's max overscan, but still 4:3). That comes pretty close to the CPS1 assuming the res shown by the game system is full res (edge to edge max overscan). So maybe the 3.579Mhz for the audio chips, is up clocked (maybe internally by the video chipset). Or maybe it is just 8mhz and I'm missing something.
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples »

tomaitheous wrote:63.56us length for scanline. 53.33us for the active part.
At 13.5 MHz, 53.333 microseconds are 720 pixels. A 720-pixel picture actually includes 16 columns of pixels called "nominal analog blanking" that are not part of the 4:3 frame. They're used in a digital capture so that post-processing can recenter the picture if the analog signal's horizontal sync timing was a bit off. This is one of the reasons for the difference between a "production aperture" and a "clean aperture" in the lurkertech page. This means only 52.148 microseconds (186.67 subcarrier cycles or 280 NTSC SNES pixels) of the signal are within the 4:3 frame.
Apple II also uses twice the NTSC subcarrier.
Wasn't that so they could exploit a side effect of that? I.e. to get more colors or such? Like CGA and CoCo computers did?
Yes, but it's also for convenience so that they can divide the dot clock by 7 to get the CPU clock, much as the NTSC SNES divides the master clock by 4 to get the dot clock and by 6 or 8 to get the CPU clock.
tomaitheous
Posts: 592
Joined: Thu Aug 28, 2008 1:17 am
Contact:

Post by tomaitheous »

tepples wrote:
tomaitheous wrote:63.56us length for scanline. 53.33us for the active part.
At 13.5 MHz, 53.333 microseconds are 720 pixels. A 720-pixel picture actually includes 16 columns of pixels called "nominal analog blanking" that are not part of the 4:3 frame. They're used in a digital capture so that post-processing can recenter the picture if the analog signal's horizontal sync timing was a bit off. This is one of the reasons for the difference between a "production aperture" and a "clean aperture" in the lurkertech page. This means only 52.148 microseconds (186.67 subcarrier cycles or 280 NTSC SNES pixels) of the signal are within the 4:3 frame.
That's the relatively recently "new" definition defining what part of the 15734 is part of the 4:3 frame. The PCE, NES, SMS, Genesis, SNES - come before this SMPTE RP 187-1995 standard (even before the that bt.601-4).

Quoted from his own site:
All analog equipment cares about is that the video doesn't get squished or stretched in one direction, and stays centered. And the way video engineers deal with this is to put up a standard video test pattern from a trusted test pattern generator and tweak the knobs on their monitor, by hand, until the monitor image is properly positioned and scaled on the screen. Obviously, this is not a very precise process. Modern monitors are consistent enough that this adjustment is rarely, if ever, needed, because the criterion for the image proportions being "good enough" are very loose—they are the limits of human perception of a video monitor.
4:3 frame aspect ratio existed way before PAR ever did (for the very reason pixels didn't exist. It was an analog waveform). And he's right, there are a lot of early digital formats/equipment (even software) interpreting what part of the "active scanline" is part of the 4:3 frame in the mid 90's. Or rather, just carelessly rounding to it.

What doesn't sit well with me, is forcing something that is before all of this, to this now "de facto" definition. A definition to define modern standards. His point (well to a lesser extent. His main point seems to be how to conform to the current standard) in describing a lot of this, is how to treat the PAR of such legacy stuff (well partly. Enough to tell you that you need to interpret it differently. But not exactly how per se) - since it had a different relative point of frame start and end point. Many devices used the 52.9+us part of the scanline as part of the frame aspect ratio. During the mid/late 90's and earlier. You don't know what NES,SMS, PCE, and even SNES were referencing, but since it's pre-"this crap" stuff, I'm incline to think it would belong to the standard set before all the mess mentioned in that article.

And he insinuates that there was chaos before the "digital" revolution and during, before the new definition to sort it out it all out. But you know, there were test pattern generators to calibrate TV sets before all this nonsense of the mid 90's. They weren't "make up your own test pattern" stuff. There was a standard and TV calibration technicians existed for customers who had the money, to get their sets properly calibrated. Not just for studios. And all this before all the digital and HD sets.

His site is more about how digital storage didn't store the whole scanline as analog (or even digital), but just the data. And the problem arouse from which method was correct for recreating the sync, timings, and offsets of the active line. If the dot clock is the correct, the active display part of the scanline is nothing more than clipping/centering. He kinda suggests that some digital playback equipment got it wrong, but gives no technical in depth examples of this. And for this very reason, digital video editors allows NTSC PAR correction based on 704 or 720. That's two distinct dot clocks, not clipping. Which is misleading given the information he's covering about "clean aperture". That's not the same thing. There's 720 pixel with 704 viewable via being clipped and there's 704 pixel actual dot clock (because of how the designer interpreted the PAR, frame aspect ratio, and implemented it). All the equipment we used always used full 720 pixel dot clock and no clipping. When you used the footage in the non linear editor, you set the PAR to 0.9 for it.

The only real way to test the old systems PAR, is to set a NTSC set with an old school pattern test (for that time). Horizontal width scales the whole line in linear form, not just the active part. So everything should be interpreted correctly once set. Then output your own pixel display screen and compare it. And even then, that assumes the hardware developer/designer got it right. But I guess the difference isn't big enough to really matter though (like a ~3 pixel different between on the NES/SNES). I personally use ((13.4234mhz / dot clock) / 2) * 0.909 (or just 0.9) for these old consoles.

The only reason why this is a pet peeve of mine, is that I did quite a bit of technical and post production work in early to later 2000's with digital video mixed with computer generated composites and graphics. As well as delving into details and solutions for software generated video :P And then to seeing emulators completely ignoring the PAR of these old systems. Well that, and doing dev stuff on these old systems.

On a side note, I've seen sites rounding numbers for scanline timings. Some listing 63.5us but 15734hz. 1/15734 is ~63.5566us. I guess that's why some list +/- 0.2us for some parts. How many master clocks is the NES and SNES outputting on a scanline? 1365?
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples »

tomaitheous wrote: On a side note, I've seen sites rounding numbers for scanline timings. Some listing 63.5us but 15734hz. 1/15734 is ~63.5566us.
As I understand it, the NTSC video system was slowed down 0.1% by so that the line rate would be exactly 1/286 times the 4.5 MHz audio carrier. So the line rate is the old system's line rate (15750 Hz) divided by 1.001 = 15734.265 Hz. This also happens to be exactly 227.5 color subcarrier cycles.
How many master clocks is the NES and SNES outputting on a scanline? 1365?
1364. That's 341 dots, with four master clocks per dot, or only 227.33 color subcarrier cycles.
psycopathicteen
Posts: 3001
Joined: Wed May 19, 2010 6:12 pm

Post by psycopathicteen »

Tokumaru and Magna made some very good points. I too am in favor with the idea for homebrewers to push hardware past what yet has been done.
psycopathicteen
Posts: 3001
Joined: Wed May 19, 2010 6:12 pm

Post by psycopathicteen »

About the scaling, I've played around with scaling before and the 65816 is fast enough to scale several 16x16 sprites. Up to about 7 if the cpu isn't doing anything else. Just as long as you program a seperate scaling routine for each step.
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: How to setup SNES to display 320x224?

Post by tepples »

I've been working on my essay about top-down and "isometric" games, trying to find which angles best correspond to certain pixel aspect ratios. When searching for info about the CPS1/CPS2 dot clock, I came upon this post:
tomaitheous wrote:Quoted from his own site:
All analog equipment cares about is that the video doesn't get squished or stretched in one direction, and stays centered. And the way video engineers deal with this is to put up a standard video test pattern from a trusted test pattern generator
4:3 frame aspect ratio existed way before PAR ever did (for the very reason pixels didn't exist. It was an analog waveform).
I was under the impression that such a test pattern generator would operate based on some crystal, whose period can be taken as a "pixel". In analog terms, what Rec. 601 did was mathematically define a test pattern generator in terms of a 13.5 MHz crystal.
And for this very reason, digital video editors allows NTSC PAR correction based on 704 or 720. That's two distinct dot clocks, not clipping.
For 704/720, the only dot clock I've ever read about was 13.5 MHz from Rec. 601.

In any caes, has anyone come up with a reliable figure for the CPS dot clock?
Post Reply