Add full compiler toolchain, libc, examples and reference docs
First substantive commit: the entire Sprinter C compiler tree on top of
the bare README+gitignore initial commit.
What's in here:
bin/sprinter-cc — driver script invoking SDCC + linker + mkexe
libc/ — Sprinter-specific libc layer over ESTEX/BIOS
(conio, gfx, io, mem, stdio + headers)
runtime/ — crt0 variants (default/small/banked/minimal)
+ heap + bank trampolines
toolchain/ — mkexe (SprintEXE packer, C + tests)
examples/ — 30 demo programs (gfx, file I/O, env, time, …)
lib/Makefile — builds the libc archive (sprinter.lib)
docs/ — converted Sprinter manuals + asm reference samples
third_party/ — solid-c reference compiler dump + sdcc setup script
release_docs/ — packaging / release notes
gitignore overhaul:
• Drop dangerous blanket patterns: *.asm (would hide docs/samples/*.asm)
and *.exe (case-insensitive match was hiding third_party/solid-c/*.EXE
on macOS APFS). Replaced with examples/*/*.{asm,exe,…} and lib/*.lib.
• Restore tracking of toolchain/mkexe/tests/{one,big}.bin — those are
INPUT fixtures, not build outputs.
• Collapse the duplicated SDCC/C/Sdcc sections into one section per
concern (build outputs / vendored / OS-junk).
• Add .sprinter-cc-*/, build/ (catches lib/build/ too), .claude/.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
# Build rt_test.exe — uses lib/sprinter.lib in TINY memory mode.
|
||||
|
||||
PROJ_ROOT := $(abspath $(CURDIR)/../..)
|
||||
EXAMPLE := rt_test
|
||||
include $(PROJ_ROOT)/examples/example.mk
|
||||
@@ -0,0 +1,63 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <setjmp.h>
|
||||
#include <sprinter_exit.h>
|
||||
|
||||
static void bye1(void) { puts("[atexit] bye1 (registered first, runs last)"); }
|
||||
static void bye2(void) { puts("[atexit] bye2 (registered second)"); }
|
||||
static void bye3(void) { puts("[atexit] bye3 (registered third, runs first)"); }
|
||||
|
||||
static jmp_buf env;
|
||||
static int attempt;
|
||||
|
||||
static void might_fail(int n)
|
||||
{
|
||||
printf(" might_fail(%d) running...\n", n);
|
||||
if (n == 2) {
|
||||
puts(" -> longjmp(env, 42)");
|
||||
longjmp(env, 42);
|
||||
/* not reached */
|
||||
}
|
||||
printf(" might_fail(%d) returned normally\n", n);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
puts("Sprinter runtime features test:");
|
||||
puts("");
|
||||
|
||||
/* --- atexit registration --- */
|
||||
atexit(bye1);
|
||||
atexit(bye2);
|
||||
atexit(bye3);
|
||||
|
||||
/* --- setjmp / longjmp --- */
|
||||
puts("setjmp/longjmp:");
|
||||
int r = setjmp(env);
|
||||
if (r == 0) {
|
||||
attempt = 1;
|
||||
puts(" first arrival from setjmp (r=0)");
|
||||
might_fail(attempt);
|
||||
attempt = 2;
|
||||
might_fail(attempt);
|
||||
puts(" -- this line is NOT reached");
|
||||
} else {
|
||||
printf(" resumed via longjmp, setjmp returned %d (attempt=%d)\n",
|
||||
r, attempt);
|
||||
}
|
||||
|
||||
/* --- sleep --- */
|
||||
puts("");
|
||||
puts("sleep(5): pausing 5 seconds...");
|
||||
sleep(5);
|
||||
puts(" done.");
|
||||
|
||||
puts("");
|
||||
puts("Press any key, atexit chain will run after.");
|
||||
(void)getchar();
|
||||
|
||||
/* Use exit() to drive the atexit chain (vs returning from main, which
|
||||
* doesn't necessarily go through exit() under SDCC). */
|
||||
exit(0);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user