mode 5 data format
Moderator: Moderators
Forum rules
- For making cartridges of your Super NES games, see Reproduction.
mode 5 data format
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 :
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 :
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
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 :
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 :
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
Re: mode 5 data format
What's the raw bytes of those tiles you've uploaded? What palette have you uploaded?
Re: mode 5 data format
I uploaded the 3 files here :
https://github.com/hoit/pvsneslib/files ... /files.zip
https://github.com/hoit/pvsneslib/files ... /files.zip
Re: mode 5 data format
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".
Re: mode 5 data format
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
Re: mode 5 data format
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.
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.
Re: mode 5 data format
@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 !
@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 !
Re: mode 5 data format
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:
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
- 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
- Disable BG1 for rendering
- Upload tiles for 2bpp instead of 4bpp
My personal SNES dev log: https://twitter.com/bennysnesdev
Re: mode 5 data format
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) :
hope i will find a way to get the right size
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) :
hope i will find a way to get the right size
Re: mode 5 data format
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.
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.
Re: mode 5 data format
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.
Re: mode 5 data format
But you can change the bank reference via hdma mid screen right?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.
Re: mode 5 data format
Well, yes...
The logistics of that might be more difficult than just having another layer with the other 700-ish tiles.
The logistics of that might be more difficult than just having another layer with the other 700-ish tiles.