diff options
| author | user <user@clank> | 2026-07-16 00:04:09 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-07-16 00:04:09 +0200 |
| commit | 0a77a11e17f697bf797655c4ae87b927432b1f88 (patch) | |
| tree | 97cafaa103aec412f692daff9e068fc63f0496bf /include/gbos.inc | |
| parent | kernel: implement fork() (diff) | |
| download | gbos-0a77a11e17f697bf797655c4ae87b927432b1f88.tar.gz gbos-0a77a11e17f697bf797655c4ae87b927432b1f88.tar.xz gbos-0a77a11e17f697bf797655c4ae87b927432b1f88.zip | |
kernel: implement exec()
- 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
Diffstat (limited to '')
| -rw-r--r-- | include/gbos.inc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/gbos.inc b/include/gbos.inc index 0727b02..e15f7cb 100644 --- a/include/gbos.inc +++ b/include/gbos.inc @@ -85,4 +85,10 @@ DEF SYS_BRK EQU 10 DEF SYS_YIELD EQU 11 DEF SYS_MAX EQU 12 +; ----------------------------------------------------------------------------- +; Program table indices (see programs.asm). exec() takes one of these in B. +; ----------------------------------------------------------------------------- +DEF PROG_PING EQU 0 +DEF PROG_PONG EQU 1 + ENDC |
