[Hacking] SNES 512x448 display via background mode 5 and 6 questions.

Started by batshiftman, February 23, 2020, 10:46:50 PM

Previous topic - Next topic


Hello, am looking for an expert to comment on this. *ahem* Byuu's input would be "super" helpful...

Just started looking into the SNES display modes 5 and 6. I've known about them for a long time but never really had the need to use them.. Until recently. As far as I was aware, mode 3, 4, and 7 could pretty much get anything I wanted done for any kind of graphics. And I was always under the assumption that due to 64kb of VRAM, the largest picture that could ever be displayed was 256x224 pixels. After doing some minimal reading about modes 5 and 6, they seem to offer a Pseudo 512x448 output display. That is to say, that while them seem to offer genuine 512x448 display to a TV, it's really just a 256x224 imagine being scaled up. But lacking testing equipment and knowledge, I'm not really able to make genuine claims for the SNES as to how BG modes 5 and 6 work, or if it even outputs genuine 512x448 images to the TV.

I've recently come up with a need to be able to take advantage of 512x448 pixels, or at least the 512 pixel width. The thing about it is that I don't require lots of colors, although am not against using the entire palette of 256, but really just want something between 8 to 24 colors, with 16 colors being an ideal compromise. The problem I'm having is the lack of screen definition, or rather the pixel width of the output resolution. For my idea to work I need to have image resolution clarity, and do not want to sacrifice it by shrinking something down to 256x224 as I will lose to much image detail. Again I don't need many colors past 16, so a color addition mask window or maybe using mode 7 might work, but the idea is that I can control the output of the SNES to TV part to display the image in a full 512 resolution, meaning I can display 512 uniquely colored pixels in a straight line, preferably by 448 lines but I'll take what I can get. Even using something like 2048 color CG DATA would work fine, I just need to have a way to output 512 lines to the TV, and somehow access those 512 lines as individual pixels. For instance, I could display one composite 256x224 image in one frame, and another composite 256x224 image in another frame, to create one 512x224 display image of blended colors at 30 FPS, as I don't really need above 15 FPS. Ideally, if I can only display using a 256x224 image, then somehow I trick the RGB encoder or A/V output to display my 256x224 image 4 times in 4 separate locations to form a 512x448 image to the TV, while broadcasting in a genuine 512x448 resolution. Or if I can somehow use a color addition mask or window, that targets every pixel once across 256 pixels, to create a final product that broadcasts at 512H, with 256 of those pixels being a unique color from the mask/window yet also a separate color from the pixel it masked, to produce a genuine 512 out image... Would be awesome. But I have no experience in the area, am having problems creating images for the SNES to test it with... can any experts comment on what they have discovered or learned with BG mode 5 and 6? Maybe even pseudo 512 mode in background 3/4 will work, if I can blend colors to actually create a 512 resolution that isn't just a color repeat of the same pixel twice?


I'm not an expert but since nobody else answers... I suggest reading as much doccumentation on the SNES PPU as possible. I personally like nocash doccumentation, even though some other people will point their weakness, they tend to be as accurate as possible, up to date, and use standardized technical terms across platforms. It has a section called Hires softtware pointing to game using resolutions higher than the regular 256x224 or 256x240.

Using mode 5 and 6 will automatically increase H resolution to 512 (double as normal). The increase of V resolution (double as normal) is done by enabling interlacing, it can be done in any mode, but the hardware will only assist it if done in mode 5/6 if my understanding is right, in other modes you need to alternate screens by software to get 256x448 px resolution.

So perhaps if you want more help you need to point to your exact problem. Did you try to enable 512x448 mode but it fails somehow ?


Ahhhhhh, good response and great documentation link you gave... thank ye, thank ye. That did help explain a little more of the mystery of 512x448 to me.

