aboutsummaryrefslogtreecommitdiffstats
BranchCommit messageAuthorAge
masterdemo: boot the SL0PBOY-forked BIOS in the README gifuser3 days
 
 
AgeCommit messageAuthorFilesLines
3 daysdemo: boot the SL0PBOY-forked BIOS in the README gifHEADmasteruser3-4/+6
3 daysterm+libc: batched write rendering - one tile render per write(), 2.3x linesuser5-10/+151
3 daysdemo: boot through the CGB BIOS + double-speed ROM in the README gifuser3-3/+10
3 dayskernel: CGB double-speed mode - 2x everything (1.99x measured)user4-6/+31
3 daysterm: latch SCY in VBlank - fix ring-scroll shear on live displaysuser4-6/+27
3 daysterm: SCY ring-scroll - scroll writes ONE map row; OSK toggle is 212 cyclesuser3-77/+112
3 daysterm: 3 more renderer wins - 10.9x scroll, 2.7x putc vs pre-cacheuser2-101/+144
3 daysterm: cache tile attrs in COL_BUF's spare stride bytes (3.5x scroll)user1-28/+38
3 daysdocs: drop the link-drop investigation writeupuser2-138/+0
3 dayshooks: clang-format pre-commit (changed lines only) + .clang-formatuser3-0/+69
3 daysdocs: concise README (networking + demo gif up front); internals.mduser2-344/+308
3 daystools: gbdemo - scripted, screen-synced demo driver (+ the README demo)user3-0/+353
3 daysterm: 7-color terminal (per-glyph fg+bg) + ANSI escapes; colorize ircuser9-91/+907
3 dayskernel: a real timer source (64 Hz tick IRQ) + uptime(1)user13-10/+132
4 dayskernel: dmesg-style boot spew before init spawnsuser5-2/+330
[...]
 
Clone
https://git.sl0p.foo/gbos.git
ssh://git@git.sl0p.foo:39327/srv/git/gbos.git

gbos

A tiny Unix-flavored OS for the Game Boy Color — a from-scratch cooperative microkernel with fork/exec, a shell with pipes, a persistent filesystem, a color terminal on the LCD, and a real TCP/IP stack over the link cable. It boots, gets a DHCP lease, pings, resolves DNS, fetches web pages, and hangs out on IRC. On a 1997 handheld (well, an emulated one).

gbos: boot, ping, IRC — all on a Game Boy Color

Real capture: cold boot → DHCP lease → ping → an IRC session, typed live into the on-screen console. Regenerate it anytime with tools/gbdemo (below).

What's in the box

  • Processes, the V7 way: fork/exec/wait/exit, zombies + reaping, background jobs (spin &), ps, kill — round-robin cooperative scheduling across banked memory with an HRAM context switch.
  • A shell (written in C, running on the GB) with I/O redirection (> <) and pipes (|), argument passing, and a cwd-aware prompt.
  • Networking, for real: the kernel owns SLIP over the link port, IPv4, ICMP, UDP and TCP; userland gets BSD-ish sockets via one syscall. On top: dhcp (boot-time lease), ping, nslookup (real DNS), wget (HTTP), chat, and a colorized IRC client (irc HOST [NICK], /join and friends, SELECT for the keyboard).
  • A network to plug into: tools/gbhub is a virtual switch + DHCP server + NAT gateway — spawn a fleet of Game Boys that ping each other and reach the real internet; tools/gbjoin attaches an interactive GB to it, and tools/gbtype types into any GB's shell from the host.
  • 40×18 color terminal on the LCD (4×8 font, two chars per tile, ANSI-ish colors) + an on-screen keyboard on the window layer (SELECT toggles it).
  • Persistent filesystem on battery-backed cart RAM: inodes, nested directories, per-process cwd — survives power-off.
  • A C toolchain: userland is plain C compiled with SDCC (sm83); ~30 tools ship in usr/ (cat, wc, head, ls, uptime, …). Adding a program is one .c file + a table entry.

Quick start

git config core.hooksPath hooks        # once: clang-format pre-commit hook
make                                   # -> gbos.gb  (needs RGBDS + SDCC)

# solo, in the sl0pboy emulator (~/dev/gbc):
~/dev/gbc/build/sl0pboy --sixel 3 --chrome gbos.gb

# networked — hub in one terminal, Game Boys in others:
sudo tools/gbhub --daemon              # virtual net + DHCP + NAT (needs root)
tools/gbjoin                           # a windowed GB joins 10.0.0.0/24
tools/gbtype 'ping 10.0.0.3'           # or type into it from the host

On the Game Boy: SELECT toggles the on-screen keyboard, d-pad + A types, START sends the line.

/# uname -a
gbos sm83 (Game Boy Color)
/# ping 10.0.0.1
PING 10.0.0.1
  reply from 10.0.0.1 seq=1
  ...
-- 4/4 received
/# irc 10.0.0.1 sl0pboy
-!- registering as sl0pboy (SELECT = keyboard)

The demo GIF

The GIF above is produced by a scripted, self-syncing demo driver: tools/gbdemo runs a step file (demo/readme.gbd), injects console text and button events at the right moments — syncing on the actual screen contents (the terminal's WRAM shadow, read over the emulator's debug socket) rather than timers — while the emulator records every frame, then renders the GIF:

sudo tools/gbhub --daemon              # network up (once)
tools/gbdemo demo/readme.gbd           # inside tmux; writes demo/gbos-demo.gif

Edit demo/readme.gbd to choreograph your own (verbs: type, slowtype, key, waitfor, record, gif, …).

Docs

  • docs/internals.md — the full technical breakdown: memory model, syscall ABI, fork/exec/context-switch internals, the network stack, the filesystem layout, C toolchain notes, war stories, roadmap.

Built and tested against the sl0pboy emulator; runs on anything that emulates a CGB + MBC5 cartridge with battery RAM. No MMU, no protection, no regrets.