Files
Sprinter-SDCC/libc/mem/mem_free_block_bios.c
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

25 lines
830 B
C
Raw Permalink 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.
/*
* mem_free_block_bios — освободить блок, выданный mem_alloc_pages_bios.
* BIOS EMM_FN3 ($C3, rst 8): A=blk_id → CF=err.
*
* Идемпотентности НЕТ: повторное освобождение того же блока ставит
* errno. Владение отслеживает вызывающий.
*/
#include <stdint.h>
#include <sprinter_mem.h>
void mem_free_block_bios(uint8_t blk_id) __naked
{
(void)blk_id;
__asm
;; SDCC: единственный uint8-аргумент уже в A.
push ix
ld c, #0xC3 ; BIOS EMM_FN3 (FREE)
rst #0x08
pop ix
ret nc ; CF=0 успех
jp __errno_set ; CF=1 A = код; tail-call хелпера
__endasm;
}