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:
2026-06-03 16:13:21 +03:00
parent f542608b3f
commit c71e249a4e
404 changed files with 75155 additions and 58 deletions
+5
View File
@@ -0,0 +1,5 @@
# Build time_dir_test.exe — uses lib/sprinter.lib in TINY memory mode.
PROJ_ROOT := $(abspath $(CURDIR)/../..)
EXAMPLE := timedir
include $(PROJ_ROOT)/examples/example.mk
+108
View File
@@ -0,0 +1,108 @@
#include <stdio.h>
#include <unistd.h>
#include <time.h>
#include <errno.h>
#include <string.h>
#include <conio.h>
static const char *dow_name(uint8_t d)
{
/* Sprinter SYSTIME returns dow 1-based: 1=Sun..7=Sat. */
static const char *names[] = { "?", "Sun", "Mon", "Tue",
"Wed", "Thu", "Fri", "Sat" };
return (d >= 1 && d <= 7) ? names[d] : names[0];
}
int main(void)
{
/* --- time ----------------------------------------------------------- */
datetime_t dt;
getdatetime(&dt);
printf("getdatetime: %04u-%02u-%02u %02u:%02u:%02u (dow=%u %s)\n",
dt.year, dt.month, dt.day,
dt.hour, dt.minute, dt.second,
dt.dow, dow_name(dt.dow));
/* dow convention probe — set to known dates, read back.
* Discriminating test: today (Thu) gave dow=5, which fits either
* (a) Sun=1, Mon=2, ..., Sat=7 (DOS 1-based starting Sun)
* (b) Sat=0, Sun=1, ..., Fri=6 (week starts Saturday)
* Saturday's number tells us which one. */
datetime_t saved = dt;
datetime_t probe;
probe = dt; probe.year = 2026; probe.month = 5; probe.day = 30; /* Sat */
if (setdatetime(&probe) == 0) {
getdatetime(&probe);
printf("probe 2026-05-30 (Sat expected): dow=%u %s\n",
probe.dow, dow_name(probe.dow));
}
probe = dt; probe.year = 2026; probe.month = 5; probe.day = 31; /* Sun */
if (setdatetime(&probe) == 0) {
getdatetime(&probe);
printf("probe 2026-05-31 (Sun expected): dow=%u %s\n",
probe.dow, dow_name(probe.dow));
}
probe = dt; probe.year = 2026; probe.month = 6; probe.day = 1; /* Mon */
if (setdatetime(&probe) == 0) {
getdatetime(&probe);
printf("probe 2026-06-01 (Mon expected): dow=%u %s\n",
probe.dow, dow_name(probe.dow));
}
/* Restore original. */
if (setdatetime(&saved) == 0)
printf("restored original date\n");
else
printf("setdatetime(restore) failed: errno=%d\n", errno);
/* --- getcwd --------------------------------------------------------- */
char cwd[256];
if (getcwd(cwd, sizeof cwd) == NULL) {
printf("getcwd failed: errno=%d (%s)\n", errno, strerror(errno));
} else {
printf("cwd before: \"%s\"\n", cwd);
}
/* --- mkdir / chdir / getcwd / rmdir --------------------------------- */
const char *test_dir = "TMPTEST";
/* If a previous run left it behind, ignore the mkdir failure. */
if (mkdir(test_dir) < 0) {
printf("mkdir(%s) -> errno=%d (%s) [continuing]\n",
test_dir, errno, strerror(errno));
} else {
printf("mkdir(%s) OK\n", test_dir);
}
if (chdir(test_dir) < 0) {
printf("chdir(%s) failed: errno=%d (%s)\n",
test_dir, errno, strerror(errno));
return 1;
}
printf("chdir(%s) OK\n", test_dir);
if (getcwd(cwd, sizeof cwd) != NULL)
printf("cwd after: \"%s\"\n", cwd);
/* Back out, then remove. */
if (chdir("\\") < 0)
printf("chdir(\\) failed: errno=%d\n", errno);
else
printf("chdir(\\) OK\n");
if (rmdir(test_dir) < 0)
printf("rmdir(%s) failed: errno=%d (%s)\n",
test_dir, errno, strerror(errno));
else
printf("rmdir(%s) OK\n", test_dir);
if (getcwd(cwd, sizeof cwd) != NULL)
printf("cwd final: \"%s\"\n", cwd);
puts("\npress any key to exit");
(void)getch();
return 0;
}