49a87b4d02
palette.h/video/palette.c wrap BIOS $A4 PIC_SET_PAL/PIC_GET_PAL and $A6 SET_PAL_INIT for the 8 palette pages (0-3 graphics, 4-7 text planes). gfx_palette.c and conio/text_palette.c are thin per-domain wrappers; text_palette.c maps the text "plane" 0..3 (paper/ink/blink-paper/ blink-ink) onto BIOS pages 4..7. Covered by tests/text_palette. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
43 lines
1.1 KiB
C
43 lines
1.1 KiB
C
/*
|
|
* 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);
|
|
}
|