To be honest, I never got that far. I've really only been involved with bg mode 3/4, and with 1/2 once maybe, so when I looked at my picture conversion programs I kind of gave up. It was already a hassle to create a bg mode 3/4 image (and has been for quite a while) - most common images store their data in 24/32bit argb format. So when I want to test display something, I have to open an image, convert to index'd palette, resave in .pcx format while hand writing out save details - then I goto my image convert program and request it spit out the tilemap, image, and palette files if all goes well. When it came to bg mode 5/6 and display at 512x448, I was kind of confused. My main program I use - I think its PCX2SNES(?), didn't quite display to me how to properly image for bg mode 5/6 and didn't like that i had an image over 256x224, although it has better mode 7 support iirc. I openend up 3 other newer programs and they all fell short as well - I'm sure a lot of the issue here is me as I don't know wtf I'm doing half of the time when it comes to SNES format graphics. I've been working on a routine script that can just take a regular .bmp or .png graphic and generate a more immediate output for the SNES PPU but that's been in a pretty slow progress for some years, so someday it will make life a lot easier me thinks... But when it came to the image I had in mind, I wasn't sure how to go about compressing a 512x448 down into a 256x224 without actually compressing the image and losing a lot of resolution details in the process. So I guess I wasn't sure how to tackle that issue and pretty much gave up there =p.

I haven't checked out most of the hires software listed in the link you sent me, but was surprised to find out so many Squaresoft titles were using 512x224. When I thought of 512x448 on the SNES I decided to check out Dragon Knight 4 as I knew it wasn't programmed with the then typical SNES resolutions in mind, but after doing some testing with BSNES, it appears to just be a 256x224 image outputting on mode 5/6 at 512x448 - that is to say that BSNES gave me a 512x448 screen shot capture, but the colors in the image were very broad and looked like it could be reduced by 1/4th pretty easily to convert back into the 256x224 format without any actual data loss.

Byuu, er, Near I guess, mentioned before there was lots of tricks to get the SNES to display more colors then the typical 256 in the palette, and things like changing colors in the palette during HBlank was just one of the things you could do to increase your maximum colors displayed. I also played around with palette mixing on single images some time ago and got some pretty curious effects although they were never tested on real hardware. But I figure there's got to be some way to control or modify the dithering that can happen on the ppu output to generate more resolution detail to the tv even if the image is blurry, so basically I could maybe fit the details of a 512 image and display it to tv.

But yeah, if I'm having a problem right now with this, it's that I don't even know know where to start with a 16 color 512x448 image =D. I've got some template frame work from netviski I can use and modify to setup a mode 5/6 image to display, but not sure how to get the 512x448 image I have down to 256x224 as I keep losing graphical detail each time I shrink it, doh! I just kind of got frusterated with all the steps it took to even convert a regular 256x224 image to mode 3/4, so I sort of gave up there for the time being. I don't know, anyone feel like trying to play around with this? Or I'll just take 4 samples of a 512x448 image and try to create some kind of interlace formula for output display and see if I can regain the original resolution quality... Been kinda ignoring this and dealing with painful recontruction of C++ projects instead. If I make any progress I'll make sure to update.


It's very likely PCX2SNES has been made with the standard resolution in mind only. You should check the doccumentation of this program to make sure. Perhaps you can work around it by spliting your 512x448 image in 4 quarters and convert each quarter separatedly :)

Or else write your own tool to do the conversion you'd like to do. Or redraw the image yourself with tiles editors.

To display a full-screen image in 4BP hi-res you need 4x512x448 bits that's 112 kB of VRAM... but the SNES only has 64kB. This means it's only possible if you re-use parts of the image, or if you make it 2BP and display with BG2 of mode 5. If there's lot of solid parts in your image it's likely it'll shrink down to below 64kb after conversion.

2BP means 4 colours (including transparent) per tile, but you can get more by using different palettes for different areas of the image. Like you said if that still isn't enough you can rewrite the palettes during HBlank, but I'm unsure how many colours per scanline can be overwritten that way. At first I'd say keep it as simple as possible so only do that as a last-resort technique.


You should look at Peter Lemon's SNES sources, I'm sure you may find some things which could be useful.