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
+25
View File
@@ -0,0 +1,25 @@
/*
* CONIO.H
*
* Low-level console functions.
* (c) 2004, SOLID C Sprinter-2000
*/
#ifndef _C_TYPES_
#include <types.h>
#endif
char getch();
char getche();
void putch();
void cputs();
void clrscr();
void home();
void gotoxy();
char *cgets();
char inp();
char outp();
BOOL kbhit();
int cprintf(.);
+23
View File
@@ -0,0 +1,23 @@
/*
* CTYPE.H
*
* Character type classification.
* (c) 2004, SOLID C Sprinter-2000
*/
char tolower(); /* convert to lowercase */
char toupper(); /* convert to uppercase */
BOOL islower(); /* lowercase test */
BOOL isupper(); /* uppercase test */
BOOL isalnum(); /* A..Z a..z 0..9 */
BOOL isalpha(); /* A..Z a..z */
BOOL isascii(); /* !..~ */
BOOL isdigit(); /* 0..9 */
BOOL isxdigit(); /* hex digit test */
BOOL isspace(); /* space test */
BOOL iscntrl(); /* unprintable control symbol */
BOOL isgraph(); /* has graphic reprezentation */
BOOL isprint(); /* printable test */
BOOL ispunct(); /* punctuation sign test */
+18
View File
@@ -0,0 +1,18 @@
/*
* DIRECT.H
*
* Defines structures, macros, and functions for dealing
* with directories and pathnames.
* (c) 2004, SOLID C Sprinter-2000
*/
#ifndef _C_TYPES_
#include <types.h>
#endif
char chdir();
char *getcwd();
char mkdir();
char rmdir();
+100
View File
@@ -0,0 +1,100 @@
/*
* DOS.H
*
* Defines structs, unions, and functions for
* dealing with Estex-DOS.
* (c) 2004, SOLID C Sprinter-2000
*/
#ifndef _C_TYPES_
#include <types.h>
#endif
/* Variables */
extern int _argc;
extern char **_argv;
/* DOS types */
struct WORDREGS {
unsigned af, bc, de, hl, ix, iy;
};
struct BYTEREGS {
char flag, a, c, b, e, d, l, h;
};
union REGS {
struct WORDREGS x;
struct BYTEREGS h;
};
struct time {
unsigned char ti_min; /* minutes */
unsigned char ti_hour; /* hours */
unsigned char ti_hund; /* hundredths of seconds. Not used. */
unsigned char ti_sec; /* seconds */
};
struct date {
int da_year; /* year */
char da_day; /* day of the month */
char da_mon; /* month (1 = Jan) */
};
/* ffirst, fnext functions */
typedef struct ffblk {
char name[8]; /* +0 pattern of a file name */
char ext[3]; /* +8 pattern of file expansion */
char attrib; /* +11 search attribute */
char ff_resv[10]; /* +12 reserved for DOS */
uint ff_time; /* +22 time of last write to file */
uint ff_date; /* +24 date of last write to file */
uint ff_clst; /* +26 number of first cluster */
uint ff_lsize; /* +28 low size of file */
uint ff_hsize; /* +30 high size of file */
char ff_attr; /* +32 attribute byte of matched file */
char ff_name[223]; /* +33 null-terminated name of matched file */
} FIND;
/* file attributes */
#define FA_NORMAL 0x00 /* Normal file, no attributes */
#define FA_RDONLY 0x01 /* Read only attribute */
#define FA_HIDDEN 0x02 /* Hidden file */
#define FA_SYSTEM 0x04 /* System file */
#define FA_LABEL 0x08 /* Volume label */
#define FA_DIREC 0x10 /* Directory */
#define FA_ARCH 0x20 /* Archive */
/* Prototypes */
char bdos(); /* DOS call return status */
int bdosh(); /* DOS call return int */
void intdos(); /* DOS call, parameters and return as REGS */
void enable(); /* enable interrupts */
void disable(); /* disable interrupts */
char absread(); /* read sectors */
char abswrite(); /* write sectors */
char ffirst(); /* found first file */
char _ffirst(); /* found first file, format "FilenameExt" */
char fnext(); /* found next file */
int _setargv(); /* parsing arguments */
void setdisk(); /* set default disk */
char getdisk(); /* get default disk */
void setdate(); /* set system date */
void getdate(); /* get struct date */
void settime(); /* set system time */
void gettime(); /* get struct time */
void sleep();
#define findfirst ffirst
#define findnext fnext
+63
View File
@@ -0,0 +1,63 @@
/*
* ERRNO.H
*
* Defines the system error variable errno and the error
* numbers set by system calls.
* (c) 2004, SOLID C Sprinter-2000
*/
/* DOS Error Codes */
#define EZERO 0 /* No error */
#define EINVFNC 1 /* Invalid function */
#define EINVDRV 2 /* Invalid drive number */
#define ENOFILE 3 /* File not found */
#define ENOPATH 4 /* Path not found */
#define EINVHND 5 /* Invalid handle */
#define EMFILE 6 /* Too many open files */
#define EEXIST 7 /* File already exists */
#define EROFILE 8 /* File read only */
#define EROOT 9 /* Root overflow */
#define ENOSPACE 10 /* No free space */
#define ENOEMPTY 11 /* Directory not empty */
#define ECURDIR 12 /* Can't delete current directory */
#define EINVMED 13 /* Invalid media */
#define EOPER 14 /* Unknown operation */
#define EEXISDIR 15 /* Directory exist */
#define EINVFNAM 16 /* Invalid filename */
#define EINVEXE 17 /* Invalid EXE-file */
#define ENSUPEXE 18 /* Not supported EXE-file */
#define EACCES 19 /* Access denied */
#define ENORDY 20 /* Not ready */
#define ESEEK 21 /* Seek error */
#define ENOSECT 22 /* Sector not found */
#define ECRC 23 /* CRC error */
#define EWRTPRT 24 /* Write protect */
#define EREAD 25 /* Read error */
#define EWRITE 26 /* Write error */
#define EDRVFAIL 27 /* Drive failure */
#define EEXTND28 28 /* Extended error: 28 */
#define EEXTND29 29 /* Extended error: 29 */
#define ENOMEM 30 /* Not enough memory */
#define EINVMEM 31 /* Invalid memory block */
#define EEXTND32 32 /* Extended error: 32 */
#define EEXTND33 33 /* Extended error: 33 */
#define EEXTND34 34 /* Extended error: 34 */
#define EERR35 35 /* 35 */
#define EERR36 36 /* 36 */
#define EERR37 37 /* 37 */
#define EERR38 38 /* 38 */
#define EERR39 39 /* 39 */
#define EERR40 40 /* 40 */
#define EERR41 41 /* 41 */
#define EERR42 42 /* 42 */
#define EERR43 43 /* 43 */
#define EERR44 44 /* 44 */
#define EERR45 45 /* 45 */
#define EERR46 46 /* 46 */
#define EERR47 47 /* 47 */
#define EERR48 48 /* 48 */
#define EERR49 49 /* 49 */
#define EERR50 50 /* 50 */
+51
View File
@@ -0,0 +1,51 @@
/*
* IO.H
*
* Low-level nonbuffered file I/O.
* (c) 2004, SOLID C Sprinter-2000
*/
#ifndef _C_TYPES_
#include <types.h>
#endif
#ifndef _STD_LIB_
#include <stdlib.h>
#endif
#ifndef _STD_SEEK_
#define _STD_SEEK_
/* constants to be used as 3rd argument for "fseek" function */
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
#endif
/* Definition "open flags" */
#define O_WRONLY 0x01 /* 0 file write only */
#define O_RDONLY 0x02 /* 1 file read only */
#define O_RDWR 0x03 /* 1,0 file read/write */
#define O_TRUNC 0x04 /* 2 open with truncation */
#define O_CREAT 0x08 /* 3 create and open file */
#define O_EXCL 0x10 /* 4 exclusive open */
#define O_APPEND 0x20 /* 5 to end of file */
uint open(); /* opens/creates a file */
uint creat(); /* creates file */
size_t read(); /* read file */
size_t write(); /* write file */
uint close(); /* close file */
uint seek(); /* sets file pointer (range 0..65534) */
uint tell(); /* returns current position (range 0..65534) */
struct fpoint *lseek(); /* sets file pointer */
struct fpoint *ltell(); /* returns current position */
char unlink(); /* delete file */
char remove(); /* delete file */
char rename(); /* rename file */
BOOL isatty(); /* return "true" if FD is console I/O */
int ioctl(); /* control i/o for devices or files */
+19
View File
@@ -0,0 +1,19 @@
/*
* MALLOC.H
*
* Memory management functions.
* (c) 2004, SOLID C Sprinter-2000
*/
#ifndef _C_TYPES_
#include <types.h>
#endif
int brk(); /* set free memory pointer */
char *sbrk(); /* move free memory pointer arg bytes higher */
char *malloc(); /* allocate memory */
char *calloc(); /* allocate object array, zero memory */
char *realloc(); /* reallocate memory */
void free(); /* free malloc'd memory */
+19
View File
@@ -0,0 +1,19 @@
/*
* MEM.H
*
* Memory manipulation functions.
* (c) 2004, SOLID C Sprinter-2000
*/
#ifndef _C_TYPES_
#include <types.h>
#endif
int memcmp(); /* compare two memory blocks */
void *memcpy(); /* copy memory block */
void *memmove(); /* copy memory block */
void *memset(); /* fill memory with byte */
void movmem(); /* memory copy */
void setmem(); /* memory fill */
+112
View File
@@ -0,0 +1,112 @@
/*
* MOUSE.H
*
* Defines structures, macros, and functions.
* (c) 2004, SOLID C Sprinter-2000
*/
#ifndef _C_TYPES_
#include <types.h>
#endif
#define LEFT_BUTTON 1
#define RIGHT_BUTTON 2
/* getStatMouse() */
typedef struct {
char button; /* buttons: 0/1 bits - left/right */
char x; /* colon */
char y; /* line */
} MSSTAT;
/* getGStatMouse() */
typedef struct {
char button; /* buttons: 0/1 bits - left/right */
int x; /* X pos */
int y; /* Y pos */
} MSGSTAT;
/* getCursMouse() */
typedef struct {
char width; /* width curs */
char high; /* high curs */
char xpoint; /* X active point */
char ypoint; /* Y active point */
char *buff; /* addr cursor buffer */
} MSCURS;
/* setTxtMouse() */
typedef struct {
char xattr; /* XOR attribut mask */
char aattr; /* AND attribut mask */
char xsym; /* XOR simbol mask */
char asym; /* AND simbol mask */
} MSTXT;
/* getSensMouse(), setSensMouse() */
typedef struct {
char xsens; /* horiz. sensitive */
char ysens; /* vert. sensitive */
} MSSENS;
// 0 - ­¥â ®è¨¡®ª
// 1 - ­¥¨§¢¥áâ­ ï äã­ªæ¨ï
// 3 - ªãàá®à 㦥 ­  íªà ­¥
// 4 - ªãàá®à ®âáãâáâ¢ã¥â ­  íªà ­¥
// 5 - ¨§®¡à ¦¥­¨¥ ªãàá®à  ᫨誮¬ ¢¥«¨ª®
/* Mouse Error Codes */
#define MSEZERO 0 /* No error */
#define MSUNKNW 1 /* Unknown function */
#define MSEXIST 3 /* Exists cursor */
#define MSNOCUR 4 /* No cursor */
#define MSTOOBIG 5 /* Too big image */
/* prototypes */
char ms_init();
char ms_show();
char ms_hide();
MSSTAT *ms_stat();
MSGSTAT *msgstat();
char ms_spos();
char mssgpos();
char ms_ybnd();
char ms_xbnd();
char ms_scur();
char ms_tcur();
MSCURS *ms_gcur();
MSSENS *ms_gsen();
char ms_ssen();
char ms_hard();
char ms_vmod();
char ms_ref();
#define initMouse ms_init
#define showMouse ms_show
#define hideMouse ms_hide
#define getStatMouse ms_stat
#define getGStatMouse msgstat
#define setPosMouse ms_spos
#define setGPosMouse mssgpos
#define yLimMouse ms_ybnd
#define xLimMouse ms_xbnd
#define setTxtMouse ms_tcur
#define getCursMouse ms_gcur
#define setCursMouse ms_scur
#define getSensMouse ms_gsen
#define setSensMouse ms_ssen
#define hardMouse ms_hard
#define vmodeMouse ms_vmod
#define refreshMouse ms_ref
+22
View File
@@ -0,0 +1,22 @@
/*
* SETJMP.H
*
* Defines typedef and functions for setjmp/longjmp.
* (c) 2004, SOLID C Sprinter-2000
*/
#ifndef _C_TYPES_
#include <types.h>
#endif
typedef struct {
uint j_sp;
uint j_iy;
uint j_pc;
} jmp_buf;
int setjmp(); /* set nonlocal jump return point */
void longjmp(); /* do a nonlocal jump */
+15
View File
@@ -0,0 +1,15 @@
/*
* STAT.H
*
* Definitions used for file status functions.
* (c) 2004, SOLID C Sprinter-2000
*/
#ifndef _C_TYPES_
#include <types.h>
#endif
#define S_IWRITE 0x01 /* owner may write */
#define S_IREAD 0x02 /* owner may read */
+13
View File
@@ -0,0 +1,13 @@
/*
* STDARG.H
*
* Definitions for accessing parameters in functions that
* accept a variable number of arguments.
* (c) 2004, SOLID C Sprinter-2000
*/
#ifndef __STDARG_
#define __STDARG_
typedef void *va_list; /* for vprintf's functions */
#endif
+117
View File
@@ -0,0 +1,117 @@
/*
* STDIO.H
*
* Definitions for stream input/output.
* (c) 2004, SOLID C Sprinter-2000
*/
#ifndef _C_TYPES_
#include <types.h>
#endif
#ifndef _STD_LIB_
#include <stdlib.h>
#endif
/* definition of the control structure for streams */
typedef struct {
uint flags; /* +0,1 file status flags */
int level; /* +2,3 empty/fill level of buffer */
char *curp; /* +4,5 current active pointer */
int fd; /* +6,7 file descriptor for low-level i/o */
char *buffer; /* +8,9 addr data transfer buffer */
char hold; /* +10 ungetc char if no buffer */
short token; /* +11,12 reserved */
char dummy; /* +13 reserved */
} FILE; /* this is the FILE object */
/* "flags" bits definitions */
#define _F_READ 0x0001 /* 0 read only file */
#define _F_WRIT 0x0002 /* 1 write only file */
#define _F_RDWR 0x0003 /* 0,1 read/write flag */
#define _F_BUF 0x0004 /* 2 malloc'ed Buffer data */
#define _F_LBUF 0x0008 /* 3 line-buffered file */
#define _F_ERR 0x0010 /* 4 error indicator */
#define _F_EOF 0x0020 /* 5 EOF indicator */
#define _F_BIN 0x0040 /* 6 binary file indicator */
#define _F_IN 0x0080 /* 7 data is incoming */
#define _F_OUT 0x0100 /* 0 +1 data is outgoing */
#define _F_TERM 0x0200 /* 1 +1 stdin stream */
#define EOF (-1) /* end of file indicator */
#define BUFSIZ 512 /* buffer size for high-level i/o */
#define OPEN_MAX 8 /* able to have 8 files */
extern FILE _iob[]; /* list of fcb */
/* standard I/O predefined streams */
#define stdin (&_iob[0])
#define stdout (&_iob[-1])
#define stderr (&_iob[-2])
#define stdaux (&_iob[-3])
#define stdprn (&_iob[-4])
/* for fgetpos, fsetpos functions */
typedef long fpos_t; /* file offset type */
#ifndef _STD_SEEK_
#define _STD_SEEK_
/* constants to be used as 3rd argument for "fseek" function */
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
#endif
/* Prototypes */
int printf(.);
int fprintf(.);
int sprintf(.);
int scanf(.);
int sscanf(.);
int fscanf(.);
void clearerr();
FILE *fdopen();
FILE *fopen();
FILE *freopen();
void fclosall();
char fclose();
size_t fread();
size_t fwrite();
struct fpoint *fseek();
struct fpoint *ftell();
char getc();
char putc();
char *gets();
char puts();
char *fgets();
char fputs();
char fgetc();
char fputc();
char ungetc();
char fflush();
void rewind();
char fgetpos();
char fsetpos();
/* The following macros provide for common functions */
#define fileno(a) ((a)->fd)
#define ferror(a) ((a)->flags & _F_ERR)
#define feof(a) ((a)->flags & _F_EOF)
#define fgetchar getc(stdin)
#define fputchar(c) putc((c),stdout)
+51
View File
@@ -0,0 +1,51 @@
/*
* STDLIB.H
*
* A header for a standart library CLIB.
* (c) 2004, SOLID C Sprinter-2000
*/
#ifndef _C_TYPES_
#include <types.h>
#endif
#ifndef _STD_LIB_
#define _STD_LIB_
char errno; /* must be declaration here */
/* for "div" function */
typedef struct divt {
uint quot; /* ç áâ­®¥ */
uint rem; /* ®áâ â®ª */
} div_t;
int abs();
int atoi();
int min();
int max();
int strtol();
int rand();
void *bsearch();
void qsort();
void srand();
void perror();
void exit();
void _exit();
void abort();
char atexit();
char *sysenv();
char *getenv();
uint putenv();
struct divt *div();
void hex8();
void hex16();
void hex32();
void dec8();
void dec16();
void dec32();
#endif
+33
View File
@@ -0,0 +1,33 @@
/*
* STRING.H
*
* String manipulation functions.
* (c) 2004, SOLID C Sprinter-2000
*/
#ifndef _C_TYPES_
#include <types.h>
#endif
void *memchr(); /* search for a character in memory block */
char *strcat();
char *strncat();
char *strchr();
int strcmp();
int strncmp();
char *strcpy();
char *strncpy();
size_t strcspn();
size_t strlen();
char *strlwr();
char *strpbrk();
char *strrchr();
size_t strspn();
char *strstr();
char *strtok();
char *strupr();
char *strerr();
#define strerror strerr;
+51
View File
@@ -0,0 +1,51 @@
/*
* TYPES.H
*
* General types definition for SOLID C.
* (c) 2004, SOLID C Sprinter-2000
*/
#ifndef _C_TYPES_
#define _C_TYPES_
typedef unsigned uint;
typedef char BYTE;
typedef char TINY;
typedef char BOOL;
typedef char STATUS;
typedef uint WORD;
typedef int FD; /* file discripter type */
/* for "seeks","tells" functions */
typedef struct fpoint {
uint low;
uint high;
} f_point;
typedef struct {
uint low;
uint high;
} LONG;
#define NULL 0
#define OK 0
#define EXIT_SUCCESS 0
#define EXIT_FAILURE 1
#define ERROR (-1)
#define FALSE 0
#define TRUE 1
#define YES 1
#define NO 0
#define FLOAT LONG
#ifndef _SIZE_T
#define _SIZE_T
typedef uint size_t;
#endif
#endif