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
@@ -153,3 +153,45 @@ marker"):
The "kernel ROM image" is now "the next iso image that qemu runs with".
**Nothing is built.** When the SDK begins, the hook is to be designed against these lines.
## 6. Steps 3 and 4 for v4, built together (2026-11-18)
**Why together** (ruled "Together, v4 first"): v4's `-->` is error 14 outside a block load, so
capsule chaining added under the old line-streaming loader would have broken every boot.
**What is built:**
- **`v4_blocks_place_capsule`** (`v4/system/blocks.c`, `blocks.h`). Each `Block n` is copied to RAM
block `n - R` as 16 lines of 64 characters, padded with spaces, in any file order. A later block of
the same number overwrites. The lowest placed is given back, and a block below R is refused.
- **Every v4 loader places a capsule, then interprets `<lowest> LOAD`:**
- the mesh's `load()` (Hera's boot);
- the mesh's capsule reader (`CAPSULE-OPEN`/`(LINES)`, which is how `BIRTH` gives a child
`forth79.4th`);
- the hosted product's `boot.c`;
- `test_host_unit`'s model of the kernel.
`mkdictionary.py` types the capsules at the hosted prompt, and skips `-->` there.
- **The v4 capsules are renumbered into R..2R-1 and chained with `-->`.** They land at RAM 1900 and up,
away from POST's blocks 0–5:
| Capsule | Blocks |
|---|---|
| `forth79.4th` | 3948–3950 |
| `starshipos.4th` | 3956–3957 |
| `hera.4th` | 3960–3961 |
| `centre.4th` | 3964–3970 (it had a gap at 8103) |
| `physics.4th` | 3972–3976 |
**Test first:**
- `test_host_blocks.c` gained 6 placement checks (54 now). It failed to build before, with no
`v4_blocks_place_capsule`.
- `test_mesh_boot.c`: forth79.4th's lowest block is in RAM block 1900. It failed before, with block
1900 empty, and passes after (110 checks).
**Verified** (`logs/20261118-capsule-place/`):
- POST is 990/990;
- all 52 tests at 64 bits, test-32, `hosted-check` (three ISAs identical), and ASan/UBSan pass;
- the amd64 kernel builds;
- the dictionary check has 404 words, as before.
**v3's `INIT`** is the next step, as ruled.