<feed xmlns='http://www.w3.org/2005/Atom'>
<title>gbos.git/src/proc.asm, branch master</title>
<subtitle>gbos - a tiny Unix-flavored OS for the Game Boy Color (kernel, shell, coreutils in C, RAM filesystem)</subtitle>
<id>https://git.sl0p.foo/gbos.git/atom/src/proc.asm?h=master</id>
<link rel='self' href='https://git.sl0p.foo/gbos.git/atom/src/proc.asm?h=master'/>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/gbos.git/'/>
<updated>2026-07-16T10:49:19Z</updated>
<entry>
<title>fs rewrite stage 3: nested directories, paths, cwd (cd/mkdir/ls)</title>
<updated>2026-07-16T10:49:19Z</updated>
<author>
<name>user</name>
<email>user@clank</email>
</author>
<published>2026-07-16T10:49:19Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/gbos.git/commit/?id=5fefd233769a56caefdb2ffecaa9fb8b9ec6db86'/>
<id>urn:sha1:5fefd233769a56caefdb2ffecaa9fb8b9ec6db86</id>
<content type='text'>
- directories generalized: dir_find/dir_add/dir_remove take any dir inode;
  every dir carries '.'/'..'. Path resolution (resolve / resolve_parent) walks
  absolute or cwd-relative paths; open/mkdir/chdir/remove/opendir take paths.
- per-process cwd: PROC_CWD in the PCB (root by default, inherited on fork);
  sys_chdir sets it, sys_opendir points ls at any directory.
- shell: 'cd' builtin + cwd-aware prompt; 'mkdir'/'ls &lt;dir&gt;' tools; 'exit'/'quit'
  and EOF call poweroff() (clean shutdown via the $ED opcode -&gt; reliable save).
- three HL/buffer-clobber bugs fixed along the way: resolve didn't preserve the
  path cursor across dir_find; cur_cwd clobbered HL; resolve_parent set the final
  name before resolve() overwrote wFsNameBuf (now copied after).
- verified: nested mkdir/cd/save, multi-level paths (cat docs/sub/b), and the
  whole tree persists across a reboot.
- README: document directories + the poweroff opcode.
</content>
</entry>
<entry>
<title>kill + ps: implement SYS_KILL (pid 1 immortal) and a ps tool</title>
<updated>2026-07-16T09:10:45Z</updated>
<author>
<name>user</name>
<email>user@clank</email>
</author>
<published>2026-07-16T09:10:45Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/gbos.git/commit/?id=2d3597c3a02f821bb364b8ecc23fc5949fca738d'/>
<id>urn:sha1:2d3597c3a02f821bb364b8ecc23fc5949fca738d</id>
<content type='text'>
- PCB gains PROC_PROG (running program id), set by exec, inherited on fork.
- sys_kill(pid): reject pid 1 (immortal) and unknown/dead pids; mark the target
  zombie, reparent its children to init, wake its parent if blocked in wait;
  schedule away if a process kills itself. Reuses FindPcbByPid/ReparentToInit.
- sys_ps(slot,buf)-&gt;{pid,state,prog}; sys_progname(id) via NameTable reverse
  lookup. NameTable gains sh/ps/kill.
- libc: kill/psget/progname; tools ps (pid state cmd) and kill &lt;pid&gt;.
- verified: ps lists sh(B)+ps(R); kill 1 refused; kill 42 fails.
</content>
</entry>
<entry>
<title>shell: I/O redirection (&gt;/&lt;) and pipes (|); rewrite shell in C</title>
<updated>2026-07-16T06:25:35Z</updated>
<author>
<name>user</name>
<email>user@clank</email>
</author>
<published>2026-07-16T06:25:35Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/gbos.git/commit/?id=6c64d97e70984c77be3cd8d4e03e9adf717e02fb'/>
<id>urn:sha1:6c64d97e70984c77be3cd8d4e03e9adf717e02fb</id>
<content type='text'>
- kernel I/O routing: PCB gains PROC_STDIN/PROC_STDOUT (default console $FF),
  inherited across fork. KGetc/KPutc route read/write/putc to the console or a
  file fd. New syscalls: putc(16), setin(17), setout(18), lookup(19).
  read/write now go through the routing; putc/puts/nl use SYS_PUTC.
- sys_lookup + NameTable move command-name resolution into the kernel.
- shell rewritten in C (c/sh.c): tokenizes a line, parses &gt; / &lt; / |, and drives
  fork+setin/setout+exec+wait. Pipes run as 'a &gt; __pipe ; b &lt; __pipe' (temp
  file). asm shell + cmdtab removed; StrEqual/SkipName kept for sys_lookup.
