Chr

In computing, chr is a type of file format commonly used for graphics (i.e. 3D Max Characters and Homebrew NES Dev Graphics) and character sets.

Chr

In computing, chr is a type of file format commonly used for graphics (i.e. 3D Max Characters and Homebrew NES Dev Graphics) and character sets.

chr Files In NES Dev

Usage

chr files are used to draw 8x8 tiles for homebrew NES development. To draw graphics for the NES such as backgrounds or sprites, they must be pieced together using 8x8 pixel tiles constrained to 4 colors.

Contents

The contents of a chr file can be summed up as multiple lines of bit strings. For example, take the first line of the chr file for the game Super Mario Bros.

000000000011000011110001111100010000000011110001110000100100001000000110011001100000000000000000000000000000000000000000000111110000001111110011111101111111

When reading the file, it is interpreted as 2 equal length bit strings, such as

String 1 = 0000000000110000111100011111000100000000111100011100001001000010011001100110
String 2 = 0000000000000000000000000000000000000000000000011111001111110011111101111111

The position of these 2 bit strings represent a pixel in an 8x8 tile, going in row-column order. The color of the pixel can be found out using a simple formula:

String 1 bit String 2 bit Color
0 0 0
1 0 1
0 1 2
1 1 3

The color is irrelevant because it is chosen through the code by the programmer with the attribute table, so it is the bit combination that is significant and there is no storage of color values

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.