Files
snark13 c71e249a4e 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>
2026-06-03 16:13:21 +03:00

40 lines
1.1 KiB
C

/*
* unistd.h — POSIX-style file descriptor I/O for Sprinter ESTEX.
*
* Each call maps to a single ESTEX RST 10h function:
* read → $13 write → $14
* close → $12 unlink → $0E
*
* On error every call returns -1 (the ESTEX error code is not exposed yet;
* a future errno mechanism will surface it).
*/
#ifndef UNISTD_H
#define UNISTD_H
#include <stddef.h> /* size_t */
/* lseek whence values (POSIX). */
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
int read (int fd, void *buf, size_t n);
int write(int fd, const void *buf, size_t n);
int close(int fd);
int unlink(const char *path);
long lseek(int fd, long offset, int whence);
/* Block the calling task for `seconds` seconds (50 Hz IRQ-based timer). */
void sleep(unsigned int seconds);
/* Directory operations (ESTEX $1B-$1E). All return 0 on success and -1
* with errno set on failure; getcwd returns the buffer on success or NULL.
* size is ignored — ESTEX always wants a 256-byte buffer. */
int mkdir (const char *path);
int rmdir (const char *path);
int chdir (const char *path);
char *getcwd(char *buf, size_t size);
#endif