Game Boy DMG Four-Tone Palette Map

Map actual Game Boy two-bit pixel codes through explicit four-shade BGP mapping and pack the register value; not arbitrary invented hardware RGB colors, LCD emulation or a ROM/hardware write.

Description

Game Boy BGP packs four two-bit shade mappings into one byte.

Game Boy BGP packs four two-bit shade mappings into one byte. Pixel codes index the supplied mapping.1

Enter pixel integer codes 0–3 and exactly four integer mapped shades 0–3. Return mapped pixel shades and packed BGP byte; empty pixel lists are allowed.

When to use Game Boy DMG Four-Tone Palette Map

Use Game Boy DMG Four-Tone Palette Map when you need to evaluate the supplied records under the calculation and evidence rules below. No fixed LCD RGB palette, emulation or ROM/hardware write is performed.

Prepare colors in the stated color space and scale. Use encoded RGB fractions, linear RGB, Lab, xy, byte values or ink percentages exactly as requested; supply caller tolerances and reference conditions.

How to use Game Boy DMG Four-Tone Palette Map and understand its results

  1. Prepare colors in the stated color space and scale. Use encoded RGB fractions, linear RGB, Lab, xy, byte values or ink percentages exactly as requested; supply caller tolerances and reference conditions.
  2. Enter twoBitPixelCodes, callerDmgShadeMapping using the field table and calculation rules, then run the tool.
  3. Read mappedShadeIndices, packedBgpRegisterByte. The explanation below defines the units, signs, ordering and any flags or placeholder values.
  4. If the tool reports an input issue, correct the values and run it again. Apply the stated assumptions when interpreting a successfully returned result.
Input fieldMeaningValue type; see rules belowRequirement
twoBitPixelCodesTwo bit pixel codeslist of numberRequired
callerDmgShadeMappingCaller dmg shade mappinglist of numberRequired

Enter pixel integer codes 0–3 and exactly four integer mapped shades 0–3. Return mapped pixel shades and packed BGP byte; empty pixel lists are allowed.

register=sum(shade[i] shifted left2i)

Units, indexing, boundary conditions and exceptional cases are defined in the calculation rules above.

Output fieldMeaningValue type
mappedShadeIndicesMapped shade indiceslist of number
packedBgpRegisterBytePacked bgp register bytenumber
json
{
  "input": {
    "twoBitPixelCodes": [
      0,
      1,
      2,
      3
    ],
    "callerDmgShadeMapping": [
      3,
      2,
      1,
      0
    ]
  },
  "output": {
    "mappedShadeIndices": [
      3,
      2,
      1,
      0
    ],
    "packedBgpRegisterByte": 27
  }
}

Limitations and assumptions

No fixed LCD RGB palette, emulation or ROM/hardware write is performed.

Numeric inputs, where present, must be finite. Follow the calculation-specific rules for overflow, underflow and exceptional cases. Numeric lists are limited to 10,000 entries; string lists to 128 strings of at most 128 characters each. The rules above may impose smaller limits. Missing required fields, extra fields, wrong value types and violations of the calculation rules are input errors.

Alternative or Complementary methods

Use WS2812 GRB Byte Order Check: WS2812 GRB serialization sends green before red and blue. An observed stream can have wrong values or wrong length. For a complementary task, use E-Ink 16-Level Grayscale Map: Sixteen-level grayscale quantization needs a declared code polarity. Reconstructed gray is independent of that device convention.

References

  1. Game Boy DMG Four-Tone Palette Map — tool.io

Similar or alternative tools

  • WS2812 GRB Byte Order Check

    WS2812 GRB serialization sends green before red and blue. An observed stream can have wrong values or wrong length.

  • E-Ink 16-Level Grayscale Map

    Sixteen-level grayscale quantization needs a declared code polarity. Reconstructed gray is independent of that device convention.

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies