+  RHDN Forum Archive
|-+  Romhacking
| |-+  ROM Hacking Discussion
| | |-+  Tilemap entry and corresponding tilesize question (snes)
Pages: [1]
Author Topic: Tilemap entry and corresponding tilesize question (snes)  (Read 2 times)
aspire
Guest
« on: November 07, 2008, 03:38:56 pm »

What determines the size of the tile represented by an entry in the tile map array?

I have a game that writes two bytes into the tilemap which loads a 16x16 character on the screen. The text sits in BG2.  I read through the SNES register docs and read about register $2105.  Indeed, the size bit for BG2 was set to 16x16. So I proceeded to flip the bit except that now the two byte value loads a 16x8 tile (top half of original tile).  I loaded a save state up in VSNES and it confirmed 16x8 as the tile size. How do I switch this so a tilemap entry loads only an 8x8 or 8x16 tile ? Im not sure where to look now...   
creaothceann
Guest
« Reply #1 on: November 08, 2008, 03:36:01 am »

Does the game use the hi-res mode? (512 pixels per line, either by bit 3 in $2133 or by using BG mode 5/6)

The bit in $2105 alone can't set the tile size to 16x8.
aspire
Guest
« Reply #2 on: November 08, 2008, 10:12:16 am »

Yes, the game uses High Res and the screen mode is 5.
creaothceann
Guest
« Reply #3 on: November 08, 2008, 11:12:51 am »

You'll probably have to change the BG mode then to something similar.

EDIT: The closest is probably BG mode 1, unless you want to change the bitdepth of the tiles.

        Mode 1:                                 Mode 5:

        BG1 = 16 colors                         BG1 = 16 colors
        BG2 = 16 colors                         BG2 =  4 colors
        BG3 =  4 colors

        Sprites   with priority 3               Sprites   with priority 3
        BG1 tiles with priority 1               BG1 tiles with priority 1
        BG2 tiles with priority 1

        Sprites   with priority 2               Sprites   with priority 2
        BG1 tiles with priority 0               BG2 tiles with priority 1
        BG2 tiles with priority 0

        Sprites   with priority 1               Sprites   with priority 1
        BG3 tiles with priority 1               BG1 tiles with priority 0

        Sprites   with priority 0               Sprites   with priority 0
        BG3 tiles with priority 0               BG2 tiles with priority 0


So you'd have to do the following:

  • use BG mode 1 with the "BG3 priority 1 tiles on top" bit disabled
  • change all references of BG2 to BG3
  • disable BG2 (registers $212C and $212D)

One possible problem is that some BG tiles might now be before/behind some sprites when they weren't before.
« Last Edit: November 08, 2008, 12:21:13 pm by creaothceann »
aspire
Guest
« Reply #4 on: November 08, 2008, 05:15:20 pm »

ok, I will play with this tonight. Thanks for your help. Can you elaborate a bit more on what ultimately determines the tile size? Why do I need to switch background modes for the tilemap entry to load an 8x8 tile? What is causing the 16x8 behavior in the current mode? Reading the register docs has given me bits and pieces only, I am hoping you can fill in the holes Smiley
creaothceann
Guest
« Reply #5 on: November 08, 2008, 07:09:19 pm »

If you are interested to learn how the picture on the TV is created then I can explain that, but the 2133.3 bit and the BG mode setting is really all that determines the horizontal size, IIRC. The vertical size depends only on the interlace bit (2133.1 for BGs), I think.
Pages: [1]  


Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC