Display/Palette: Difference between revisions

From WSdev Wiki
Jump to navigationJump to search
(Created page with "The display system provides sixteen different palettes that can be used to color or shade tiles. * Palettes 0-7 can be used for the two screens only; * Palettes 8-15 can be used for both screens and sprites. == Palette format == === Mono === In ''mono'' modes, palettes are stored in I/O ports 0x20 through 0x3F. Each palette contains four three-bit entries, which are pointers into a global, four-bit shade lookup table: <pre> Palette Global shade LUT...")
 
No edit summary
Line 53: Line 53:


In four bit per pixel modes, all palettes are ''translucent''. Index zero is always treated as transparent, and fifteen different colors/shades can be used for tiles.
In four bit per pixel modes, all palettes are ''translucent''. Index zero is always treated as transparent, and fifteen different colors/shades can be used for tiles.
== Color reproduction ==
Different variants of the WonderSwan render colors differently.
=== WonderSwan "mono" ===
This model uses an FSTN display with an approximately linear gamma (~1.0) response for the shades 0 (brightest) through 15 (darkest). Its color reproduction characteristics are very similar to Nintendo's Game Boy Pocket, which uses the same technology.
=== WonderSwan Color ===
This model uses a CSTN display.
In "mono" compatibility mode on Color consoles, the linear gamma response is not retained; shade 0 is equivalent to color <tt>#FFF</tt>, shade 1 to <tt>#EEE</tt>, and shade 15 is equivalent to color <tt>#000</tt>
=== SwanCrystal ===
This model uses a TFT LCD display. Its color reproduction characteristics are very similar to Nintendo's Game Boy Color, which uses the same technology. Its gamma is close to standard video (2.2).
=== Aftermarket/non-standard hardware ===
Generally, IPS mods, as well as both official and unofficial TV output kits, use standard video gamma throughout, even for the "mono" WonderSwan.

Revision as of 10:01, 23 February 2025

The display system provides sixteen different palettes that can be used to color or shade tiles.

  • Palettes 0-7 can be used for the two screens only;
  • Palettes 8-15 can be used for both screens and sprites.

Palette format

Mono

In mono modes, palettes are stored in I/O ports 0x20 through 0x3F. Each palette contains four three-bit entries, which are pointers into a global, four-bit shade lookup table:

      Palette            Global shade LUT
 1  ===========> 2 ==========================> 5
 ^  (0, 2, 4, 6) ^ (1, 3, 5, 7, 9, 11, 13, 15) ^
 |               |                             |
Palette index   Value                         Displayed shade

The shade value corresponds to the darkness of the pixel: shade 0 is the brightest, while shade 15 is the darkest.

Color

In color modes, palettes are stored as 16-bit words in memory addresses 0xFE00 through 0xFFFF, without additional lookup tables:

       Address
15  bit  8  7  bit  0
 ---- ----  ---- ----
 1111 111p  pppi iii.
         |  |||| |||
         |  |||+-+++-- Index in palette (0-15)
         +--+++------- Palette number (0-15)

         Data
15  bit  8  7  bit  0
 ---- ----  ---- ----
 .... rrrr  gggg bbbb
      ||||  |||| ||||
      ||||  |||| ++++- Blue (0-15)
      ||||  ++++------ Green (0-15)
      ++++------------ Red (0-15)

In 2 bits per pixel color modes, palette entries 4 through 15 are not used.

Palette transparency

In two bit per pixel modes:

  • Palettes 0-3 and 8-11 are opaque. For these, index zero is treated as opaque.
  • Palettes 4-7 and 12-15 are translucent. For these, index zero is treated as transparent. This means that the color/shade value set to it is ignored, and only three distinct colors/shades can be used for tiles.

In four bit per pixel modes, all palettes are translucent. Index zero is always treated as transparent, and fifteen different colors/shades can be used for tiles.

Color reproduction

Different variants of the WonderSwan render colors differently.

WonderSwan "mono"

This model uses an FSTN display with an approximately linear gamma (~1.0) response for the shades 0 (brightest) through 15 (darkest). Its color reproduction characteristics are very similar to Nintendo's Game Boy Pocket, which uses the same technology.

WonderSwan Color

This model uses a CSTN display.

In "mono" compatibility mode on Color consoles, the linear gamma response is not retained; shade 0 is equivalent to color #FFF, shade 1 to #EEE, and shade 15 is equivalent to color #000

SwanCrystal

This model uses a TFT LCD display. Its color reproduction characteristics are very similar to Nintendo's Game Boy Color, which uses the same technology. Its gamma is close to standard video (2.2).

Aftermarket/non-standard hardware

Generally, IPS mods, as well as both official and unofficial TV output kits, use standard video gamma throughout, even for the "mono" WonderSwan.