From 3fd3454212dc1d4dc396e393812833ec2e15e41a Mon Sep 17 00:00:00 2001 From: user Date: Sat, 18 Jul 2026 00:46:26 +0200 Subject: kernel: dmesg-style boot spew before init spawns Print everything the kernel knows implicitly at boot, Linux-flavored, on the LCD console and mirrored over the link (gbhub logs each GB's boot): gbos sm83 microkernel console: CGB (boot a=$11) <- boot ROM's A/B, saved at entry cart: mbc5, 1M rom, 128K sram <- our own cart header ($0147-49) mem: 32K wram 16K vram 127B hram <- CGB constants proc: 8 slots, 31 programs <- link-time table sizes net: slip on link port, 4 sockets fs: gbfs v3 mounted, 120/128 blk free <- bitmap popcount; 'formatted' tty: 40x18 console, SELECT = osk on first boot init: spawning pid 1 New src/dmesg.asm with kernel print helpers (kputc/kputs/kputhex/kputdec) that bypass KPutc (no process context at boot). term_init now runs before net/fs init so the spew is visible as subsystems come up. --- src/boot.asm | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/boot.asm') diff --git a/src/boot.asm b/src/boot.asm index c29267d..c2d461a 100644 --- a/src/boot.asm +++ b/src/boot.asm @@ -41,12 +41,19 @@ SECTION "kinit", ROM0 KernelInit: di ld sp, KSTACK_TOP + push af ; boot ROM hands the console model in A/B - + push bc ; park it on the (uncleared) stack for dmesg ; enable cart RAM (MBC5) ld a, $0A ld [MBC5_RAM_ENABLE], a call ClearKernelRAM + pop bc + pop af + ld [wBootA], a + ld a, b + ld [wBootB], a call CopyHramCode ; move context-switch trampoline into HRAM call ProcInit ; wipe process table ; point wCurProc at the (zeroed) kernel PCB so disk I/O during boot restores @@ -56,11 +63,15 @@ KernelInit: ld a, HIGH(wKernelPCB) ld [wCurProc+1], a call pipe_init ; mark all pipes free + call term_init ; LCD console first, so the boot spew is visible + call boot_banner ; dmesg: kernel/console/cart/mem/proc lines call net_init ; clear the socket table, set our IP (10.0.0.2) + call boot_net call fs_init ; mount the disk (format on first boot; persists) - call term_init ; set up the LCD text terminal + call boot_fs call osk_init ; build the on-screen keyboard (window layer) - ; terminal starts blank; shell output flows in via KPutc + call boot_tty + call boot_init ; "init: spawning pid 1" ; --- spawn the init task (pid 1); it fork()s the rest --- ld hl, TaskInit -- cgit v1.3.1-sl0p