feat(v4): the ROM assembles the system's .f18 to the nucleus, word for word
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>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
084c520a54
commit
1bf19d6224
+18
-1
@@ -1,6 +1,7 @@
|
||||
/* mkmap.c -- the memory map, as constants the ROM is assembled with.
|
||||
*
|
||||
* mkmap > rom-map-<width>.f18
|
||||
* mkmap sys > capsules/v4/sys/map-<width>.f18
|
||||
*
|
||||
* Runs on the build machine, built for the host node (HOST_WORDS and the
|
||||
* host stack sizes) at one cell width. It writes, as `constant` lines in
|
||||
@@ -17,10 +18,26 @@ static void constant(const char *name, long value)
|
||||
printf("constant %s %ld\n", name, value);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
/* `mkmap sys`: the system's map, the blob the ROM reads before the system's
|
||||
* source (capsules/v4/sys/map-<width>.f18): every constant host_load gives
|
||||
* the nucleus, and the two its end (capsules/v4/sys/end.f18) needs besides. */
|
||||
static int system_map(void)
|
||||
{
|
||||
printf("\\ map-%d.f18 -- the memory map the system's source is assembled with, %d-bit cells.\n", V4_CELL_BITS, V4_CELL_BITS);
|
||||
printf("\\ Generated by v4/tools/mkmap.c (mkmap sys) from v4/tests/host_map.h -- do not edit.\n");
|
||||
#define SYS_CONSTANT(name, value) constant(name, (long)(v4_cell)(value));
|
||||
HOST_CONSTANTS(SYS_CONSTANT)
|
||||
#undef SYS_CONSTANT
|
||||
constant("DICT-W", (long)DICT_W);
|
||||
constant("(IMG)", (long)ROM_IMG);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
(void)host_load; /* host_map.h's loader is not this tool's */
|
||||
(void)host_branch_slots;
|
||||
if (argc == 2 && argv[1][0] == 's') return system_map();
|
||||
printf("\\ Generated by v4/tools/mkmap.c from v4/tests/host_map.h -- do not edit.\n");
|
||||
constant("CONSOLE-RX", (long)CONSOLE_RX);
|
||||
constant("CONSOLE-STATUS", (long)CONSOLE_ST);
|
||||
|
||||
Reference in New Issue
Block a user