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
31 lines
1.2 KiB
Forth
31 lines
1.2 KiB
Forth
Block 3948
|
|
( forth79.4th -- the FORTH-79 Required Word Set for v4, )
|
|
( as colon definitions, loaded when the system boots. )
|
|
( docs/v4.0.0/NUCLEUS.md. Blocks 3948 up. )
|
|
( A word moves here from the assembled nucleus, v4/capsule, )
|
|
( once its colon definition passes POST. )
|
|
-->
|
|
Block 3949
|
|
( U* U/MOD -- FORTH-79 unsigned multiply and divide. )
|
|
( Neither v3 nor the v4 nucleus had them. )
|
|
( The first two words count the bits in a cell. )
|
|
: (BITS) ( -- n )
|
|
0 1 BEGIN DUP WHILE 2* SWAP 1+ SWAP REPEAT DROP ;
|
|
(BITS) CONSTANT (NB)
|
|
VARIABLE (UD)
|
|
( u1 u2 -- ud the unsigned double product )
|
|
: U* UM* ;
|
|
-->
|
|
Block 3950
|
|
( ud u1 -- u2 u3 unsigned: u2 the remainder, u3 the quotient )
|
|
( One bit a step: shift ud left, and take u1 from its high )
|
|
( cell whenever it goes, counting that in the low cell. )
|
|
( A zero divisor is error 11, Division by zero. )
|
|
: U/MOD
|
|
DUP 0= IF DROP DROP DROP 11 NODE-ERROR ! THEN (UD) !
|
|
(NB) 0 DO
|
|
DUP 0< >R 2* OVER 0< IF 1+ THEN SWAP 2* SWAP
|
|
R> IF (UD) @ - SWAP 1+ SWAP
|
|
ELSE DUP (UD) @ U< 0= IF (UD) @ - SWAP 1+ SWAP THEN THEN
|
|
LOOP SWAP ;
|