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:
+13
-7
@@ -1,4 +1,4 @@
|
||||
Block 8100
|
||||
Block 3964
|
||||
( centre.4th -- what a node that births others needs. )
|
||||
( docs/v4.0.0/MESH.md 9a. Births follow v3: any node may )
|
||||
( birth on its own ports, and is its children's parent. )
|
||||
@@ -14,7 +14,8 @@ VARIABLE (T#)
|
||||
: (TC) ( c -- ) PAD (T#) @ + C! 1 (T#) +! ;
|
||||
: (TS) ( baddr u -- )
|
||||
DUP IF 0 DO DUP I + C@ (TC) LOOP DROP ELSE DROP DROP THEN ;
|
||||
Block 8101
|
||||
-->
|
||||
Block 3965
|
||||
: (TN) ( n -- ) 0 <# #S #> (TS) 32 (TC) ;
|
||||
: (T) ( -- baddr u ) PAD (T#) @ ;
|
||||
( The node being born: its number, its place, the port of )
|
||||
@@ -27,7 +28,8 @@ VARIABLE (KIDC) VARIABLE (PERS) VARIABLE (PERS#)
|
||||
-1 NODE-ERROR ! ;
|
||||
: (TOLD) ( how -- ) 1 - IF (FAIL) THEN ;
|
||||
: (TELL) ( baddr u -- ) (KID#) @ SEND (KID#) @ AWAIT (TOLD) ;
|
||||
Block 8102
|
||||
-->
|
||||
Block 3966
|
||||
( the system, a capsule of F18 code, cell by cell to its port )
|
||||
: (NUCLEUS) ( -- )
|
||||
S" v4:nucleus-64.f18" CAPSULE-OPEN 0= IF (FAIL) THEN
|
||||
@@ -36,7 +38,8 @@ Block 8102
|
||||
: (LINES) ( baddr u -- ) CAPSULE-OPEN 0= IF (FAIL) THEN
|
||||
BEGIN PAD CAPSULE-LINE DUP 0< 0= WHILE PAD SWAP (TELL) REPEAT
|
||||
DROP ;
|
||||
Block 8104
|
||||
-->
|
||||
Block 3967
|
||||
( Who it is, where its printing goes, which of its ports )
|
||||
( leads to everything it is not told of, and who is there. )
|
||||
: (WHO) ( -- )
|
||||
@@ -45,7 +48,8 @@ Block 8104
|
||||
(KIDC) @ (TN) S" DEFAULT-ROUTE " (TS)
|
||||
(ME) @ (TN) (KIDC) @ (TN) S" NEIGHBOUR" (TS)
|
||||
(T) 0 (KIDP) @ SEND-ON (KID#) @ AWAIT (TOLD) ;
|
||||
Block 8105
|
||||
-->
|
||||
Block 3968
|
||||
( number port childport baddr u -- place A NODE IS BORN, )
|
||||
( its port childport joined to this one's port: empty, then )
|
||||
( the system, FORTH-79, and its personality if u is not 0. )
|
||||
@@ -60,7 +64,8 @@ Block 8105
|
||||
S" (SEAL)" (TELL)
|
||||
(KID) @ (KID#) @ NODE-PARITY
|
||||
(KID) @ ;
|
||||
Block 8106
|
||||
-->
|
||||
Block 3969
|
||||
( number port childport -- place a node with no capsule )
|
||||
: BIRTH 0 0 BIRTH-AS ;
|
||||
( Two outer nodes are joined: port 3 of X to port 4 of Y, )
|
||||
@@ -74,7 +79,8 @@ VARIABLE (XP) VARIABLE (XN) VARIABLE (YP) VARIABLE (YN)
|
||||
: (JOIN) ( -- )
|
||||
(XP) @ 3 (YP) @ 4 NODE-WIRE 0= IF (FAIL) THEN
|
||||
(YN) @ 3 (XN) @ (SAY) (XN) @ 4 (YN) @ (SAY) ;
|
||||
Block 8107
|
||||
-->
|
||||
Block 3970
|
||||
( n -- A UNIT: four outer nodes, n+1 to n+4, on ports 2 )
|
||||
( to 5 of this one, each by its own port 2, and joined in a )
|
||||
( square: 1-2, 2-4, 4-3, 3-1. )
|
||||
|
||||
Reference in New Issue
Block a user