aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md20
1 files changed, 10 insertions, 10 deletions
diff --git a/README.md b/README.md
index a968e4a..ea574bb 100644
--- a/README.md
+++ b/README.md
@@ -58,7 +58,7 @@ across a syscall (`push hl` / `pop hl`). Libc syscall stubs handle this for C.
| 2 | read | ✅ blocking console input (1 byte) via external-clock serial |
| 4,5,9,10 | open/close/kill/brk | ⛔ `ENOSYS` |
-### The shell (`c/sh.c`)
+### The shell (`usr/sh.c`)
init `exec`s the shell (written in C). It reads a line, tokenizes it, and runs
commands with **I/O redirection and pipes**:
@@ -183,15 +183,15 @@ A real gbos would render to VRAM; serial is the zero-VRAM debug channel.
## Writing programs in C
gbos programs can be written in **C**, compiled with **SDCC** (the `sm83` port).
-This makes porting tiny Unix CLI tools realistic. The toolchain (`c/`):
+This makes porting tiny Unix CLI tools realistic. The toolchain (`usr/`):
-- `c/gbos.h` — the userland API (`writes`, `readc`, `nl`, `getpid`, `sexit`).
-- `c/libc.s` — syscall wrappers (asxxxx asm). Each saves
+- `usr/gbos.h` — the userland API (`writes`, `readc`, `nl`, `getpid`, `sexit`).
+- `usr/libc.s` — syscall wrappers (asxxxx asm). Each saves
`BC/DE/HL` around `rst $30`, since the trap clobbers them but SDCC expects
them preserved.
-- `c/crt0.s` — entry: `call main`; then `exit(0)`. Linked first so `_start` is
+- `usr/crt0.s` — entry: `call main`; then `exit(0)`. Linked first so `_start` is
the `$4000` entry.
-- `c/build.sh` — compiles a `.c` with SDCC's **native** toolchain
+- `usr/build.sh` — compiles a `.c` with SDCC's **native** toolchain
(`sdasgb` + `sdldgb`), links code at `$4000`, and extracts the ROM-bank blob.
The Makefile INCBINs it and registers it as a program.
@@ -206,9 +206,9 @@ void main(void) {
### libc
-Syscall wrappers (`c/libc.s`): `writes`, `putc`, `puts`, `nl`, `strlen`, `readc`
+Syscall wrappers (`usr/libc.s`): `writes`, `putc`, `puts`, `nl`, `strlen`, `readc`
(returns `EOF`=4 at end of input), `getargs` (this program's argument string),
-`getpid`, `sexit`. C helpers (`c/libc.c`, linked into every program): `putu`
+`getpid`, `sexit`. C helpers (`usr/libc.c`, linked into every program): `putu`
(print decimal), `atou` (parse decimal), `argv_parse` (tokenize into argc/argv).
Arguments: the shell splits the command line at the first space and leaves
@@ -220,7 +220,7 @@ char *argv[8];
unsigned char argc = argv_parse(argv, 8); /* args one two -> argc=3 */
```
-### CLI tools (in `c/`)
+### CLI tools (in `usr/`)
| tool | what it does |
|------|--------------|
@@ -254,7 +254,7 @@ alpha
beta
```
-Each tool is a separate `c/<name>.c`, built to a ROM-bank blob, INCBIN'd, and
+Each tool is a separate `usr/<name>.c`, built to a ROM-bank blob, INCBIN'd, and
registered in the program table + shell command table (`src/programs.asm`).
**Toolchain gotchas found the hard way:** SDCC's `--asm=rgbds` mode mis-orders