Skip to content

Define color channel constants #70

@Rangi42

Description

@Rangi42

Here's what we have for CGB colors so far:

def COLOR_SIZE equ 2 ; size of color in bytes (little-endian BGR555)
    def B_COLOR_RED   equ  0 ; bits 4-0
    def B_COLOR_GREEN equ  5 ; bits 9-5
    def B_COLOR_BLUE  equ 10 ; bits 14-10
        def COLOR_RED        equ %000_11111  ; for the low byte
        def COLOR_GREEN_LOW  equ %111_00000  ; for the low byte
        def COLOR_GREEN_HIGH equ %0_00000_11 ; for the high byte
        def COLOR_BLUE       equ %0_11111_00 ; for the high byte

And for DMG shades:

def SHADE_WHITE equ %00
def SHADE_LIGHT equ %01
def SHADE_DARK  equ %10
def SHADE_BLACK equ %11

What we lack is the meaningful values for individual CGB color channels:

  • Each channel is 5 bits wide (COLOR_DEPTH? RGB_DEPTH?)
  • The maximum value is 2**5 - 1 = 31 (MAX_RGB? RGB_MAX? or just let this be derived from the color depth?)

This would allow an edit to the above:

    def B_COLOR_RED   equ COLOR_DEPTH * 0 ; bits 4-0
    def B_COLOR_GREEN equ COLOR_DEPTH * 1 ; bits 9-5
    def B_COLOR_BLUE  equ COLOR_DEPTH * 2 ; bits 14-10

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions