aboutsummaryrefslogtreecommitdiffstats
path: root/src/programs.asm
diff options
context:
space:
mode:
authoruser <user@clank>2026-07-16 11:42:38 +0200
committeruser <user@clank>2026-07-16 11:42:38 +0200
commit057e5377af2d086917b9cd0ffb336231d7d098cb (patch)
treefd814d32d88a0eede32a69f45b729310b182e13a /src/programs.asm
parentjobs: background execution (&), non-blocking reap, spin demo (diff)
downloadgbos-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/programs.asm')
-rw-r--r--src/programs.asm7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/programs.asm b/src/programs.asm
index e83d29e..53142ec 100644
--- a/src/programs.asm
+++ b/src/programs.asm
@@ -97,6 +97,9 @@ ProgKill:
SECTION "prog_spin", ROMX[$4000], BANK[20]
ProgSpin:
INCBIN "c/spin.bin"
+SECTION "prog_blk", ROMX[$4000], BANK[21]
+ProgBlk:
+ INCBIN "c/blk.bin"
; -----------------------------------------------------------------------------
; PROG_SH (bank 3) - the shell, now written in C (c/sh.c): parses >/</| and
@@ -177,6 +180,8 @@ ProgramTable::
dw ProgKill
db LOW(BANK(ProgSpin)), HIGH(BANK(ProgSpin))
dw ProgSpin
+ db LOW(BANK(ProgBlk)), HIGH(BANK(ProgBlk))
+ dw ProgBlk
; -----------------------------------------------------------------------------
; NameTable (ROM0) - command name -> program id, searched by sys_lookup.
@@ -221,4 +226,6 @@ NameTable::
db PROG_KILL
db "spin", 0
db PROG_SPIN
+ db "blk", 0
+ db PROG_BLK
db 0