feat(v4): the machine boots from its ROM; the prebuilt nucleus is gone
The host node starts in its ROM (entry 12), and the boot feeds it the system's source through the console: capsules/v4/sys/map-64.f18, the fourteen .f18 blobs and end.f18, each found, hash-checked and signature-checked as any capsule, then EOT. The ROM assembles the system and starts it at (IDLE); the host reads the image record (v4_image_from_node) for what only the assembled system knows. A ROM error is reported with its blob, line and meaning, then PARITY:FAIL. Deleted: v4/tools/mkimage.c, capsules/v4/nucleus-64.f18, v4/capsule/*.v4, v4/tools/v4tof18.py. The .f18 files are the source now. - text.c speaks the rest of the ROM's language (set, here, store, start; v4_text_value, v4_text_start), so the oracle reads the same source: test_host_rom_nucleus compares the ROM against text.c on the .f18 files, word for word, image record included. Host tests load the .f18 files. - mkmap image writes v4_map_image (the map's description of the system); hosted and the kernel link the ROM and the map instead of v4_image_64.c. - Hera (Captain Bob's ruling, option 1): births stream the system the ROM assembled, as assembled code; hera.4th is unchanged. test_host_unit's host builds the system with the ROM. - New parity lines: PARITY:V4_F18 per blob, PARITY:V4_ROM words=2049 rom_hash=0xa6c792b5821010b7 instructions=60725216. Acceptance: amd64, aarch64, riscv64 boot to ok> with PARITY:V4_POST tests=538 pass=538 fail=0, POST: PASSED, and PARITY:V4_SYSTEM word_count=317 dict_hash=0xe5a57f3eb72ff94a on all three -- the same hash as the prebuilt nucleus gave. make -C v4 test test-32 hosted-check: all pass. Logs: logs/20261015-141648, -141938, -142350. Startup cost under QEMU TCG, the ROM's assembly (last V4_F18 line to V4_ROM): amd64 26.7 s of 132 s to ok>; aarch64 41.0 s of 195 s; riscv64 20.5 s of 101 s. Hosted native: +0.85 s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
1bf19d6224
commit
a73580e949
Binary file not shown.
@@ -1,6 +1,7 @@
|
||||
\ dir.f18 -- the ROM's directives, and the end of the system's source.
|
||||
\
|
||||
\ What mkimage.c and text.c's header did in C is said in the source with
|
||||
\ What the prebuilt nucleus's mkimage.c (gone) and text.c's header did in C
|
||||
\ is said in the source with
|
||||
\ these (MACHINE.md, the ROM's language). Each is a machine notion -- an
|
||||
\ address, a cell, a value -- and none is FORTH.
|
||||
\ constant NAME VALUE NAME is the number VALUE
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
\ acl.v4 -- word-level access control: the fields of an entry.
|
||||
\ acl.f18 -- word-level access control: the fields of an entry.
|
||||
\
|
||||
\ DECOMPOSITION.md 5.20, as v3: ACL-MODE@ ACL-MODE! ACL-TTL@ ACL-TTL! ACL-ALLOW@
|
||||
\ ACL-ALLOW! ACL-PINNED? ACL-PIN ACL-INHERIT ACL-INIT-PRIMITIVES ACL-HEAT@
|
||||
\ ACL-WORD-ID. These are all the capsule does itself; the policy -- what is
|
||||
\ strict, how long a TTL is, what is pinned -- is FORTH source, ACL.fth, as
|
||||
\ it is ACL.4th in v3. The fields and the check are described in
|
||||
\ compile.v4. Rests on compile.v4, quit.v4 and system.v4.
|
||||
\ compile.f18. Rests on compile.f18, quit.f18 and system.f18.
|
||||
\
|
||||
\ An xt of 0 is an error (code 16, "Not a word"). A pinned word's fields are
|
||||
\ not changed by the ! words: they do nothing, as in v3.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
\ blocks.v4 -- mass storage: blocks of 1024 characters, and text loaded from them.
|
||||
\ blocks.f18 -- mass storage: blocks of 1024 characters, and text loaded from them.
|
||||
\
|
||||
\ DECOMPOSITION.md 5.11, FORTH-79: BLOCK BUFFER UPDATE SAVE-BUFFERS
|
||||
\ EMPTY-BUFFERS LIST LOAD SCR BLK, and v3's FLUSH THRU and --> . Part of the
|
||||
@@ -23,7 +23,7 @@
|
||||
\ Constants the loader supplies:
|
||||
\ BLOCK# BUFFER# UPDATE# SAVE-BUFFERS# EMPTY-BUFFERS# the requests' numbers
|
||||
\ SCR word address of the variable: the block LIST showed last
|
||||
\ BLK (SRC) (SRC-HOOK) see input.v4
|
||||
\ BLK (SRC) (SRC-HOOK) see input.f18
|
||||
|
||||
set HDR-NFA here ", SCR #, 8 #, HDR-NFA #, HDR-LINK set HDR-LINK here : SCR' SCR ;
|
||||
set HDR-NFA here ", BLK #, 8 #, HDR-NFA #, HDR-LINK set HDR-LINK here : BLK' BLK ;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
\ codegen.v4 -- the code generator: opcodes, literals and branches packed into
|
||||
\ codegen.f18 -- the code generator: opcodes, literals and branches packed into
|
||||
\ instruction words at HERE.
|
||||
\
|
||||
\ This is what the compiling words ( : ; IF LOOP LITERAL ... ) are built on.
|
||||
@@ -18,7 +18,7 @@
|
||||
\ An instruction word is 32 bits at every cell width (D-9): slot k is the five
|
||||
\ bits whose lowest is bit 27 - 5k, and a branch there has 27 - 5k address bits.
|
||||
\
|
||||
\ Rests on core.v4 and dict.v4. Constants the loader supplies:
|
||||
\ Rests on core.f18 and dict.f18. Constants the loader supplies:
|
||||
\ (CG) word address of fourteen cells of scratch for this file
|
||||
\ CG-BSLOTS how many slots, counted from slot 0, may hold a branch
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
\ compile.v4 -- the interpreter's inner loop, and the defining and compiling
|
||||
\ compile.f18 -- the interpreter's inner loop, and the defining and compiling
|
||||
\ words.
|
||||
\
|
||||
\ DECOMPOSITION.md 5.17 and 5.18: STATE [ ] : ; EXIT IMMEDIATE LITERAL COMPILE
|
||||
\ [COMPILE] ' EXECUTE CREATE VARIABLE CONSTANT DOES>, the control structures
|
||||
\ IF ELSE THEN BEGIN UNTIL AGAIN WHILE REPEAT DO ?DO LOOP +LOOP, and INTERPRET,
|
||||
\ which they cannot be run without. Part of the compiler capsule. Rests on
|
||||
\ core.v4, input.v4, dict.v4 and codegen.v4.
|
||||
\ core.f18, input.f18, dict.f18 and codegen.f18.
|
||||
\
|
||||
\ HOW A WORD IS COMPILED. v4 code is native: a colon definition is
|
||||
\ instruction words, and compiling a word into one lays down a call to it.
|
||||
\ Two flags on an entry (dict.v4) change that:
|
||||
\ Two flags on an entry (dict.f18) change that:
|
||||
\ inline its code is a straight run of opcodes and literals ending
|
||||
\ in ; -- that run is copied in place of a call. Everything
|
||||
\ that touches the return stack must be, since a call would
|
||||
@@ -46,9 +46,9 @@ macro ROT push SWAP pop SWAP endmacro
|
||||
\ ( -- ) give up the line: stop compiling, forget the word being built and
|
||||
\ whatever control structures were open, skip the rest of the input, and set
|
||||
\ NODE-ERROR. A definition that was under way stays hidden. It returns to
|
||||
\ whatever called INTERPRET, which is QUIT (quit.v4): QUIT sees NODE-ERROR
|
||||
\ whatever called INTERPRET, which is QUIT (quit.f18): QUIT sees NODE-ERROR
|
||||
\ and prints ERROR.
|
||||
\ (ABANDON-AS) is the same with an error code (core.v4) for the prompt to
|
||||
\ (ABANDON-AS) is the same with an error code (core.f18) for the prompt to
|
||||
\ print the message of.
|
||||
: (ABANDON-AS) ( code -- )
|
||||
(C)+9 a! !
|
||||
@@ -150,7 +150,7 @@ set HDR-NFA here ", EXECUTE #, 0 #, HDR-NFA #, HDR-LINK set HDR-LINK here
|
||||
|
||||
\ ( -- n flag ) the word WORD has just left, as a single-cell number in the
|
||||
\ current BASE, and -1; or 0 0 if it is not one. A leading minus sign is
|
||||
\ allowed. This is what the interpreter uses: NUMBER (input.v4) makes a
|
||||
\ allowed. This is what the interpreter uses: NUMBER (input.f18) makes a
|
||||
\ double and needs more of the stack than can be spared here.
|
||||
\ (P)+2 the number so far, (P)+3 where it is in the word, (P)+4 the word's
|
||||
\ length, (P)+5 the sign, (P)+6 the base.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
set HDR-LINK 0 \ the newest dictionary entry: none yet
|
||||
\ core.v4 -- the core words the host-node capsules rest on.
|
||||
\ core.f18 -- the core words the host-node capsules rest on.
|
||||
\
|
||||
\ Each is the definition DECOMPOSITION.md gives and the golden-model tests
|
||||
\ execute (test_foundation.c, test_strings.c, test_terminal.c, test_pictured.c),
|
||||
@@ -13,7 +13,7 @@ set HDR-LINK 0 \ the newest dictionary entry: none yet
|
||||
\ ERRORS (D-18). A word that finds an error takes its arguments off the stack
|
||||
\ and stores a code in NODE-ERROR. On a node with a prompt that store is a
|
||||
\ trap: the word goes no further, and the prompt prints the message for the
|
||||
\ code and ERROR (quit.v4, (RAISED)). The codes:
|
||||
\ code and ERROR (quit.f18, (RAISED)). The codes:
|
||||
\ 1 Negative count 2 Not a number 3 Number too long
|
||||
\ 4 Not a character 5 Dictionary full 6 Name missing
|
||||
\ 7 Control structure mismatch 8 Control structures too deep
|
||||
@@ -110,7 +110,7 @@ set HDR-NFA here ", CMOVE #, 0 #, HDR-NFA #, HDR-LINK set HDR-LINK here
|
||||
\ is the port it came on, by its number; (ME) is this node's number.
|
||||
\
|
||||
\ Characters are kept in (OUT), 256 of them, a character to a cell, and sent
|
||||
\ when it is full and when the text has been done with (quit.v4). (OUT^)
|
||||
\ when it is full and when the text has been done with (quit.f18). (OUT^)
|
||||
\ is where the next goes.
|
||||
\
|
||||
\ THE STACK. What prints may be run with the data stack all but full: EMIT
|
||||
@@ -154,7 +154,7 @@ set HDR-NFA here ", CMOVE #, 0 #, HDR-NFA #, HDR-LINK set HDR-LINK here
|
||||
\ list of refusals owed, and messages written and read a word at a time
|
||||
\ (MESH.md 7a, 7b, 7c.6). The ports themselves are still written a word at
|
||||
\ a time for the two things that are not messages: a newborn node's
|
||||
\ nucleus (PORT!, quit.v4) and a node's requests to its kernel.
|
||||
\ nucleus (PORT!, quit.f18) and a node's requests to its kernel.
|
||||
\
|
||||
\ THE STACKS. All of this runs on the stacks the node's text is using.
|
||||
\ (SERVE) and what it calls keep to four cells of the data stack and four
|
||||
@@ -228,7 +228,7 @@ set HDR-NFA here ", CMOVE #, 0 #, HDR-NFA #, HDR-LINK set HDR-LINK here
|
||||
\ words are in (IN), is refused. A refusal for this node itself -- its own
|
||||
\ message came back to it -- is counted in (REFUSED) as one that came by a
|
||||
\ wire would be; or, if it is about the node this one is waiting on,
|
||||
\ (A-SELF) is set for AWAIT to find (quit.v4).
|
||||
\ (A-SELF) is set for AWAIT to find (quit.f18).
|
||||
\ (WIRE) is not what it was afterwards: the NACK went by another.
|
||||
\ If the drop does not drop -- the wire was cut after the message was looked
|
||||
\ at, which let it go already -- nothing is counted and no one is told.
|
||||
@@ -392,7 +392,7 @@ set HDR-NFA here ", CMOVE #, 0 #, HDR-NFA #, HDR-LINK set HDR-LINK here
|
||||
|
||||
\ ( -- ) send what has been printed, to where (PRINT-TO) says, by the port
|
||||
\ (PRINT-PORT): a message of type 2, its characters four to a word, the
|
||||
\ first lowest. quit.v4 sets those two when text for this node arrives.
|
||||
\ first lowest. quit.f18 sets those two when text for this node arrives.
|
||||
\ It waits for room on the wire, and for the 8 cells kept as well when the
|
||||
\ wire is the one the answer goes by. The characters are made ready in
|
||||
\ (OUT-TEXT), not where they are: until the message is on the wire the
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
\ dict.v4 -- the dictionary: its space, its entries, and looking a name up.
|
||||
\ dict.f18 -- the dictionary: its space, its entries, and looking a name up.
|
||||
\
|
||||
\ DECOMPOSITION.md 5.12 and 5.13: HERE ALIGN ALLOT , C, 2, PAD LATEST, FIND ' ,
|
||||
\ and the entry-field words >LINK LFA LINK> >NAME NFA NAME> CFA PFA >BODY
|
||||
\ TRAVERSE SMUDGE HIDDEN. Part of the compiler capsule: it runs on the host
|
||||
\ node. Rests on core.v4 and input.v4.
|
||||
\ node. Rests on core.f18 and input.f18.
|
||||
\
|
||||
\ AN ENTRY. A word's execution address (xt) is the address of its code, and
|
||||
\ everything else is found from it:
|
||||
@@ -129,7 +129,7 @@ set HDR-NFA here ", HIDDEN #, 0 #, HDR-NFA #, HDR-LINK set HDR-LINK here
|
||||
\ A word's code is here on the node; its accounts are a record its kernel
|
||||
\ keeps. So the kernel has to be told of every entry that is made and of
|
||||
\ every entry that goes. An entry is made in one place, (HEADER); entries go
|
||||
\ in two, FORGET and COLD (system.v4). Each tells through a variable that
|
||||
\ in two, FORGET and COLD (system.f18). Each tells through a variable that
|
||||
\ holds the xt of a word to run, or 0 for a node whose host keeps no records:
|
||||
\ (WORD-DEFINED) ( xt -- ) an entry has been made; its code will be at xt
|
||||
\ (WORD-FORGOTTEN) ( w -- ) every entry at word address w or above is gone
|
||||
@@ -221,7 +221,7 @@ set HDR-NFA here ", FIND #, 0 #, HDR-NFA #, HDR-LINK set HDR-LINK here
|
||||
|
||||
\ ( -- addr ) FORTH-79: the parameter field address of the next word in the
|
||||
\ input stream. Not found is an error: 0, and NODE-ERROR is set. This is '
|
||||
\ when interpreting; compile.v4 adds what ' does when compiling.
|
||||
\ when interpreting; compile.f18 adds what ' does when compiling.
|
||||
\ ( -- 0 ) say that the word WORD has just left is not known, as v3 does:
|
||||
\ UNKNOWN WORD: 'xxx'
|
||||
: (UNKNOWN)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
\ end.f18 -- the end of the system's source: the state it is switched on in.
|
||||
\
|
||||
\ What v4/tools/mkimage.c set in C when it built the nucleus, said with the
|
||||
\ What was set in C when the nucleus was prebuilt (v4/tools/mkimage.c, gone
|
||||
\ since the machine's ROM assembles the system), said with the
|
||||
\ ROM's directives (MACHINE.md, the ROM's language). RAM is all zeroes
|
||||
\ when the machine starts, so only what is not zero is stored. Then the
|
||||
\ image record (map: (IMG)), the addresses a host needs (v4/image.h), and
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
\ forth.v4 -- the first words of the FORTH vocabulary: the ones that are
|
||||
\ forth.f18 -- the first words of the FORTH vocabulary: the ones that are
|
||||
\ opcodes or short runs of them, and the variables that are in-line addresses.
|
||||
\
|
||||
\ Each is the definition DECOMPOSITION.md gives (sections 4, 5.1 - 5.5, 5.18).
|
||||
\ A word flagged inline is copied into a definition in place of a call; the
|
||||
\ ones that touch the return stack are compile-only as well. Rests on core.v4,
|
||||
\ compile.v4's loader constants, and quit.v4, which the division words leave
|
||||
\ ones that touch the return stack are compile-only as well. Rests on core.f18,
|
||||
\ compile.f18's loader constants, and quit.f18, which the division words leave
|
||||
\ through when the divisor is zero. (F) is seven cells of scratch for
|
||||
\ this file.
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
\ input.v4 -- reading a line and splitting it into words and numbers.
|
||||
\ input.f18 -- reading a line and splitting it into words and numbers.
|
||||
\
|
||||
\ DECOMPOSITION.md 5.9: TIB >IN SPAN SOURCE BL EXPECT QUERY WORD ENCLOSE
|
||||
\ CONVERT NUMBER, and the comment words ( and \ of 5.15 (named PAREN and
|
||||
\ BACKSLASH here, since the text assembler reads those two characters as its
|
||||
\ own comments; the dictionary will give them their names). Part of the compiler
|
||||
\ capsule: it runs on the host node. Rests on core.v4.
|
||||
\ capsule: it runs on the host node. Rests on core.f18.
|
||||
\
|
||||
\ Constants the loader supplies:
|
||||
\ TIB byte address of the text input buffer; QUERY fills at most 81 bytes
|
||||
@@ -14,7 +14,7 @@
|
||||
\ WBUF byte address of WORD's buffer, 257 bytes
|
||||
\ (P) word address of eight cells of scratch for this file
|
||||
\ (SRC) word address of the variable: the byte address of the text being
|
||||
\ interpreted. QUERY makes it TIB; LOAD (blocks.v4) makes it a
|
||||
\ interpreted. QUERY makes it TIB; LOAD (blocks.f18) makes it a
|
||||
\ block buffer. >IN is an offset from it and SPAN its length.
|
||||
\ (SRC-HOOK) word address of a variable: 0, or the address of a word
|
||||
\ that WORD calls before it looks at the text, to make sure (SRC)
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
\ log.v4 -- logging, as v3: a message has a level, and is printed if the
|
||||
\ log.f18 -- logging, as v3: a message has a level, and is printed if the
|
||||
\ level is at or below LOG-LEVEL.
|
||||
\
|
||||
\ DECOMPOSITION.md 5.25: the level constants LOG-ERROR LOG-WARN LOG-INFO
|
||||
\ LOG-TEST LOG-DEBUG (0 .. 4), LOG-LEVEL! LOG-LEVEL@, LOG-ERROR" ... LOG-DEBUG"
|
||||
\ and LOG-ERROR-STR ... LOG-DEBUG-STR. Part of the compiler capsule; rests
|
||||
\ on core.v4, codegen.v4 and quit.v4.
|
||||
\ on core.f18, codegen.f18 and quit.f18.
|
||||
\
|
||||
\ WHAT IS PRINTED is v3's line without its time of day, which a node has
|
||||
\ not got: the level's colour, the level's name and a colon, the colour off,
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
\ numout.v4 -- printing numbers: pictured output, the . words, and .S
|
||||
\ numout.f18 -- printing numbers: pictured output, the . words, and .S
|
||||
\
|
||||
\ DECOMPOSITION.md 5.8: <# # #S HOLD SIGN #> . .R U. U.R D. D.R ? SPACES
|
||||
\ DECIMAL HEX OCTAL, each the definition given there and executed on the mesh
|
||||
\ node by test_pictured.c, test_numout.c and test_printing.c; and .S, which
|
||||
\ D-16 makes possible again. Part of the compiler capsule. Rests on core.v4
|
||||
\ and forth.v4.
|
||||
\ D-16 makes possible again. Part of the compiler capsule. Rests on core.f18
|
||||
\ and forth.f18.
|
||||
\
|
||||
\ Constants the loader supplies:
|
||||
\ HEND byte address just past the hold buffer, which is 64 bytes
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
\ qmath.v4 -- Q48.16 fixed point: a signed double with sixteen bits of
|
||||
\ qmath.f18 -- Q48.16 fixed point: a signed double with sixteen bits of
|
||||
\ fraction (D-8, D-10).
|
||||
\
|
||||
\ DECOMPOSITION.md 5.26. Each word is the definition given there and
|
||||
\ executed on the mesh node by test_foundation.c and test_printing.c, here in
|
||||
\ the host node's vocabulary. Rests on core.v4, forth.v4, numout.v4 and
|
||||
\ words.v4.
|
||||
\ the host node's vocabulary. Rests on core.f18, forth.f18, numout.f18 and
|
||||
\ words.f18.
|
||||
\
|
||||
\ ERRORS. Q./ by zero, and Q.SQRT and Q.LOG outside their domain, leave the
|
||||
\ result D-11 and D-12 give and then raise an error (D-18): codes 11,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
\ quit.v4 -- a line of text, interpreted; how it ends; and the words that
|
||||
\ quit.f18 -- a line of text, interpreted; how it ends; and the words that
|
||||
\ print text written in the source.
|
||||
\
|
||||
\ DECOMPOSITION.md 5.15 and 5.10: QUIT ABORT ABORT" (ABORT") ." (."). Part of
|
||||
@@ -32,10 +32,10 @@
|
||||
\
|
||||
\ Constants the loader supplies:
|
||||
\ (LINE-STATUS) word address of the variable: how the last text ended
|
||||
\ (MSG) (REPLY) (ME) (OUT) (OUT^) see core.v4, "what a node prints"
|
||||
\ (MSG) (REPLY) (ME) (OUT) (OUT^) see core.f18, "what a node prints"
|
||||
\ (PORT) word address of the node's port 0
|
||||
\ (Q) word address of four cells of scratch, which system.v4 and
|
||||
\ blocks.v4 use too
|
||||
\ (Q) word address of four cells of scratch, which system.f18 and
|
||||
\ blocks.f18 use too
|
||||
\ DSTACK-DEPTH RSTACK-DEPTH word addresses of the stack registers
|
||||
|
||||
\ ( -- ) empty the return stack. `a` is only something to store: any
|
||||
@@ -356,7 +356,7 @@ set HDR-NFA here ", SEND-ON #, 0 #, HDR-NFA #, HDR-LINK set HDR-LINK here
|
||||
\ WHAT HAS COME ALREADY is on the wires and is found the first time
|
||||
\ through: the node looks before it sleeps. A message it left on a wire
|
||||
\ does not keep it awake.
|
||||
\ The stack what it does needs is tried first, (ROOM), core.v4: text that
|
||||
\ The stack what it does needs is tried first, (ROOM), core.f18: text that
|
||||
\ has left too little ends "Stack overflow" with nothing taken off a wire.
|
||||
set HDR-NFA here ", AWAIT #, 0 #, HDR-NFA #, HDR-LINK set HDR-LINK here
|
||||
: AWAIT
|
||||
@@ -399,7 +399,7 @@ set HDR-NFA here ", PORT! #, 0 #, HDR-NFA #, HDR-LINK set HDR-LINK here
|
||||
|
||||
\ ( -- ) WHAT IS IN THE DICTIONARY NOW IS THE SYSTEM: COLD comes back to
|
||||
\ it and FORGET will not go below it. Whoever has loaded a node's capsules
|
||||
\ has it do this (system.v4, (BOOT) and FENCE).
|
||||
\ has it do this (system.f18, (BOOT) and FENCE).
|
||||
set HDR-NFA here ", (SEAL) #, 0 #, HDR-NFA #, HDR-LINK set HDR-LINK here
|
||||
: (SEAL)
|
||||
DP a! @ (BOOT) a! !
|
||||
@@ -411,7 +411,7 @@ set HDR-NFA here ", (SEAL) #, 0 #, HDR-NFA #, HDR-LINK set HDR-LINK here
|
||||
\ NODE-ERROR, by name: how a definition written in FORTH raises an error.
|
||||
\ A store of a code that is not zero is the trap of D-18 -- the word goes no
|
||||
\ further, the message for the code is printed (-1: the word has printed
|
||||
\ its own) and the line ends with ERROR. The codes are listed in core.v4.
|
||||
\ its own) and the line ends with ERROR. The codes are listed in core.f18.
|
||||
set HDR-NFA here ", NODE-ERROR #, 8 #, HDR-NFA #, HDR-LINK set HDR-LINK here : NODE-ERROR' NODE-ERROR ;
|
||||
set HDR-NFA here ", (ME) #, 8 #, HDR-NFA #, HDR-LINK set HDR-LINK here : (ME)' (ME) ;
|
||||
set HDR-NFA here ", (CONSOLE) #, 8 #, HDR-NFA #, HDR-LINK set HDR-LINK here : (CONSOLE)' (CONSOLE) ;
|
||||
@@ -453,7 +453,7 @@ set HDR-NFA here ", ABORT #, 0 #, HDR-NFA #, HDR-LINK set HDR-LINK here
|
||||
2 jump (DONE)
|
||||
|
||||
\ A word has stored an error code in NODE-ERROR (D-18; the codes are listed
|
||||
\ in core.v4). Print its message -- a negative code means the word printed
|
||||
\ in core.f18). Print its message -- a negative code means the word printed
|
||||
\ its own -- and end the line with ERROR. The return stack has been
|
||||
\ emptied; the data stack is as the word left it.
|
||||
\ (QUIET) is 1 while the node is doing something that is no text's doing:
|
||||
@@ -508,7 +508,7 @@ set HDR-NFA here ", ABORT #, 0 #, HDR-NFA #, HDR-LINK set HDR-LINK here
|
||||
\ The three run-time words have names, as v3's have, so that SEE can tell a
|
||||
\ string in a definition from code; they cannot be used from the prompt.
|
||||
\ ." and ABORT" take the text up to the next " , which may be none at all
|
||||
\ (input.v4's (PARSE)); with no closing " it is the rest of the line. Inside a definition they lay
|
||||
\ (input.f18's (PARSE)); with no closing " it is the rest of the line. Inside a definition they lay
|
||||
\ down a call to their run-time word and, after it, the text as a counted
|
||||
\ string: the count byte and the characters, four to a cell, the last cell
|
||||
\ filled with zeros. The run-time word finds the string by the return
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
\ system.v4 -- words about the dictionary as a whole: WORDS, FORGET, FENCE.
|
||||
\ system.f18 -- words about the dictionary as a whole: WORDS, FORGET, FENCE.
|
||||
\
|
||||
\ DECOMPOSITION.md 5.13 and 5.15. Part of the compiler capsule; rests on
|
||||
\ dict.v4, quit.v4 and forth.v4.
|
||||
\ dict.f18, quit.f18 and forth.f18.
|
||||
\
|
||||
\ Constants the loader supplies:
|
||||
\ FENCE word address of the variable: FORGET will not remove an entry
|
||||
@@ -104,7 +104,7 @@ set HDR-NFA here ", FORGET #, 0 #, HDR-NFA #, HDR-LINK set HDR-LINK here
|
||||
C1: drop (LATEST) CONTEXT a! !
|
||||
C2: CURRENT a! @ (Q) a! @ inv + 1 + -if C3 drop jump TOLD
|
||||
C3: drop (LATEST) CURRENT a! !
|
||||
TOLD: (Q) a! @ jump (FORGOTTEN) \ the kernel's records of them go too (dict.v4)
|
||||
TOLD: (Q) a! @ jump (FORGOTTEN) \ the kernel's records of them go too (dict.f18)
|
||||
MISSING: drop (UNKNOWN) drop ;
|
||||
|
||||
\ ---- the system as a whole -------------------------------------------------------
|
||||
@@ -143,7 +143,7 @@ set HDR-NFA here ", COLD #, 0 #, HDR-NFA #, HDR-LINK set HDR-LINK here
|
||||
(BOOT) a! @ 2/ 2/ FENCE a! !
|
||||
(LATEST) CONTEXT a! ! (LATEST) CURRENT a! ! 0 VOC-LINK a! !
|
||||
10 BASE a! ! 0 SCR a! ! 2 (LOG-LEVEL) a! ! 0 (ACL-HOOK) a! ! EMPTY-BUFFERS
|
||||
(BOOT) a! @ 2/ 2/ (FORGOTTEN) \ the kernel's records of what has gone go too (dict.v4)
|
||||
(BOOT) a! @ 2/ 2/ (FORGOTTEN) \ the kernel's records of what has gone go too (dict.f18)
|
||||
$54524F46 (EMIT4) $39372D48 (EMIT4) $6C6F4320 (EMIT4) $74532064 (EMIT4) $747261 (EMIT4) CR
|
||||
$74737953 (EMIT4) $69206D65 (EMIT4) $6974696E (EMIT4) $7A696C61 (EMIT4) $2E6465 (EMIT4) CR
|
||||
jump ABORT
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
\ words.v4 -- more of the FORTH vocabulary: the stack, comparison, double,
|
||||
\ words.f18 -- more of the FORTH vocabulary: the stack, comparison, double,
|
||||
\ mixed, shift and string words that are short runs of opcodes or small loops.
|
||||
\
|
||||
\ Each is the definition DECOMPOSITION.md gives (sections 4, 5.1 - 5.7, 5.9)
|
||||
\ and the mesh-node tests execute (test_cells.c, test_foundation.c,
|
||||
\ test_strings.c), here as words of the host node's vocabulary. Rests on
|
||||
\ core.v4, forth.v4 and numout.v4.
|
||||
\ core.f18, forth.f18 and numout.f18.
|
||||
\
|
||||
\ Constants the loader supplies:
|
||||
\ MAX-INT the largest positive number: every bit but the top one
|
||||
|
||||
Reference in New Issue
Block a user