capsules/v4/sys: the nucleus's fourteen sources as .f18 blobs (made once by v4/tools/v4tof18.py: header becomes the ROM's directives, every other token and line kept), the memory map as map-<width>.f18 (mkmap sys, from one table in host_map.h that host_load reads too), and end.f18, the switch-on state mkimage.c set in C, the image record, and start (IDLE). test_host_rom_nucleus.c: the ROM, fed those blobs through the console, builds RAM identical word for word to mkimage.c's, outside its own state and the image record, and starts at (IDLE), at both widths. The cost: 60.7 million instructions, 1.5 s on the C model. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
36 lines
1.2 KiB
Plaintext
36 lines
1.2 KiB
Plaintext
\ 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
|
|
\ 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
|
|
\ start: the ROM clears what it used and the node waits for a message.
|
|
|
|
\ the dictionary: empty, at DBASE; the newest entry, the nucleus's last
|
|
store DP DBASE
|
|
store (LATEST) HDR-LINK
|
|
\ the control-flow stack, the number base, the log level
|
|
store (CFP) CFBASE
|
|
store BASE 10
|
|
store (LOG-LEVEL) 2
|
|
\ one vocabulary, FORTH, whose head cell is LATEST; new words go into it
|
|
store CONTEXT (LATEST)
|
|
store CURRENT (LATEST)
|
|
\ the text interpreted is the terminal's
|
|
store (SRC) TIB
|
|
\ what COLD comes back to, and the lowest FORGET goes: the nucleus as it is
|
|
store (BOOT) DBASE
|
|
store (BOOT)+1 HDR-LINK
|
|
store FENCE DICT-W
|
|
\ nothing has ended badly; nothing has been printed
|
|
store (LINE-STATUS) 1
|
|
store (OUT^) (OUT)
|
|
|
|
\ the image record: where the node waits, its fault table, KEY's code
|
|
store (IMG) &(IDLE)
|
|
store (IMG)+1 &(FAULTS)
|
|
store (IMG)+2 &KEY
|
|
store (IMG)+3 &CR
|
|
|
|
start (IDLE)
|