diff options
| author | user <user@clank> | 2026-07-16 11:42:38 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-07-16 11:42:38 +0200 |
| commit | 057e5377af2d086917b9cd0ffb336231d7d098cb (patch) | |
| tree | fd814d32d88a0eede32a69f45b729310b182e13a /src/boot.asm | |
| parent | jobs: background execution (&), non-blocking reap, spin demo (diff) | |
| download | gbos-057e5377af2d086917b9cd0ffb336231d7d098cb.tar.gz gbos-057e5377af2d086917b9cd0ffb336231d7d098cb.tar.xz gbos-057e5377af2d086917b9cd0ffb336231d7d098cb.zip | |
fs rewrite stage 1: persistent block device (bounce buffer, cart SRAM)
- blk.asm: read_block/write_block move 256-byte blocks between battery-backed
cart-RAM banks (8-11, the 'disk') and a WRAM bounce buffer. Banking is hidden
in those two routines; they inline the 'restore my bank' step so they never
touch the stack while the disk bank is mapped over the process's $A000 window
(the stack lives there too -- a call/ret would rug-pull it).
- format-on-first-boot: superblock magic in block 0; otherwise the disk persists.
- cart RAM bumped to 128 KiB (-r 4); process banks 0-7, disk banks 8-11.
- debug tool 'blk fill/peek' + syscalls to validate round-trip and persistence.
- verified: round-trip incl. cross-bank (block 100 -> bank 11); block survives a
reboot via .sav; magic intact (no reformat on 2nd boot).
- old WRAM 8-slot FS still backs the tools until stages 2-3.
Diffstat (limited to 'src/boot.asm')
| -rw-r--r-- | src/boot.asm | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/boot.asm b/src/boot.asm index 7c175ce..1f4a048 100644 --- a/src/boot.asm +++ b/src/boot.asm @@ -49,7 +49,14 @@ KernelInit: call ClearKernelRAM call CopyHramCode ; move context-switch trampoline into HRAM call ProcInit ; wipe process table - call fs_init ; set up the RAM filesystem + ; point wCurProc at the (zeroed) kernel PCB so disk I/O during boot restores + ; RAM bank 0 after each block transfer (wKernelPCB.PROC_RAMB = 0). + ld a, LOW(wKernelPCB) + ld [wCurProc], a + ld a, HIGH(wKernelPCB) + ld [wCurProc+1], a + call blk_init ; format the disk if needed (persists otherwise) + call fs_init ; (legacy WRAMX filesystem, still used by tools) ; --- spawn the init task (pid 1); it fork()s the rest --- ld hl, TaskInit |
