mode 5 data format

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.
Post Reply
hoit
Posts: 28
Joined: Sun Dec 24, 2017 10:16 am

mode 5 data format

Post by hoit » Wed Feb 24, 2021 11:27 am

Hello,

I would like to test mode 5 to have a taller resolution but i do not find how i need to store data to display it correctly.

If we imagine that the register are correctly set and i want to use only the 1st background (16 colors), i generated a picture with 2 tiles of 8x8 which appears like that in VRAM :

Image

I generated a tile map with 1024 group of 2 bytes (map of 32x32) which contains 0000 everywhere to use the 1st tile in the vram (and the palette used is the number 0 to ease my tests)

So i have 128 lines like that
0000 0000 0000 0000 0000 0000 0000 0000

but the result appear like that :
Image

The number which appear is the number 2. The resolution seems to be good but i do not understand how to display it correctly. If i am not wrong, it should display "12" everywhere.

Does someone can explain me which format the file should have to display the result ?

Thanks in advance

lidnariq
Posts: 10459
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: mode 5 data format

Post by lidnariq » Wed Feb 24, 2021 11:41 am

What's the raw bytes of those tiles you've uploaded? What palette have you uploaded?

hoit
Posts: 28
Joined: Sun Dec 24, 2017 10:16 am

Re: mode 5 data format

Post by hoit » Wed Feb 24, 2021 1:18 pm


lidnariq
Posts: 10459
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: mode 5 data format

Post by lidnariq » Wed Feb 24, 2021 1:48 pm

Your 16-color palette should take 32 bytes, not 8. Other than that, are you uploading the tile data to the right memory location? I'm not certain how else you'd see that missing horizontal line at the bottom of the "2".

User avatar
Benny
Posts: 8
Joined: Thu Oct 05, 2017 2:15 pm
Location: Cologne, Germany
Contact:

Re: mode 5 data format

Post by Benny » Thu Feb 25, 2021 6:05 am

If it's not a too huge secret, it would really help if you could share a ROM file or something like that so we can target the problem. :)
My personal SNES dev log: https://twitter.com/bennysnesdev

noyen1973
Posts: 31
Joined: Sat Oct 06, 2018 10:15 am

Re: mode 5 data format

Post by noyen1973 » Thu Feb 25, 2021 9:14 am

There's an example of mode 5 at https://github.com/binarycounter/SNESterm with full source code.
Tiles are not placed consecutively instead they're alternated between two background maps every second tile. That's why you're only seeing the 2 and not 1.

What version of No$SNS are you using? The last time I tried using it with mode 5 vertical interlaced mode the lower half of the screen would not display properly with it as that particular mode had not been fully implemented.

hoit
Posts: 28
Joined: Sun Dec 24, 2017 10:16 am

Re: mode 5 data format

Post by hoit » Fri Feb 26, 2021 4:27 am

@lidnariq : i agree with you, the palette file is "truncated" and i will take care of it but i think it is not the root cause here. I uploaded data to 0x0 for the tileset and 0x400 for the mapset

@Benny : i did not shared the code before because i am using PVSneslib and this part is in c code (then translated to asm with tcc and so on). But my question is more general to understand what i did wrong because i do not have issues with few other background mode.

Here is the sample project :
https://github.com/hoit/pvsneslib/files ... /mode5.zip

@noyen1973 : thank you for the link but my knowledges to read asm are really poor for now.
I am using NO$SNS v1.5 and i checked with the last one (1.6) and it seems to be the same. But you are right, I just tried it with Mesen and the result is better.

I have to do more tests to see if everything works correctly and i will keep informed soon.

Thank you all !

User avatar
Benny
Posts: 8
Joined: Thu Oct 05, 2017 2:15 pm
Location: Cologne, Germany
Contact:

Re: mode 5 data format

Post by Benny » Fri Feb 26, 2021 5:56 am

Hi :)

I just took a brief look at the provided ROM.

It generally seems that you correctly understood how to format the VRAM about your tiles.

However, there might be some problems on other sides:
  • You want to render the tiles on a 4bpp background, but only provide 4 colors. The uploaded tiles seems to use color index 15 (if I looked correctly) which is black. So you basically render a black layer (BG1) on top of the 2bpp background (BG1) which provides the current color
  • The "number" itself is transparent (color index 0) and the surrounding of the number is colored
What could fix your current rendering
  • Disable BG2 for rendering
  • Upload a palette which has color 0 and 15 set OR set color 0 of the palette to any color other than black
OR
  • Disable BG1 for rendering
  • Upload tiles for 2bpp instead of 4bpp
(I only took a brief look, sorry if I'm wrong about something)
My personal SNES dev log: https://twitter.com/bennysnesdev

hoit
Posts: 28
Joined: Sun Dec 24, 2017 10:16 am

Re: mode 5 data format

Post by hoit » Tue Mar 09, 2021 1:38 pm

Hi,

Thank you Benny for these details.

i will use palette with the right number of colors to avoid this case.

But i am a little bit surprised because the result i wanted (isometric style) is not correct and proportions are really differents (but is better in the tilemap viewer) :
(you can ignore the issue with color palette, it is probaly related to a wrong format) :

Image

hope i will find a way to get the right size ;)

hoit
Posts: 28
Joined: Sun Dec 24, 2017 10:16 am

Re: mode 5 data format

Post by hoit » Wed Mar 10, 2021 10:38 am

If someone is interested, the look squished is a constraint from mode5 : https://www.google.fr/url?sa=t&rct=j&q= ... Vfb1QlOkhG

to avoid it and if i understood correctly, i have to use the interlaced mode and the proportions will be correct because the screen will be squished vertically and horizontally. But the tile size will be "divided" by 2 and i will get the same render than with mode 0 but with more tiles on screen.

My goal was to use mode5 to get bigger tiles with more isometric tiles displayed without scrolling, i think it will not be possible due to hardware limitations.

lidnariq
Posts: 10459
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: mode 5 data format

Post by lidnariq » Wed Mar 10, 2021 10:51 am

Yeah, none of the SNES video modes can display more than 1024 tiles from a single background layer. Even when using 16x16 tiles in mode 0-6, or modes 5 or 6 (with 16x8 tiles), you still have that limitation. If you want more, you have to compose them across multiple background layers.

turboxray
Posts: 155
Joined: Thu Oct 31, 2019 12:56 am

Re: mode 5 data format

Post by turboxray » Wed Mar 10, 2021 11:03 am

lidnariq wrote:
Wed Mar 10, 2021 10:51 am
Yeah, none of the SNES video modes can display more than 1024 tiles from a single background layer. Even when using 16x16 tiles in mode 0-6, or modes 5 or 6 (with 16x8 tiles), you still have that limitation. If you want more, you have to compose them across multiple background layers.
But you can change the bank reference via hdma mid screen right?

lidnariq
Posts: 10459
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: mode 5 data format

Post by lidnariq » Wed Mar 10, 2021 11:08 am

Well, yes...

The logistics of that might be more difficult than just having another layer with the other 700-ish tiles.

Post Reply