FABRIC.md -> FABRIC-0.md FABRIC-2.md -> FABRIC-1.md FABRIC-3.md -> FABRIC-2.md (the current/living document) FABRIC-4.md unchanged (new #3 to follow separately) Every cross-reference repo-wide updated to match, including doc-comment citations inside kernel source (.c/.h) files -- done via an ordered placeholder substitution (FABRIC-3.md->placeholder2, FABRIC-2.md-> placeholder1, FABRIC.md->placeholder0, then placeholders resolved to final names) in a single pass per file to avoid double-shifting already-renamed references. One line in capsules/font.4th grew past the 64-char block-format limit as a side effect of the longer filename; shortened it and reverified with mkcapsule --lint (34/34 pass) before rebuilding. Verified 3-arch boot to ok> (amd64/aarch64/riscv64, each in the foreground) after the fix; logs and DoE CSVs from this session's verification runs included per this repo's own audit-artifact convention. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019YcT3H2PQeyujrzjqS3Var
66 lines
1.5 KiB
C
66 lines
1.5 KiB
C
/*
|
||
StarForth — Steady-State Virtual Machine Runtime
|
||
|
||
Copyright (c) 2023–2025 Robert A. James
|
||
All rights reserved.
|
||
|
||
Licensed under the StarForth License, Version 1.0
|
||
*/
|
||
|
||
/* framebuffer_words.c — raw framebuffer hardware-boundary FORTH words
|
||
* (FABRIC-0.md item 4.3.3). Kernel-only; no-op on hosted builds. */
|
||
|
||
#include "include/framebuffer_words.h"
|
||
#include "../../include/log.h"
|
||
#include "../../include/word_registry.h"
|
||
|
||
#ifdef __STARKERNEL__
|
||
#include "starkernel/framebuffer.h"
|
||
#endif
|
||
|
||
/* PLOT ( x y color -- ) : raw raster pixel write, top-left origin, Y-down.
|
||
* No Cartesian awareness -- that is capsules/fabric.4th's job. */
|
||
static void fbw_plot(VM *vm)
|
||
{
|
||
if (vm->dsp < 2) {
|
||
log_message(LOG_ERROR, "PLOT: Stack underflow");
|
||
vm->error = 1;
|
||
return;
|
||
}
|
||
cell_t color = vm_pop(vm);
|
||
cell_t y = vm_pop(vm);
|
||
cell_t x = vm_pop(vm);
|
||
#ifdef __STARKERNEL__
|
||
fb_put_pixel((uint32_t)x, (uint32_t)y, (uint32_t)color);
|
||
#else
|
||
(void)x; (void)y; (void)color;
|
||
#endif
|
||
}
|
||
|
||
/* FB-WIDTH ( -- n ) */
|
||
static void fbw_width(VM *vm)
|
||
{
|
||
#ifdef __STARKERNEL__
|
||
vm_push(vm, (cell_t)fb_width());
|
||
#else
|
||
vm_push(vm, 0);
|
||
#endif
|
||
}
|
||
|
||
/* FB-HEIGHT ( -- n ) */
|
||
static void fbw_height(VM *vm)
|
||
{
|
||
#ifdef __STARKERNEL__
|
||
vm_push(vm, (cell_t)fb_height());
|
||
#else
|
||
vm_push(vm, 0);
|
||
#endif
|
||
}
|
||
|
||
void register_framebuffer_words(VM *vm)
|
||
{
|
||
register_word(vm, "PLOT", fbw_plot);
|
||
register_word(vm, "FB-WIDTH", fbw_width);
|
||
register_word(vm, "FB-HEIGHT", fbw_height);
|
||
}
|