/*
 * text_palette.c — text-mode palette wrappers.
 *
 * Thin layer over libc/video/palette.c. Translates the text "plane
 * number" 0..3 (paper/ink/blink-paper/blink-ink) into the underlying
 * BIOS palette page 4..7 used by $A4.
 *
 * For an introduction to the four-plane text colour model see
 * <palette.h> (top-of-file doc-block).
 */

#include <stdint.h>
#include <conio.h>
#include <palette.h>

void text_pal_load(uint8_t plane, uint8_t start, uint8_t count,
                   const uint8_t *data)
{
    pal_load((uint8_t)(plane + 4u), start, count, data);
}

void text_pal_set_color(uint8_t plane, uint8_t attr,
                        uint8_t r, uint8_t g, uint8_t b)
{
    pal_set_color((uint8_t)(plane + 4u), attr, r, g, b);
}

void text_pal_get(uint8_t plane, uint8_t start, uint8_t count, uint8_t *data)
{
    pal_get((uint8_t)(plane + 4u), start, count, data);
}

void text_pal_get_color(uint8_t plane, uint8_t attr,
                        uint8_t *r, uint8_t *g, uint8_t *b)
{
    pal_get_color((uint8_t)(plane + 4u), attr, r, g, b);
}

void text_pal_reset(void)
{
    pal_reset(PAL_CGA);
}
