feat(v4): mkrom -- the ROM built off the node; it reads tokens
The ROM's source is F18 code in capsules/v4/rom, assembled off the node by v4/tools/mkrom.c with the memory map's constants from v4/tools/mkmap.c (MACHINE.md 2). main.f18 is the entry table payloads call through (2.1); in.f18 reads the console and splits it into tokens exactly as text.c does, the token held packed as a counted string. The ROM's state is a reserved area of the map (host_map.h ROM_*). text.c gains the constant directive, so the off-node assembler and the ROM speak one language. The map also names (NUMBER)'s state, for the next task. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
32753f5479
commit
0f82d8c22a
@@ -119,6 +119,23 @@
|
||||
#define MSG (BUF0_W - 48) /* the header of the message being served, 7 cells */
|
||||
#define OUT_W (BUF0_W - 400) /* the output buffer: 256 cells, a character to a cell */
|
||||
#define OUT_CELLS 256
|
||||
/* THE ROM'S STATE (docs/v4.0.0/MACHINE.md 2.1): a reserved area that belongs to the ROM's routines, which payloads
|
||||
* call at run time; it is never cleared after the boot. OUT_W - 144 .. OUT_W - 65, which was free. */
|
||||
#define ROM_TOK (OUT_W - 144) /* the token being read, as a counted string: 16 cells */
|
||||
#define ROM_TOKN (OUT_W - 80) /* how many characters it has */
|
||||
#define ROM_PEEK (OUT_W - 79) /* a character put back, plus one; 0: none */
|
||||
#define ROM_LINE (OUT_W - 78) /* how many new lines have been read */
|
||||
#define ROM_EOF (OUT_W - 77) /* non-zero once EOT has been read: the input has ended */
|
||||
#define ROM_FAILED (OUT_W - 76) /* 0, or the code of the error that stopped the ROM */
|
||||
#define ROM_ERRLINE (OUT_W - 75) /* ROM_LINE when it failed */
|
||||
#define ROM_NBASE (OUT_W - 74) /* (NUMBER): the base, 10 or 16 */
|
||||
#define ROM_NNEG (OUT_W - 73) /* 1 after a leading - */
|
||||
#define ROM_NI (OUT_W - 72) /* the next character of the token */
|
||||
#define ROM_NU (OUT_W - 71) /* the value so far, unsigned */
|
||||
#define ROM_NBIG (OUT_W - 70) /* 1 once it has not fitted a cell */
|
||||
/* the ROM's error codes */
|
||||
#define ROM_ERR_TOO_LONG 1 /* a token longer than 63 characters: "name too long" */
|
||||
#define ROM_ERR_COMMENT 2 /* a ( with no ) before the end: "comment not closed" */
|
||||
#define WORD_DEFINED (BUF0_W - 11) /* the xt of the word that is told of each new entry, or 0 */
|
||||
#define WORD_FORGOTTEN (BUF0_W - 12) /* the xt of the word that is told when entries go, or 0 */
|
||||
#define LOG_LEVEL (BUF0_W - 5) /* the level at or below which a message is printed */
|
||||
|
||||
Reference in New Issue
Block a user