Hi,
I don't understand how to make a tilmap
For example I have 2 tiles named T0 and T1, of 16x16 pixels , stored at $8000 in vram (snes in mode 1)
What is the code for renseign the tilemap, by example if I would like to have the background0 with:
-the tile T0, positioned in X16 Y32, palette 4
-the tile T1, positioned in X48 Y64, palette 7, vertical flip
THANKS
how to make a tilemap's background
Moderator: Moderators
Forum rules
- For making cartridges of your Super NES games, see Reproduction.
how to make a tilemap's background
Last edited by fritzzz on Wed Jun 07, 2023 6:08 am, edited 2 times in total.
Re: how to make a tileset's background
Are you trying to put tiles on a tile map (display on a background layer)?
And you want to calculate the position of a specific X/Y coordinate?
Y64... makes me think you mean 64 pixels from the top.
If tiles are set to 16x16 mode, then divide each number by 16. Your first example gives X=1, Y=2.
The map has rows 32 tiles wide, so the next row down is +32. So multiply the Y by 32, then add the X
32x2 + 1 = 33 (in hex that's $21)
So, add $21 to the map base address to get the address of that tile. Then write the tile there.
The data is 16 bits. The bits are
15 V flip
14 H flip
13 Priority
10-12 Palette
0-9 Tile Number
Your first example, Tile=0, Palette=4
000 100 00000000 or $1000
So, if the map for BG1 starts at VRAM $2000, you would set a VRAM address for $2021, then write the value $1000 here to make the tile appear.
And you want to calculate the position of a specific X/Y coordinate?
Y64... makes me think you mean 64 pixels from the top.
If tiles are set to 16x16 mode, then divide each number by 16. Your first example gives X=1, Y=2.
The map has rows 32 tiles wide, so the next row down is +32. So multiply the Y by 32, then add the X
32x2 + 1 = 33 (in hex that's $21)
So, add $21 to the map base address to get the address of that tile. Then write the tile there.
The data is 16 bits. The bits are
15 V flip
14 H flip
13 Priority
10-12 Palette
0-9 Tile Number
Your first example, Tile=0, Palette=4
000 100 00000000 or $1000
So, if the map for BG1 starts at VRAM $2000, you would set a VRAM address for $2021, then write the value $1000 here to make the tile appear.
nesdoug.com -- blog/tutorial on programming for the NES
Re: how to make a tileset's background
Yes it's that, I want make a tilemap (not a tileset , I go change the title)
Thank you, now I understand better
Thank you, now I understand better
Last edited by fritzzz on Wed Jun 07, 2023 6:07 am, edited 1 time in total.
Re: how to make a tileset's background
A question for mode 3,
In mode 3, we can have 16 palettes of 16 colors for Background 0 ? If it's right, how to choose from 0 to 15, because here there is just 3bit to choose the palette
In mode 3, we can have 16 palettes of 16 colors for Background 0 ? If it's right, how to choose from 0 to 15, because here there is just 3bit to choose the palette
Re: how to make a tilemap's background
No, 8 palettes. Fullsnes.htm has all the details.
Re: how to make a tilemap's background
In Mode 3, BG1 has unfettered access to all of CGRAM. The pixel data is 8-bit, and the palette selector bits are not used unless you're in direct-colour mode, which doesn't use CGRAM at all.
BG2 (again, speaking of Mode 3) has access to the 8 4-bit palettes in the bottom half of CGRAM, and you select which one with those three bits. The top half of CGRAM is for sprites (and 8bpp layers).
BG2 (again, speaking of Mode 3) has access to the 8 4-bit palettes in the bottom half of CGRAM, and you select which one with those three bits. The top half of CGRAM is for sprites (and 8bpp layers).
Re: how to make a tilemap's background
Thanks
So I'm going to stay in mode 1, I'll see that another time the color system of mode 3
So I'm going to stay in mode 1, I'll see that another time the color system of mode 3