From 0a77a11e17f697bf797655c4ae87b927432b1f88 Mon Sep 17 00:00:00 2001 From: user Date: Thu, 16 Jul 2026 00:04:09 +0200 Subject: 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 --- include/gbos.inc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') 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 -- cgit v1.3.1-sl0p