| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
| |
- 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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
- c/{gbos.h,crt0.s,libc.s,build.sh}: SDCC sm83 -> ROM-bank blob toolchain.
libc syscall wrappers save/restore BC/DE/HL around rst $30 (trap clobbers
them; SDCC expects them preserved).
- build via SDCC native asxxxx path (sdasgb/sdldgb), crt0 linked first so
_start is the $4000 entry; blob INCBIN'd into a ROM bank.
- chello.c: prints a message + getpid() -> runs as 'chello' shell command.
- Makefile: auto-build c/*.bin, track as a dep of programs.o; gitignore blobs.
- README: document the C toolchain + the SDCC --asm=rgbds codegen bug that
forced the native-toolchain approach.
- verified: '$ chello' -> 'hello from C on gbos!' / 'my pid is 2'.
|
| |
|
|
|
|
|
|
|
|
|
| |
- root cause of the read/echo corruption: SyscallTrap uses HL to index the
dispatch table, so HL is clobbered across a syscall; the shell then wrote its
buffer pointer's garbage into the $0000-$7FFF MBC register region, corrupting
the mapper. fix: userland saves HL around sys_read (push/pop).
- shell now runs commands end to end: $ hello -> hello world!, $ worker ->
worker!, $ foo -> ?
- README: document that syscalls clobber BC/DE/HL (return in A, B for wait);
add read + shell to the syscall table.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
- sys_read (SYS_READ): blocking console input via external-clock serial poll;
yields while waiting. Verified working (direct-echo cat: 'hi' -> 'hi').
- shell (PROG_SH): prompt/read/parse/fork+exec+wait; worker+hello programs;
StrEqual/SkipName helpers; command table.
- init now execs the shell.
- KNOWN BUG: storing the typed char to the line buffer at $A000 (cart RAM of an
exec'd program) corrupts the following sys_read; sys_write reading $A000 also
returns $3E. Kernel syscalls themselves are correct; isolating the cart-RAM /
exec RAM-bank interaction next.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
- 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 -> exec -> exit(pid) -> wait/reap => wwwR2R3R4!
verified bank recycling with 6 workers over 3 banks (w2w3w4w5w6w7)
- README: document the lifecycle + syscall status
|
| |
|
|
|
|
|
|
|
|
| |
- 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') -> '1212...', 2000/2000 balanced, zero garbage
- README: document exec + text-in-ROM model
|
| |
|
|
|
|
|
|
|
|
| |
- 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
|
|
|
- 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
|