aboutsummaryrefslogtreecommitdiffstats
path: root/c/gbos.h
diff options
context:
space:
mode:
authoruser <user@clank>2026-07-16 07:21:40 +0200
committeruser <user@clank>2026-07-16 07:21:40 +0200
commit4335d248d18987a050d8ac26965c90718eef7562 (patch)
treee05038b2a21209281fd1c849c30145da9b7d77bc /c/gbos.h
parentC toolchain: run SDCC-compiled C programs as gbos processes (diff)
downloadgbos-4335d248d18987a050d8ac26965c90718eef7562.tar.gz
gbos-4335d248d18987a050d8ac26965c90718eef7562.tar.xz
gbos-4335d248d18987a050d8ac26965c90718eef7562.zip
libc + CLI tools: a small C userland
- libc: add putc, puts, strlen, getargs (args string), EOF (=4) for readc. - args: shell splits the command line at the first space ("cmd\0args\0" at $A000, inherited by the child via fork); getargs() returns the arg string. - shell: exit on Ctrl-D/EOF; $ prompt over a clean read loop. - tools (c/): echo (argv), cat (stdin->stdout to EOF), uname, pid (decimal print), true, false. Each built to a ROM-bank blob and registered. - Makefile: CBLOBS list builds all C programs. - README: document libc + the tool set.
Diffstat (limited to '')
-rw-r--r--c/gbos.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/c/gbos.h b/c/gbos.h
index 9a09a5d..3a10e06 100644
--- a/c/gbos.h
+++ b/c/gbos.h
@@ -1,9 +1,15 @@
-/* gbos userland C API (thin wrappers over rst $30 syscalls; see c/libc.asm) */
+/* gbos userland C API (thin wrappers over rst $30 syscalls; see c/libc.s) */
#ifndef GBOS_H
#define GBOS_H
-void writes(const char *buf, unsigned char len); /* write to console */
-void nl(void); /* newline (CRLF) */
-unsigned char readc(void); /* read one byte */
-void sexit(unsigned char code); /* exit(code) */
+#define EOF 4 /* readc() returns this at end of input */
+
+void writes(const char *buf, unsigned char len);
+void putc(char c);
+void puts(const char *s); /* write a NUL-terminated string */
+void nl(void); /* newline (CRLF) */
+unsigned char strlen(const char *s);
+char *getargs(void); /* this program's argument string */
+char readc(void); /* one input byte, EOF at end */
+void sexit(unsigned char code);
unsigned char getpid(void);
#endif