Capsule blocks steps 3+4 for v4: capsules are placed in RAM and load their lowest block

Captain Bob ruled: Block n lands at n-R; the lowest block is
interpreted; chaining is the developer's; together, v4 first.
- v4_blocks_place_capsule copies each Block n into RAM block n - R as 16
  lines of 64, space-padded, in any file order. A later block of the
  same number overwrites. It refuses a block below R.
- The mesh's load(), its capsule reader (CAPSULE-OPEN/(LINES), so a
  child's forth79.4th via BIRTH too), boot.c and test_host_unit's model
  each place a capsule, then interpret "<lowest> LOAD".
- mkdictionary.py skips --> when it types capsules at the hosted prompt.
- The v4 capsules are renumbered into R..2R-1, landing at RAM 1900 and
  up, away from POST's blocks 0-5. Each is chained with -->, and
  centre.4th's gap at 8103 is closed.

Test first:
- test_host_blocks.c gained 6 placement checks; it failed to build
  before.
- test_mesh_boot.c checks forth79's lowest block in RAM block 1900; it
  failed before.

After: POST is 990/990; all 52 tests at 64 bits, test-32, hosted-check
and ASan/UBSan pass; the amd64 kernel builds; the dictionary has 404
words.

Logs are in logs/20261118-capsule-place.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RzZgrf7V7Zk2iczBXDRbm
This commit is contained in:
Claude
2026-11-18 20:33:21 +00:00
parent bcfca9fa19
commit 6dcfbe6740
27 changed files with 1399 additions and 97 deletions
+11
View File
@@ -85,4 +85,15 @@ void v4_blocks_init(v4_blocks *w, v4_cell window);
* its port, when this is called. */
int v4_blocks_serve(v4_blocks *w, v4_node *n, v4_cell request);
/* A CAPSULE OF FORTH BLOCKS, PLACED (docs/v4.0.0/plans/2026-11-18-capsule-blocks.md). Each
* `Block n` of the capsule text from p to end is copied into the kernel's RAM block n - R, where
* R is the RAM block count (BLK_RAM_USER_BLOCKS, v3/include/blk_layout.h), as 16 lines of 64
* characters padded with spaces -- in whatever order the file has them; a later block of the same
* number overwrites an earlier one. Where a block lands is the capsule's author's affair: nothing
* checks it but that n is at least R. The lowest block placed is in *lowest, which the loader
* interprets (`LOAD`); what runs after it is the capsule's own (`-->`, `LOAD`, `THRU`). Returns
* how many blocks were placed, or -1: a block below R, a line over 64 characters or more than 16
* lines, or a block storage would not give, in which case some may have been placed. */
int v4_blocks_place_capsule(const uint8_t *p, const uint8_t *end, uint32_t *lowest);
#endif /* V4_BLOCKS_H */