737c974400
- Split tests/ (libc feature tests) and examples/ (real apps); shared
app.mk in repo root, was examples/example.mk
- libc/io/* split into libc/{conio,env,errno,file,mouse,string,sys,
time,video}/ — clearer module boundaries
- New examples/mdview/: markdown viewer (Phases 1-5 + light nested
lists). Headers (H1-H4), HR, ulist/olist/quote with nesting via
leading spaces, fenced code blocks, inline emphasis (bold/italic/
underscore/code), wrap/unwrap mode with soft wrap (F2), horizontal
pan (← →) with '>' truncation indicator
- libc additions: scroll() in conio (ESTEX SCROLL), strlwr/strupr,
gets() test
- Makefile updates across tests/ for the new shared app.mk path
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
35 lines
870 B
C
35 lines
870 B
C
/*
|
||
* putchar — emit one character via ESTEX PUTCHAR ($5B).
|
||
*
|
||
* Turbo-C convention: this stdio.h function is the FAST path with NO
|
||
* attribute control. Whatever ESTEX has cached for the cursor cell is
|
||
* used (typically the shell's default colour). Translates '\n' to
|
||
* CR LF for C-string semantics.
|
||
*
|
||
* For coloured output, use putch() / cputs() / cprintf() from <conio.h>
|
||
* — those honour textattr / g_text_attr at the cost of being ~10× slower.
|
||
*
|
||
* SDCC __sdcccall(1): char arg in L (low byte of HL=int). Returns the
|
||
* char in DE (SDCC int return).
|
||
*/
|
||
|
||
#include <stdio.h>
|
||
|
||
int putchar(int c) __naked
|
||
{
|
||
(void)c;
|
||
__asm
|
||
ld a, l
|
||
cp #0x0A
|
||
jr nz, cputc
|
||
call cputc
|
||
ld a, #0x0D
|
||
cputc:
|
||
ld c, #0x5B
|
||
rst #0x10
|
||
ld e, l
|
||
ld d, #0
|
||
ret
|
||
__endasm;
|
||
}
|