Files
LithosAnanake/v4/tools/mkmap.c
T
rajamesandClaude Opus 5.5 07911dcf91 feat(v4): the ROM's symbol table
(FIND) ( -- rec | 0 ), (DEFINE) ( value kind -- ) and (OPCODE) ( -- op | -1 ),
entries 3-5.  Names are refused as text.c's define refuses them, compared
case by case with text.c; a set variable may be set again.  256 hash heads,
records growing up and names growing down in dictionary space, used only
while the ROM assembles.  text.c gains the data directives #, and ", (the
ROM's language; its mnemonic and reserved-word tables are data); the
nucleus image is byte-identical.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 11:54:15 -04:00

61 lines
2.4 KiB
C

/* mkmap.c -- the memory map, as constants the ROM is assembled with.
*
* mkmap > rom-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
* the text assembler's notation, the addresses and codes of
* v4/tests/host_map.h that the ROM's source (capsules/v4/rom) uses: the
* console's receive registers and the ROM's state area (MACHINE.md 2.1).
* The map has one source, host_map.h; this is how the ROM reads it.
*/
#include "../tests/host_map.h"
#include <stdio.h>
static void constant(const char *name, long value)
{
printf("constant %s %ld\n", name, value);
}
int main(void)
{
(void)host_load; /* host_map.h's loader is not this tool's */
(void)host_branch_slots;
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);
constant("(TOK)", (long)ROM_TOK);
constant("(TOKN)", (long)ROM_TOKN);
constant("(PEEK)", (long)ROM_PEEK);
constant("(LINE)", (long)ROM_LINE);
constant("(EOF)", (long)ROM_EOF);
constant("(FAILED)", (long)ROM_FAILED);
constant("(ERRLINE)", (long)ROM_ERRLINE);
constant("(NBASE)", (long)ROM_NBASE);
constant("(NNEG)", (long)ROM_NNEG);
constant("(NI)", (long)ROM_NI);
constant("(NU)", (long)ROM_NU);
constant("(NBIG)", (long)ROM_NBIG);
constant("(RECN)", (long)ROM_RECN);
constant("(POOLN)", (long)ROM_POOLN);
constant("(REC)", (long)ROM_REC);
constant("(CNT)", (long)ROM_CNT);
constant("(PTR)", (long)ROM_PTR);
constant("(I)", (long)ROM_I);
constant("(WI)", (long)ROM_WI);
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 cell width's constants (NUMBER) needs, written as signed cells */
constant("MSB", (long)(v4_cell)V4_MSB);
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;
}