aboutsummaryrefslogtreecommitdiffstats
path: root/src/boot.asm
diff options
context:
space:
mode:
authoruser <user@clank>2026-07-18 00:46:26 +0200
committeruser <user@clank>2026-07-18 00:46:26 +0200
commit3fd3454212dc1d4dc396e393812833ec2e15e41a (patch)
treedf5888d9d7dcc377b5d8925b3cf05a3b56742318 /src/boot.asm
parentrefactor: c/ -> usr/, compiled program blobs out of the source tree (diff)
downloadgbos-3fd3454212dc1d4dc396e393812833ec2e15e41a.tar.gz
gbos-3fd3454212dc1d4dc396e393812833ec2e15e41a.tar.xz
gbos-3fd3454212dc1d4dc396e393812833ec2e15e41a.zip
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.
Diffstat (limited to 'src/boot.asm')
-rw-r--r--src/boot.asm15
1 files changed, 13 insertions, 2 deletions
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