Add mdview markdown viewer, reorganize tests/examples and libc layout
- 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>
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* videomode_raw.c — low-level ESTEX SETVMOD / GETVMOD ($50 / $51).
|
||||
*
|
||||
* Plain getters/setters with NO mode-class validation. Used by both
|
||||
* conio (text-validated public API) and gfx (graphics modes). Lives
|
||||
* in its own .c so a pure graphics program does not pull in the entire
|
||||
* conio module to switch modes.
|
||||
*
|
||||
* Public conio functions in conio.c wrap these with a text-mode check;
|
||||
* gfx_init / gfx_done in gfx_core.c call them directly.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
|
||||
uint8_t _videomode_raw_get(void) __naked
|
||||
{
|
||||
__asm
|
||||
push ix
|
||||
ld c, #0x51 ; ESTEX GETVMOD
|
||||
rst #0x10
|
||||
pop ix
|
||||
;; uint8_t returns in A — ESTEX already put mode there.
|
||||
ret
|
||||
__endasm;
|
||||
}
|
||||
|
||||
int _videomode_raw_set(uint8_t mode) __naked
|
||||
{
|
||||
(void)mode;
|
||||
__asm
|
||||
;; SDCC __sdcccall(1) passes uint8_t in A — leave it there.
|
||||
push ix
|
||||
ld bc, #0x0050 ; ESTEX SETVMOD (B=0 (page), C=0x50)
|
||||
rst #0x10
|
||||
jr c, _vmr_err
|
||||
ld de, #0
|
||||
pop ix
|
||||
ret
|
||||
_vmr_err:
|
||||
call __errno_set
|
||||
ld de, #-1
|
||||
pop ix
|
||||
ret
|
||||
__endasm;
|
||||
}
|
||||
Reference in New Issue
Block a user