Files
Sprinter-SDCC/libc/gfx/gfx_pal_load.c
T
snark13 4a081501d8 libc: сплит «1 функция = 1 модуль» — вся библиотека, wildcard-сборка
- bios/conio/env/errno/gfx/io/mem/mouse/stdio/stdlib/string/sys/time/
  video разложены по модулям: общие статики и helpers — в internal
  _-модулях (_conio.h/_mouse.h/_gfx.h/_palette.h/_atexit.h/_time.h)
- lib/Makefile: LIBC_C = wildcard libc/*/*.c — гранулярность файлов
  = гранулярность DCE линкера
- эффект _CODE: gfx_text 6986→2568 Б, gfx_mous −1745, gfx_demo/d16
  −542; ранее timedir −3270, ls −3098, stattest −2995
- комментарии оставшихся модулей переведены на русский; puts: убран
  мёртвый pchars; videomode_raw разложен на get/set
- docs/libc-split-asm-cases.md — правила asm-связок между модулями;
  docs/libc-roadmap.md — план этапа
- восстановлен examples/mdview/SAMPLE.MD (нужен make floppy)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-06 16:08:58 +03:00

41 lines
1.4 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
* gfx_pal_load — загрузить блок записей графической палитры
* (BIOS $A4 PIC_SET_PAL): pal_num 0..3, start — первый слот,
* count слотов (0 = 256), data — записи по 4 байта (B, G, R, 0).
*
* Собственный inline-asm вместо тонкой обёртки над pal_load — тонкая
* обёртка через __sdcccall(1)-передачу эмпирически ломала текстовую
* палитру (следующая печать в текстовом режиме вешалась).
*/
#include "_gfx.h"
#include <palette.h>
static uint8_t gpl_num_;
static uint8_t gpl_start_;
static uint8_t gpl_count_;
static uint16_t gpl_data_;
void gfx_pal_load(uint8_t pal_num, uint8_t start, uint8_t count,
const uint8_t *data)
{
gpl_num_ = pal_num;
gpl_start_ = start;
gpl_count_ = count;
gpl_data_ = (uint16_t)(uintptr_t)data;
__asm
push ix
ld a, (_gpl_start_)
ld e, a ; E = start
ld a, (_gpl_count_)
ld d, a ; D = count (0 = 256)
ld hl, (_gpl_data_) ; HL = data
ld b, #0xFF ; маска
ld a, (_gpl_num_) ; A = номер палитры
ld c, #0xA4 ; BIOS PIC_SET_PAL
rst #0x08
pop ix
__endasm;
}