c71e249a4e
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>
107 lines
2.8 KiB
C
107 lines
2.8 KiB
C
/*
|
|
* sprinter_compat.h — Solid-C compatibility shims.
|
|
*
|
|
* Pulls in standard headers and adds aliases/macros that Solid-C
|
|
* programs expect. Programs targeting Sprinter from Solid-C source
|
|
* can `#include <sprinter_compat.h>` and most names "just work".
|
|
*/
|
|
|
|
#ifndef SPRINTER_COMPAT_H
|
|
#define SPRINTER_COMPAT_H
|
|
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
#include <string.h>
|
|
#include <ctype.h>
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <conio.h>
|
|
#include <mouse.h>
|
|
#include <errno.h>
|
|
#include <fcntl.h>
|
|
#include <unistd.h>
|
|
#include <dir.h>
|
|
#include <sprinter_exit.h> /* _exit, atexit */
|
|
|
|
/* ---- Solid-C types ----------------------------------------------- */
|
|
typedef uint8_t BYTE;
|
|
typedef uint8_t TINY;
|
|
typedef uint8_t BOOL;
|
|
typedef uint8_t STATUS;
|
|
typedef uint16_t WORD;
|
|
typedef int FD;
|
|
|
|
#ifndef TRUE
|
|
#define TRUE 1
|
|
#define FALSE 0
|
|
#define YES 1
|
|
#define NO 0
|
|
#endif
|
|
|
|
#ifndef OK
|
|
#define OK 0
|
|
#endif
|
|
|
|
#ifndef ERROR
|
|
#define ERROR (-1)
|
|
#endif
|
|
|
|
#ifndef EXIT_SUCCESS
|
|
#define EXIT_SUCCESS 0
|
|
#define EXIT_FAILURE 1
|
|
#endif
|
|
|
|
/* Solid-C's uint typedef (we expose it explicitly). Note `uint` may
|
|
* already be defined in some environments; guard. */
|
|
#ifndef _SOLID_UINT_DEFINED
|
|
#define _SOLID_UINT_DEFINED
|
|
typedef unsigned uint;
|
|
#endif
|
|
|
|
/* fpoint — 32-bit split file position (used by lseek/tell). */
|
|
typedef struct fpoint {
|
|
uint16_t low;
|
|
uint16_t high;
|
|
} f_point;
|
|
|
|
/* ---- string.h aliases -------------------------------------------- */
|
|
/* setmem(ptr, n, byte) → memset(ptr, byte, n) — arg order swapped */
|
|
#define setmem(p, n, b) memset((p), (b), (n))
|
|
/* movmem(src, dst, n) → memcpy(dst, src, n) — arg order swapped */
|
|
#define movmem(s, d, n) memcpy((d), (s), (n))
|
|
|
|
/* In-place case conversion. */
|
|
char *strlwr(char *s);
|
|
char *strupr(char *s);
|
|
|
|
/* Solid-C calls perror's table 'strerr'. */
|
|
#define strerr(n) strerror((n))
|
|
|
|
/* ---- stdlib.h additions ------------------------------------------ */
|
|
#define abort() _exit(0xFF)
|
|
|
|
#ifndef min
|
|
#define min(a, b) ((a) < (b) ? (a) : (b))
|
|
#endif
|
|
#ifndef max
|
|
#define max(a, b) ((a) > (b) ? (a) : (b))
|
|
#endif
|
|
|
|
/* div() and div_t come from SDCC's <stdlib.h> (already included above). */
|
|
|
|
/* sysenv() is now a real function (libc/io/env.c) that returns the WHOLE
|
|
* environment into a caller-provided buffer. Declared in <sprinter.h>. */
|
|
|
|
/* ---- ctype.h additions ------------------------------------------- */
|
|
#define isascii(c) (((unsigned)(c)) < 128)
|
|
|
|
/* ---- io.h aliases (Solid-C fd shortcuts) ------------------------- */
|
|
#define seek(fd, off) lseek((fd), (long)(off), SEEK_SET)
|
|
#define tell(fd) ((uint16_t)lseek((fd), 0, SEEK_CUR))
|
|
#define remove(name) unlink(name)
|
|
|
|
/* ---- dir.h alias ------------------------------------------------- */
|
|
#define _ffirst ffirst
|
|
|
|
#endif
|