nesdev.com
http://forums.nesdev.com/

Chr files
http://forums.nesdev.com/viewtopic.php?f=21&t=14859
Page 1 of 1

Author:  WizardBones [ Wed Sep 21, 2016 3:30 am ]
Post subject:  Chr files

I was playing around with the sprite sizes and wanted to go from, 8x8 to 16 x 8. Now I am wondering how the Chr files work. After changing to 16x8, the top tile appears correct, but the bottom tile is just something random? So i'm wondering, should one rearrange the tiles in the CHR file a certain way? not exactly sure how the second tile of a 16x8 is determined.

Edit: it seems the bottom tile in a 8x16 sprite is the tile to the right of the top tile in the Chr file?

Author:  Kasumi [ Wed Sep 21, 2016 4:14 am ]
Post subject:  Re: Chr files

There are two sets of 256 tiles. One is usually used for the background, one is usually used for sprites.

Because there are 256 tiles in each set, and the range of a byte is 256, in 8x8 mode the byte written to the tile number is the tile used for the sprite in the set selected for sprites.

In 8x16 mode, things are a little different. All even tiles are the top tile, all odd tiles are the bottom tile. You cannot have an odd tile as the top tile. Since every two tiles are now paired, this would mean you only get 128 different choices in the 256 tile "sprite set". And so, you can use tiles from the background set for sprites as well.

Suppose the sprite set is set zero, the background set is set one.

A tile number of 0 specifies you want tile 0 and 1 of the sprite set. A tile number of 1 specifies you want tile 0 and 1 of the background set.

Basically whether the tile number is even or odd now selects whether you use the background of the sprite set. If the tile number given is odd, one is subtracted. If the tile number given is even, it's used.

The result of this potential subtraction is the tile number that will be used for the top tile in the given set. The one to the right of it in the same set is the bottom tile.

Author:  M_Tee [ Wed Sep 21, 2016 9:51 pm ]
Post subject:  Re: Chr files

I explained it with some image references here: http://www.mteegfx.com/post/12167953203 ... s-overview

It helps to use yychr for managing your chr files because it can reorganize the way it displays the chr file for 8x16.

Page 1 of 1 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/