fix(v4): the final review's six minors in the ROM boot

- Text after start is refused, as text.c refuses it: before it jumps, the
  ROM reads on to the end of the source; blanks, comments and the ends of
  blobs may follow, a token is ERR-AFTER (26), "text after start".
- A token too long where a name, a target or a value is wanted is "name
  too long", as text.c says: (MISSING) reports "missing" only when no error
  came first.  `", keeps "missing", which is text.c's word for both.
- text.c's "address out of range" names the address, not the value.
- The system's source files are one list, v4/sys_files.h: boot.c, the
  harness and the nucleus test are made from it.
- The ROM's error codes and words are one list, v4/rom_errors.h: boot.c's
  messages, host_map.h's ROM_ERR_* and mkmap's ERR-* are made from it.
- node.h says what v4_node_store does with a ROM address (nothing, as for
  any address outside RAM, D-14); test_host_rom_range pins it.

ROM: 2095 words, rom_hash 0x06d0dcb7a0cb41a1.  dict_hash unchanged,
0xe5a57f3eb72ff94a.  make -C v4 test test-32 hosted-check pass.  QEMU:
amd64, aarch64, riscv64 to ok>, POST 538/538, POST: PASSED.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rajames
2026-10-15 17:10:45 -04:00
co-authored by Claude Opus 5.5
parent ff75e69e91
commit a28b5f2230
18 changed files with 646 additions and 89 deletions
+15 -25
View File
@@ -83,9 +83,21 @@ int main(int argc, char **argv)
constant("(SYMH)", (long)ROM_SYMH);
constant("SYMREC", (long)ROM_SYMREC);
constant("POOLTOP", (long)ROM_POOLTOP);
constant("ERR-BAD-NAME", (long)ROM_ERR_BAD_NAME);
constant("ERR-DEFINED", (long)ROM_ERR_DEFINED);
constant("ERR-NAMES", (long)ROM_ERR_NAMES);
{
/* the ROM's error codes, ERR-TOO-LONG ... (v4/rom_errors.h) */
static const struct { const char *name; long code; } errs[] = {
#define ROM_ERR_CONST_(name, code, text) { #name, code },
V4_ROM_ERRORS(ROM_ERR_CONST_)
#undef ROM_ERR_CONST_
};
unsigned e, c;
for (e = 0; e < sizeof errs / sizeof errs[0]; e++) {
char n[40] = "ERR-";
for (c = 0; errs[e].name[c] && c < sizeof n - 5u; c++) n[4 + c] = errs[e].name[c] == '_' ? '-' : errs[e].name[c];
n[4 + c] = 0;
constant(n, errs[e].code);
}
}
constant("(HERE)", (long)ROM_HERE);
constant("(CUR)", (long)ROM_CUR);
constant("(SLOT)", (long)ROM_SLOT);
@@ -96,8 +108,6 @@ int main(int argc, char **argv)
constant("(RN)", (long)ROM_RN);
constant("RAM-WORDS", (long)V4_NODE_WORDS);
constant("ADDR-TOP", (long)ROM_ADDR_TOP);
constant("ERR-FIT", (long)ROM_ERR_FIT);
constant("ERR-OPCODE", (long)ROM_ERR_OPCODE);
constant("(NREF)", (long)ROM_NREF);
constant("(NLAB)", (long)ROM_NLAB);
constant("(WNP)", (long)ROM_WNP);
@@ -130,24 +140,6 @@ int main(int argc, char **argv)
constant("DICT-END", (long)DICT_END_W);
constant("BUF0", (long)BUF0_W);
constant("TIB-W", (long)TIB_W);
constant("ERR-IN-MACRO", (long)ROM_ERR_IN_MACRO);
constant("ERR-MACRO", (long)ROM_ERR_MACRO);
constant("ERR-LABEL-DUP", (long)ROM_ERR_LABEL_DUP);
constant("ERR-LABELS", (long)ROM_ERR_LABELS);
constant("ERR-FOR", (long)ROM_ERR_FOR);
constant("ERR-UNEXT", (long)ROM_ERR_UNEXT);
constant("ERR-TARGET", (long)ROM_ERR_TARGET);
constant("ERR-UNDEFINED", (long)ROM_ERR_UNDEFINED);
constant("ERR-BIG", (long)ROM_ERR_BIG);
constant("ERR-AMP", (long)ROM_ERR_AMP);
constant("ERR-FETCH-P", (long)ROM_ERR_FETCH_P);
constant("ERR-MISSING", (long)ROM_ERR_MISSING);
constant("ERR-DEEP", (long)ROM_ERR_DEEP);
constant("ERR-REFS", (long)ROM_ERR_REFS);
constant("ERR-VALUE", (long)ROM_ERR_VALUE);
constant("ERR-NO-START", (long)ROM_ERR_NO_START);
constant("ERR-START", (long)ROM_ERR_START);
constant("ERR-RANGE", (long)ROM_ERR_RANGE);
constant("DSTACK-REG", (long)DSTACK_REG);
constant("RSTACK-REG", (long)RSTACK_REG);
/* the cell width's constants (NUMBER) needs, written as signed cells */
@@ -155,7 +147,5 @@ int main(int argc, char **argv)
constant("DEC-LIMIT", (long)(v4_cell)(~(v4_ucell)0 / 10u));
constant("DEC-NLAST", -(long)(~(v4_ucell)0 % 10u) - 1);
constant("HEX-HIGH", (long)(v4_cell)~(~(v4_ucell)0 >> 4));
constant("ERR-TOO-LONG", (long)ROM_ERR_TOO_LONG);
constant("ERR-COMMENT", (long)ROM_ERR_COMMENT);
return 0;
}