- libc: fork/exec/wait/setin/setout/lookup wrappers.
- verified: echo&gt;file, cat file, wc&lt;file, cat readme|wc -l, echo ...|wc.
</content>
</entry>
<entry>
<title>kernel: complete the process lifecycle (exit/wait/reap + bank free list)</title>
<updated>2026-07-15T22:12:43Z</updated>
<author>
<name>user</name>
<email>user@clank</email>
</author>
<published>2026-07-15T22:12:43Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/gbos.git/commit/?id=19a2b63bab71b796ee456b3ae8bec1a2ab297158'/>
<id>urn:sha1:19a2b63bab71b796ee456b3ae8bec1a2ab297158</id>
<content type='text'>
- exit(): zombie + status, reparent orphans to init, wake blocked parent,
  schedule away forever (resources reclaimed by the reaper)
- wait(): scan for a zombie child; reap (free cart-RAM bank + PCB slot) and
  return pid/code; block PS_BLOCKED + yield if children still live; $FF if none
- cart-RAM banks are now a free list (wBankUsed bitmap): AllocRamBank/FreeRamBank
- scheduler: FindNextReady returns carry when nothing runnable; yield idles
  instead of blindly picking slot 0
- helpers: FindPcbByPid, ReparentToInit
- demo: init forks 3 workers -&gt; exec -&gt; exit(pid) -&gt; wait/reap =&gt; wwwR2R3R4!
  verified bank recycling with 6 workers over 3 banks (w2w3w4w5w6w7)
- README: document the lifecycle + syscall status
</content>
</entry>
<entry>
<title>kernel: implement exec()</title>
<updated>2026-07-15T22:04:09Z</updated>
<author>
<name>user</name>
<email>user@clank</email>
</author>
<published>2026-07-15T22:04:09Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/gbos.git/commit/?id=0a77a11e17f697bf797655c4ae87b927432b1f88'/>
<id>urn:sha1:0a77a11e17f697bf797655c4ae87b927432b1f88</id>
<content type='text'>
- sys_exec(B=program id): look up ProgramTable, point PROC_ROMB at the program's
  ROM text bank, map it into $4000-$7FFF, reset stack, jp to entry (no return)
- programs.asm: two demo programs (ping/pong) ORG'd at the SAME $4000 in banks
  2 and 3 - proves execution is driven purely by PROC_ROMB
- demo: init forks; parent execs PROG_PING (bank2, '1'), child execs PROG_PONG
  (bank3, '2') -&gt; '1212...', 2000/2000 balanced, zero garbage
- README: document exec + text-in-ROM model
</content>
</entry>
<entry>
<title>kernel: implement fork()</title>
<updated>2026-07-15T21:54:13Z</updated>
<author>
<name>user</name>
<email>user@clank</email>
</author>
<published>2026-07-15T21:54:13Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/gbos.git/commit/?id=ab3ebbe227c72b745a46f9233fbfbb27477586b8'/>
<id>urn:sha1:ab3ebbe227c72b745a46f9233fbfbb27477586b8</id>
<content type='text'>
- sys_fork: switch to a kernel stack, bump-allocate a cart-RAM bank, copy the
  parent's 8 KiB bank via a WRAM bounce buffer, plant a switch-in frame so the
  child returns 0 to the post-fork PC, fill the child PCB (shared ROM text)
- add AllocRamBank (bump allocator) + FindFreeSlot helpers
- demo: init forks; parent prints P, child prints C (PCPC...); nested fork
  gives three distinct pids (123...)
- README: document the fork mechanism, mark syscall status
</content>
</entry>
<entry>
<title>gbos scaffold: working cooperative microkernel (verified ABAB in emulator)</title>
<updated>2026-07-15T21:44:28Z</updated>
<author>
<name>user</name>
<email>user@clank</email>
</author>
<published>2026-07-15T21:44:28Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/gbos.git/commit/?id=de725da74db5cba0f9bfd0755269e1683423d87b'/>
<id>urn:sha1:de725da74db5cba0f9bfd0755269e1683423d87b</id>
<content type='text'>
- fix ClearKernelRAM clobbering the kernel stack (only clear $C000-$CBFF)
- fix SyscallTrap clobbering DE (buffer arg) during table dispatch
- README: run via ~/dev/gbc --headless; note bring-up bugs
</content>
</entry>
</feed>
