aboutsummaryrefslogtreecommitdiffstats
path: root/c/crt0.s
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/crt0.s
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 'c/crt0.s')
-rw-r--r--c/crt0.s6
1 files changed, 3 insertions, 3 deletions
diff --git a/c/crt0.s b/c/crt0.s
index cde4b67..0d8371f 100644
--- a/c/crt0.s
+++ b/c/crt0.s
@@ -1,11 +1,11 @@
.module crt0
.globl _main
- ;; gbos C entry. exec() maps our ROM bank and jumps to the start of _CODE
- ;; (linked at 0x4000). Call main(), then exit(0). exec() already set SP.
+ ;; gbos C entry. exec() maps our ROM bank and jumps here ($4000).
+ ;; Call main(), then exit(0). (Args are fetched on demand via getargs().)
.area _CODE
_start::
call _main
ld b, #0
- ld c, #0 ; SYS_EXIT
+ ld c, #0 ; SYS_EXIT
rst #0x30
1$: jr 1$