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>
This commit is contained in:
+11
-27
@@ -1,39 +1,23 @@
|
||||
/*
|
||||
* puts — C99 fputs(s, stdout) + '\n'.
|
||||
* puts — C99: вывести строку + '\n'.
|
||||
*
|
||||
* Turbo-C convention: stdio's `puts` is the FAST path with NO attribute
|
||||
* control — backed by ESTEX PCHARS ($5C). Cursor cell attributes are
|
||||
* whatever ESTEX has cached (usually the shell's default).
|
||||
* Конвенция Turbo-C: stdio-шный puts — БЫСТРЫЙ путь БЕЗ управления
|
||||
* атрибутом; атрибуты ячеек — какие ESTEX закэшировал (обычно цвет
|
||||
* шелла). Для цветного вывода — cputs() / cprintf() из <conio.h>.
|
||||
*
|
||||
* For coloured output use cputs() / cprintf() from <conio.h>.
|
||||
*
|
||||
* Implementation notes:
|
||||
* - PCHARS does NOT translate '\n' to CR LF, so we copy the string
|
||||
* into a static buffer expanding each '\n' to CR LF, then append
|
||||
* the trailing CR LF before the NUL.
|
||||
* - Avoid trailing PUTCHAR after PCHARS — empirically that sometimes
|
||||
* drops the next char. Embed the line ending inside the PCHARS
|
||||
* buffer instead.
|
||||
* Реализация: посимвольный цикл через putchar (он транслирует '\n' в
|
||||
* CR LF), в конце — putchar('\n'). Быстрый путь через ESTEX PCHARS
|
||||
* ($5C) не используется: PCHARS не транслирует '\n', а добивать хвост
|
||||
* через PUTCHAR после PCHARS нельзя — эмпирически это иногда теряло
|
||||
* следующий символ.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
static void pchars(const char *s) __naked
|
||||
{
|
||||
(void)s;
|
||||
__asm
|
||||
push ix
|
||||
ld c, #0x5C
|
||||
rst #0x10
|
||||
pop ix
|
||||
ret
|
||||
__endasm;
|
||||
}
|
||||
|
||||
char puts(const char *s) __naked
|
||||
{
|
||||
(void)s;
|
||||
(void)s;
|
||||
__asm
|
||||
puts_:
|
||||
ld a, (hl)
|
||||
@@ -47,7 +31,7 @@ char puts(const char *s) __naked
|
||||
inc hl
|
||||
jp puts_
|
||||
;
|
||||
fin_:
|
||||
fin_:
|
||||
ld l, #0x0A
|
||||
ld h, #0
|
||||
call _putchar
|
||||
|
||||
Reference in New Issue
Block a user