feat(v4): the ROM's slot packer, word for word with asm.c
(OP) (LIT) (BRANCH) (BRANCH>) (RESOLVE) (LABEL), entries 6-11: the code generator of any language built on the machine (MACHINE.md 2.1). asm.c's layout rules with text.c's branch placement; 400 random sequences agree word for word with asm.c at both widths, memory-full and out-of-reach are refused on both sides, and a ref with no branch is refused, not looped on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
07911dcf91
commit
c233cb6536
+13
-1
@@ -105,7 +105,16 @@
|
||||
#define SEND_PTR (BUF0_W - 101) /* where the next word of a text being made ready to send goes */
|
||||
#define OUT_TEXT (OUT_W - 64) /* what was printed, four characters to a cell, as it goes on the wire: 64 cells */
|
||||
#define SEND_TEXT (OUT_W - 400) /* the text of a message SEND is putting, four characters to a cell: 256 cells */
|
||||
/* FREE, plain memory: BUF0_W - 32 .. - 21; - 122 .. - 113; BUF0_W - 144 .. - 141 (what a flush makes zero after
|
||||
/* The ROM's slot packer (MACHINE.md 2.1), in what was free: BUF0_W - 32 .. - 23 and - 122 .. - 120. */
|
||||
#define ROM_HERE (BUF0_W - 32) /* the next word address code goes to */
|
||||
#define ROM_CUR (BUF0_W - 31) /* the instruction word being built */
|
||||
#define ROM_SLOT (BUF0_W - 30) /* its next free slot, 0 .. 6 */
|
||||
#define ROM_NLIT (BUF0_W - 29) /* how many literals it owes */
|
||||
#define ROM_LITS (BUF0_W - 28) /* the literals, 6 cells */
|
||||
#define ROM_PI (BUF0_W - 122) /* working cells */
|
||||
#define ROM_RS (BUF0_W - 121)
|
||||
#define ROM_RN (BUF0_W - 120)
|
||||
/* FREE, plain memory: BUF0_W - 22 .. - 21; - 119 .. - 113; BUF0_W - 144 .. - 141 (what a flush makes zero after
|
||||
* a full output buffer); and OUT_W - 144 .. OUT_W - 65. They and
|
||||
* the cells above held the messages waiting, the refusals owed and what went with them (MESH.md 7a, 7b), which a
|
||||
* node no longer keeps. */
|
||||
@@ -159,6 +168,9 @@
|
||||
#define ROM_ERR_BAD_NAME 3 /* an opcode, a reserved word, a label, a number or &...: "cannot be used as a name" */
|
||||
#define ROM_ERR_DEFINED 4 /* "already defined" */
|
||||
#define ROM_ERR_NAMES 5 /* the symbol table is full: "too many names" */
|
||||
#define ROM_ERR_FIT 6 /* memory is full, or a branch cannot reach: "does not fit" */
|
||||
#define ROM_ERR_OPCODE 7 /* not an opcode the packer takes there */
|
||||
#define ROM_ADDR_TOP ((v4_cell)(V4_NODE_WORDS + V4_ROM_WORDS - 1u)) /* the top of the address space */
|
||||
#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