Skip to content

chr viewer

Chris Frantz edited this page Apr 14, 2019 · 1 revision

CHR Viewer

The CHR Viewer allows you to view and modify the CHR data banks stored in the ROM.

chr-viewer

  • The Bank selection controls which CHR bank is displayed.

  • The Mode control selects the display layout. You may display CHR banks as either 8x8 blocks or 8x16 blocks. Zelda 2 configures the PPU to use 8x16 sprites, so 8x16 mode is often more useful.

  • The Grid checkbox controls whether or the CHR entities are outlined with a magenta grid.

  • The Export button allows you to save the CHR data in a BMP image.

  • The Import button allows you to load CHR data from a BMP image.

Export

When exporting, the saved BMP file will be exactly what you see in the CHR viewer: the saved file will have the same mode and grid configuration.

Import

When importing a file, the CHR viewer will expect the imported BMP file to have the same mode and grid configuration that is currently selected in the CHR viewer. A file with a different configuration will have unexpected results.

When you import an image, the contents of the CHR bank will immediately be replaced with the data in the image.

NES image data formatting

NES CHR data has 4 colors. What is actually displayed on the screen depends on how the game configures the PPU palettes.

Since the BMP image format supports 24-bit color, there must be a translation between 4-color images and 24-bit color.

When exporting, the following translation is used:

  • Color 0 maps to #000000 (black)
  • Color 1 maps to #666666 (dark gray)
  • Color 2 maps to #AAAAAA (light gray)
  • Color 3 maps to #FFFFFF (bright white)

When importing, the average intensity of the color is computed, and then mapped to NES colors 0 through 3 based on the computed intensity. This means you can use any 24-bit colors you like to edit the image and they will be converted into colors 0 through 3 upon import.

The intesity calculation is done by simple averaging: (red + green + blue) / 3. This means that full-on red and blue (#FF0000 and #0000FF) have the same intensity value: 85 decimal (#55 hex).

When importing, the following translation is used:

  • Intensity #00 to #3F maps to color 0.
  • Intensity #40 to #7F maps to color 1.
  • Intensity #80 to #BF maps to color 2.
  • Intensity #C0 to #FF maps to color 3.
Clone this wiki locally