feat(v4): the system's UM*, UM/MOD, D+, DNEGATE, Q.* and Q./ call the ROM

MACHINE.md 2.2.  Each is its entry's address, push and ;.  Every node the
tests make carries the host ROM (host_load, Hera's births, the depth and
mesh tests' own nodes), and a division by zero inside the ROM returns to
the prompt (hosted-check).  test_host_quit's fetch outside memory moves
past the ROM's range: 16384 is the ROM's first word now the tests' system
has its ROM, as the product's always had.  dict_hash 0xfec8c47cfc6f437f.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rajames
2026-10-15 20:16:50 -04:00
co-authored by Claude Opus 5.5
parent 11b5d402b1
commit afd9d46d29
14 changed files with 123 additions and 126 deletions
+24
View File
@@ -13,6 +13,7 @@
#define V4_TESTS_HOST_MAP_H
#include "v4/rom_errors.h"
#include "v4/rom_entries.h"
#include "v4/blocks.h"
#include "v4/text.h"
#include <stdio.h>
@@ -361,6 +362,25 @@ static unsigned host_branch_slots(void)
X("CFBASE", CFS_W) \
X("CFEND", CFS_W + CFS_CELLS)
/* The host node's ROM (MACHINE.md 2), which the tests that link it attach:
* the system calls its math there (MACHINE.md 2.2). */
#if V4_CELL_BITS == 64
extern const v4_cell v4_rom_64[];
extern const unsigned v4_rom_64_words;
#define ROM_IMAGE v4_rom_64
#define ROM_IMAGE_WORDS v4_rom_64_words
#else
extern const v4_cell v4_rom_32[];
extern const unsigned v4_rom_32_words;
#define ROM_IMAGE v4_rom_32
#define ROM_IMAGE_WORDS v4_rom_32_words
#endif
/* The shared ROM entries (MACHINE.md 2.2), as constants ROM-UM* ...: each
* the address of its entry, from the one list (v4/rom_entries.h). The
* system's six words of those names call these. */
#define HOST_ROM_ENTRY_CONSTANT(i, routine, forth, effect) v4_text_constant(tx, "ROM-" forth, V4_ROM_BASE + (v4_cell)(i));
static int host_load(v4_text *tx, v4_node *n, const char *const *files, unsigned count)
{
char path[512];
@@ -372,7 +392,11 @@ static int host_load(v4_text *tx, v4_node *n, const char *const *files, unsigned
#define HOST_CONSTANT(name, value) v4_text_constant(tx, name, (v4_cell)(value));
HOST_CONSTANTS(HOST_CONSTANT)
#undef HOST_CONSTANT
V4_ROM_MATH_ENTRIES(HOST_ROM_ENTRY_CONSTANT)
v4_node_stack_regs_attach(n, DSTACK_REG, RSTACK_REG);
#ifdef V4_ROM_LINKED
v4_node_rom_attach(n, ROM_IMAGE, ROM_IMAGE_WORDS); /* the system calls its math in the ROM (MACHINE.md 2.2) */
#endif
for (i = 0; i < count; i++) {
snprintf(path, sizeof path, "%s/%s", V4_SYS_DIR, files[i]);
if (!v4_text_assemble_file(tx, path)) {