/* */
/* Inform is free software: you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* */
/* Inform is free software: you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
at the end of the compilation pass */
/* In Glulx, zmachine_paged_memory contains all of RAM -- i.e. all but
at the end of the compilation pass */
/* In Glulx, zmachine_paged_memory contains all of RAM -- i.e. all but
- the header, the code, and the static strings. */
+ the header, the code, the static arrays, and the static strings. */
/* ------------------------------------------------------------------------- */
/* Offsets of various areas in the Z-machine: these are set to nominal */
/* ------------------------------------------------------------------------- */
/* Offsets of various areas in the Z-machine: these are set to nominal */
routine_flags_array_offset,
global_names_offset,
global_flags_array_offset,
routine_flags_array_offset,
global_names_offset,
global_flags_array_offset,
total += (subtract_pointers(dictionary_top, dictionary)) /* dictionary */
+ ((module_switch)?30:0); /* module map */
total += (subtract_pointers(dictionary_top, dictionary)) /* dictionary */
+ ((module_switch)?30:0); /* module map */
total += scale_factor*0x100 /* maximum null bytes before code */
+ 1000; /* fudge factor (in case the above is wrong) */
total += scale_factor*0x100 /* maximum null bytes before code */
+ 1000; /* fudge factor (in case the above is wrong) */
{
/* This function calculates a modest over-estimate of the amount of
memory required to store the machine's paged memory area
{
/* This function calculates a modest over-estimate of the amount of
memory required to store the machine's paged memory area
int32 globals_at=0, link_table_at=0, dictionary_at=0, actions_at=0, preactions_at=0,
abbrevs_at=0, prop_defaults_at=0, object_tree_at=0, object_props_at=0,
map_of_module=0, grammar_table_at=0, charset_at=0, headerext_at=0,
int32 globals_at=0, link_table_at=0, dictionary_at=0, actions_at=0, preactions_at=0,
abbrevs_at=0, prop_defaults_at=0, object_tree_at=0, object_props_at=0,
map_of_module=0, grammar_table_at=0, charset_at=0, headerext_at=0,
- terminating_chars_at=0, unicode_at=0, id_names_length=0;
+ terminating_chars_at=0, unicode_at=0, id_names_length=0,
+ static_arrays_at=0;
- for (i=0; i<3*32; i++) /* Initially all 96 entries */
- { p[mark++]=0; p[mark++]=0x20; /* are set to " " */
+
+ if (MAX_ABBREVS + MAX_DYNAMIC_STRINGS != 96)
+ fatalerror("MAX_ABBREVS + MAX_DYNAMIC_STRINGS is not 96");
+
+ /* Initially all 96 entries are set to " ". (We store half of 0x40,
+ the address of the " " we wrote above.) */
+ for (i=0; i<3*32; i++)
+ { p[mark++]=0; p[mark++]=0x20;
- for (i=0; i<no_abbreviations; i++) /* Write any abbreviations */
- { j=abbrev_values[i]; /* into banks 2 and 3 */
- p[abbrevs_at+64+2*i]=j/256; /* (bank 1 is reserved for */
- p[abbrevs_at+65+2*i]=j%256; /* "variable strings") */
+
+ /* Entries from 0 to MAX_DYNAMIC_STRINGS (default 32) are "variable
+ strings". Write the abbreviations after these. */
+ k = abbrevs_at+2*MAX_DYNAMIC_STRINGS;
+ for (i=0; i<no_abbreviations; i++)
+ { j=abbrev_values[i];
+ p[k++]=j/256;
+ p[k++]=j%256;
/* ----------------- A gap before the code area ----------------------- */
/* (so that it will start at an exact packed address and so that all */
/* routine packed addresses are >= 256, hence long constants) */
/* ----------------- A gap before the code area ----------------------- */
/* (so that it will start at an exact packed address and so that all */
/* routine packed addresses are >= 256, hence long constants) */
prop_values_offset = object_props_at;
static_memory_offset = grammar_table_at;
grammar_table_offset = grammar_table_at;
prop_values_offset = object_props_at;
static_memory_offset = grammar_table_at;
grammar_table_offset = grammar_table_at;
printf(" +=====================+ %05lx\n", (long int) Write_Code_At);
printf("Above | Z-code |\n");
printf("readable+---------------------+ %05lx\n",
printf(" +=====================+ %05lx\n", (long int) Write_Code_At);
printf("Above | Z-code |\n");
printf("readable+---------------------+ %05lx\n",
int32 globals_at, dictionary_at, actions_at, preactions_at,
abbrevs_at, prop_defaults_at, object_tree_at, object_props_at,
grammar_table_at, charset_at, headerext_at,
int32 globals_at, dictionary_at, actions_at, preactions_at,
abbrevs_at, prop_defaults_at, object_tree_at, object_props_at,
grammar_table_at, charset_at, headerext_at,
int32 threespaces, code_length;
char *output_called = (module_switch)?"module":"story file";
int32 threespaces, code_length;
char *output_called = (module_switch)?"module":"story file";
Write_Strings_At = Write_Code_At + code_length;
strings_length = compression_table_size + compression_string_size;
Write_Strings_At = Write_Code_At + code_length;
strings_length = compression_table_size + compression_string_size;
write_debug_section("string decoding table", Write_Strings_At);
write_debug_section("strings area",
Write_Strings_At + compression_table_size);
write_debug_section("string decoding table", Write_Strings_At);
write_debug_section("strings area",
Write_Strings_At + compression_table_size);
printf(" + - - - - - - - - - - + %06lx\n",
(long int) Write_Strings_At + compression_table_size);
printf(" | strings |\n");
printf(" + - - - - - - - - - - + %06lx\n",
(long int) Write_Strings_At + compression_table_size);
printf(" | strings |\n");
+ if (static_array_area_size)
+ {
+printf(" +---------------------+ %06lx\n",
+ (long int) (static_arrays_at));
+printf(" | static arrays |\n");
+ }
printf(" +=====================+ %06lx\n",
(long int) (Write_RAM_At+globals_at));
printf("Dynamic | global variables |\n");
printf(" +=====================+ %06lx\n",
(long int) (Write_RAM_At+globals_at));
printf("Dynamic | global variables |\n");
identifier_names_offset=0x800;
class_numbers_offset = 0x800;
arrays_offset = 0x0800; /* only used in Glulx, but might as well set */
identifier_names_offset=0x800;
class_numbers_offset = 0x800;
arrays_offset = 0x0800; /* only used in Glulx, but might as well set */
individuals_offset=0x12345;
identifier_names_offset=0x12345;
class_numbers_offset = 0x12345;
individuals_offset=0x12345;
identifier_names_offset=0x12345;
class_numbers_offset = 0x12345;