From 5fefd233769a56caefdb2ffecaa9fb8b9ec6db86 Mon Sep 17 00:00:00 2001 From: user Date: Thu, 16 Jul 2026 12:49:19 +0200 Subject: fs rewrite stage 3: nested directories, paths, cwd (cd/mkdir/ls) - directories generalized: dir_find/dir_add/dir_remove take any dir inode; every dir carries '.'/'..'. Path resolution (resolve / resolve_parent) walks absolute or cwd-relative paths; open/mkdir/chdir/remove/opendir take paths. - per-process cwd: PROC_CWD in the PCB (root by default, inherited on fork); sys_chdir sets it, sys_opendir points ls at any directory. - shell: 'cd' builtin + cwd-aware prompt; 'mkdir'/'ls ' tools; 'exit'/'quit' and EOF call poweroff() (clean shutdown via the $ED opcode -> reliable save). - three HL/buffer-clobber bugs fixed along the way: resolve didn't preserve the path cursor across dir_find; cur_cwd clobbered HL; resolve_parent set the final name before resolve() overwrote wFsNameBuf (now copied after). - verified: nested mkdir/cd/save, multi-level paths (cat docs/sub/b), and the whole tree persists across a reboot. - README: document directories + the poweroff opcode. --- src/programs.asm | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/programs.asm') diff --git a/src/programs.asm b/src/programs.asm index 53142ec..64efc4d 100644 --- a/src/programs.asm +++ b/src/programs.asm @@ -100,6 +100,9 @@ ProgSpin: SECTION "prog_blk", ROMX[$4000], BANK[21] ProgBlk: INCBIN "c/blk.bin" +SECTION "prog_mkdir", ROMX[$4000], BANK[22] +ProgMkdir: + INCBIN "c/mkdir.bin" ; ----------------------------------------------------------------------------- ; PROG_SH (bank 3) - the shell, now written in C (c/sh.c): parses >/ program id, searched by sys_lookup. @@ -228,4 +233,6 @@ NameTable:: db PROG_SPIN db "blk", 0 db PROG_BLK + db "mkdir", 0 + db PROG_MKDIR db 0 -- cgit v1.3.1-sl0p