aboutsummaryrefslogtreecommitdiffstats
path: root/usr
diff options
context:
space:
mode:
authoruser <user@clank>2026-07-18 00:38:38 +0200
committeruser <user@clank>2026-07-18 00:38:38 +0200
commitba2d7ae1d7b319645b10aaa31a7f664f9f80c25c (patch)
treee01e6c7c710a661defe2515ff9657f08cddcb283 /usr
parenttools: gbtype prints hub errors to stderr and exits 1 (diff)
downloadgbos-ba2d7ae1d7b319645b10aaa31a7f664f9f80c25c.tar.gz
gbos-ba2d7ae1d7b319645b10aaa31a7f664f9f80c25c.tar.xz
gbos-ba2d7ae1d7b319645b10aaa31a7f664f9f80c25c.zip
refactor: c/ -> usr/, compiled program blobs out of the source tree
Userland sources live in usr/ (fits the Unix theme better than 'c'). SDCC output .bin blobs land in build/usr/ with the other build artifacts instead of littering the source dir; programs.asm INCBINs them from there. Byte-identical ROM.
Diffstat (limited to '')
-rw-r--r--usr/args.c (renamed from c/args.c)0
-rw-r--r--usr/blk.c (renamed from c/blk.c)0
-rwxr-xr-xusr/build.sh (renamed from c/build.sh)14
-rw-r--r--usr/cat.c (renamed from c/cat.c)0
-rw-r--r--usr/chat.c (renamed from c/chat.c)0
-rw-r--r--usr/chello.c (renamed from c/chello.c)0
-rw-r--r--usr/count.c (renamed from c/count.c)0
-rw-r--r--usr/crt0.s (renamed from c/crt0.s)0
-rw-r--r--usr/dhcp.c (renamed from c/dhcp.c)0
-rw-r--r--usr/echo.c (renamed from c/echo.c)0
-rw-r--r--usr/false.c (renamed from c/false.c)0
-rw-r--r--usr/gbos.h (renamed from c/gbos.h)0
-rw-r--r--usr/head.c (renamed from c/head.c)0
-rw-r--r--usr/irc.c (renamed from c/irc.c)0
-rw-r--r--usr/kill.c (renamed from c/kill.c)0
-rw-r--r--usr/libc.c (renamed from c/libc.c)0
-rw-r--r--usr/libc.s (renamed from c/libc.s)0
-rw-r--r--usr/ls.c (renamed from c/ls.c)0
-rw-r--r--usr/mkdir.c (renamed from c/mkdir.c)0
-rw-r--r--usr/necho.c (renamed from c/necho.c)0
-rw-r--r--usr/netd.c (renamed from c/netd.c)0
-rw-r--r--usr/netlib.h (renamed from c/netlib.h)0
-rw-r--r--usr/nslookup.c (renamed from c/nslookup.c)0
-rw-r--r--usr/pid.c (renamed from c/pid.c)0
-rw-r--r--usr/ping.c (renamed from c/ping.c)0
-rw-r--r--usr/ps.c (renamed from c/ps.c)0
-rw-r--r--usr/ptest.c (renamed from c/ptest.c)0
-rw-r--r--usr/resolve.h (renamed from c/resolve.h)0
-rw-r--r--usr/rm.c (renamed from c/rm.c)0
-rw-r--r--usr/save.c (renamed from c/save.c)0
-rw-r--r--usr/sh.c (renamed from c/sh.c)0
-rw-r--r--usr/sock.h (renamed from c/sock.h)0
-rw-r--r--usr/spin.c (renamed from c/spin.c)0
-rw-r--r--usr/true.c (renamed from c/true.c)0
-rw-r--r--usr/uname.c (renamed from c/uname.c)0
-rw-r--r--usr/wc.c (renamed from c/wc.c)0
-rw-r--r--usr/wget.c (renamed from c/wget.c)0
37 files changed, 7 insertions, 7 deletions
diff --git a/c/args.c b/usr/args.c
index c6f4db3..c6f4db3 100644
--- a/c/args.c
+++ b/usr/args.c
diff --git a/c/blk.c b/usr/blk.c
index 36839c0..36839c0 100644
--- a/c/blk.c
+++ b/usr/blk.c
diff --git a/c/build.sh b/usr/build.sh
index 8034d87..93815d2 100755
--- a/c/build.sh
+++ b/usr/build.sh
@@ -1,15 +1,15 @@
#!/bin/sh
# Build a gbos C program into a self-contained 16 KiB ROM-bank image.
# SDCC native toolchain; crt0 linked FIRST so _start is the $4000 entry.
-# usage: c/build.sh <prog.c> <out.bin>
+# usage: usr/build.sh <prog.c> <out.bin> (run from the repo root)
set -e
-SRC="$1"; OUT="$2"; B=build/c
+SRC="$1"; OUT="$2"; B=build/usr/obj
LIBDIR=/usr/share/sdcc/lib/sm83
-mkdir -p "$B"
-sdasgb -o "$B/crt0.rel" c/crt0.s
-sdasgb -o "$B/libc.rel" c/libc.s
-sdcc -msm83 -c -Ic c/libc.c -o "$B/libc_c.rel"
-sdcc -msm83 -c -Ic "$SRC" -o "$B/prog.rel"
+mkdir -p "$B" "$(dirname "$OUT")"
+sdasgb -o "$B/crt0.rel" usr/crt0.s
+sdasgb -o "$B/libc.rel" usr/libc.s
+sdcc -msm83 -c -Iusr usr/libc.c -o "$B/libc_c.rel"
+sdcc -msm83 -c -Iusr "$SRC" -o "$B/prog.rel"
# link: crt0 first (=> _start at 0x4000), then libc, program, and sm83 lib
sdldgb -n -m -w -j -i "$B/prog.ihx" \
-b _CODE=0x4000 -b _DATA=0xa000 \
diff --git a/c/cat.c b/usr/cat.c
index 790cb88..790cb88 100644
--- a/c/cat.c
+++ b/usr/cat.c
diff --git a/c/chat.c b/usr/chat.c
index 987b336..987b336 100644
--- a/c/chat.c
+++ b/usr/chat.c
diff --git a/c/chello.c b/usr/chello.c
index f570b61..f570b61 100644
--- a/c/chello.c
+++ b/usr/chello.c
diff --git a/c/count.c b/usr/count.c
index 37cdcce..37cdcce 100644
--- a/c/count.c
+++ b/usr/count.c
diff --git a/c/crt0.s b/usr/crt0.s
index 0d8371f..0d8371f 100644
--- a/c/crt0.s
+++ b/usr/crt0.s
diff --git a/c/dhcp.c b/usr/dhcp.c
index e4186f4..e4186f4 100644
--- a/c/dhcp.c
+++ b/usr/dhcp.c
diff --git a/c/echo.c b/usr/echo.c
index f8d5125..f8d5125 100644
--- a/c/echo.c
+++ b/usr/echo.c
diff --git a/c/false.c b/usr/false.c
index a124951..a124951 100644
--- a/c/false.c
+++ b/usr/false.c
diff --git a/c/gbos.h b/usr/gbos.h
index 2350665..2350665 100644
--- a/c/gbos.h
+++ b/usr/gbos.h
diff --git a/c/head.c b/usr/head.c
index 3298e54..3298e54 100644
--- a/c/head.c
+++ b/usr/head.c
diff --git a/c/irc.c b/usr/irc.c
index 250738a..250738a 100644
--- a/c/irc.c
+++ b/usr/irc.c
diff --git a/c/kill.c b/usr/kill.c
index e524627..e524627 100644
--- a/c/kill.c
+++ b/usr/kill.c
diff --git a/c/libc.c b/usr/libc.c
index a48a64c..a48a64c 100644
--- a/c/libc.c
+++ b/usr/libc.c
diff --git a/c/libc.s b/usr/libc.s
index 5b176d9..5b176d9 100644
--- a/c/libc.s
+++ b/usr/libc.s
diff --git a/c/ls.c b/usr/ls.c
index 0e2e01f..0e2e01f 100644
--- a/c/ls.c
+++ b/usr/ls.c
diff --git a/c/mkdir.c b/usr/mkdir.c
index c907518..c907518 100644
--- a/c/mkdir.c
+++ b/usr/mkdir.c
diff --git a/c/necho.c b/usr/necho.c
index 99551d4..99551d4 100644
--- a/c/necho.c
+++ b/usr/necho.c
diff --git a/c/netd.c b/usr/netd.c
index b07abd2..b07abd2 100644
--- a/c/netd.c
+++ b/usr/netd.c
diff --git a/c/netlib.h b/usr/netlib.h
index ec98eac..ec98eac 100644
--- a/c/netlib.h
+++ b/usr/netlib.h
diff --git a/c/nslookup.c b/usr/nslookup.c
index 6a531b8..6a531b8 100644
--- a/c/nslookup.c
+++ b/usr/nslookup.c
diff --git a/c/pid.c b/usr/pid.c
index 9e4e792..9e4e792 100644
--- a/c/pid.c
+++ b/usr/pid.c
diff --git a/c/ping.c b/usr/ping.c
index 8671318..8671318 100644
--- a/c/ping.c
+++ b/usr/ping.c
diff --git a/c/ps.c b/usr/ps.c
index 7bfc0de..7bfc0de 100644
--- a/c/ps.c
+++ b/usr/ps.c
diff --git a/c/ptest.c b/usr/ptest.c
index 88b7d30..88b7d30 100644
--- a/c/ptest.c
+++ b/usr/ptest.c
diff --git a/c/resolve.h b/usr/resolve.h
index 9aaccc1..9aaccc1 100644
--- a/c/resolve.h
+++ b/usr/resolve.h
diff --git a/c/rm.c b/usr/rm.c
index 25f3004..25f3004 100644
--- a/c/rm.c
+++ b/usr/rm.c
diff --git a/c/save.c b/usr/save.c
index 1755fea..1755fea 100644
--- a/c/save.c
+++ b/usr/save.c
diff --git a/c/sh.c b/usr/sh.c
index 3178894..3178894 100644
--- a/c/sh.c
+++ b/usr/sh.c
diff --git a/c/sock.h b/usr/sock.h
index 876e85c..876e85c 100644
--- a/c/sock.h
+++ b/usr/sock.h
diff --git a/c/spin.c b/usr/spin.c
index 2a3d4e8..2a3d4e8 100644
--- a/c/spin.c
+++ b/usr/spin.c
diff --git a/c/true.c b/usr/true.c
index 4cf437e..4cf437e 100644
--- a/c/true.c
+++ b/usr/true.c
diff --git a/c/uname.c b/usr/uname.c
index 511501d..511501d 100644
--- a/c/uname.c
+++ b/usr/uname.c
diff --git a/c/wc.c b/usr/wc.c
index 4fa48ee..4fa48ee 100644
--- a/c/wc.c
+++ b/usr/wc.c
diff --git a/c/wget.c b/usr/wget.c
index aafbae0..aafbae0 100644
--- a/c/wget.c
+++ b/usr/wget.c