diff --git a/files.c b/files.c index 9b2f532..5a13b49 100644 --- a/files.c +++ b/files.c @@ -553,11 +553,12 @@ game features require version 0x%08lx", requested_glulx_version, VersionNum); sf_put((Out_Size >> 16)); sf_put((Out_Size >> 8)); sf_put((Out_Size)); - /* ENDMEM, which is also game file size */ - sf_put((Out_Size >> 24)); - sf_put((Out_Size >> 16)); - sf_put((Out_Size >> 8)); - sf_put((Out_Size)); + /* ENDMEM, which the game file size plus MEMORY_MAP_EXTENSION */ + i = Out_Size + MEMORY_MAP_EXTENSION; + sf_put((i >> 24)); + sf_put((i >> 16)); + sf_put((i >> 8)); + sf_put((i)); /* STACKSIZE */ sf_put((MAX_STACK_SIZE >> 24)); sf_put((MAX_STACK_SIZE >> 16)); diff --git a/header.h b/header.h index 28ca1d1..7358e33 100644 --- a/header.h +++ b/header.h @@ -2409,7 +2409,7 @@ extern int MAX_QTEXT_SIZE, MAX_SYMBOLS, HASH_TAB_SIZE, MAX_DICT_ENTRIES, extern int32 MAX_STATIC_STRINGS, MAX_ZCODE_SIZE, MAX_LINK_DATA_SIZE, MAX_TRANSCRIPT_SIZE, MAX_INDIV_PROP_TABLE_SIZE, MAX_NUM_STATIC_STRINGS, MAX_UNICODE_CHARS, - MAX_STACK_SIZE; + MAX_STACK_SIZE, MEMORY_MAP_EXTENSION; extern int32 MAX_OBJ_PROP_COUNT, MAX_OBJ_PROP_TABLE_SIZE; extern int MAX_LOCAL_VARIABLES, MAX_GLOBAL_VARIABLES; diff --git a/memory.c b/memory.c index a94f98b..1ec8baa 100644 --- a/memory.c +++ b/memory.c @@ -176,6 +176,7 @@ int NUM_ATTR_BYTES; int32 MAX_NUM_STATIC_STRINGS; int32 MAX_UNICODE_CHARS; int32 MAX_STACK_SIZE; +int32 MEMORY_MAP_EXTENSION; int ALLOC_CHUNK_SIZE; /* The way memory sizes are set causes great nuisance for those parameters @@ -220,6 +221,9 @@ static void list_memory_sizes(void) printf("| %25s = %-7d |\n","MAX_LOCAL_VARIABLES",MAX_LOCAL_VARIABLES); printf("| %25s = %-7d |\n","MAX_LOW_STRINGS",MAX_LOW_STRINGS); if (glulx_mode) + printf("| %25s = %-7d |\n","MEMORY_MAP_EXTENSION", + MEMORY_MAP_EXTENSION); + if (glulx_mode) printf("| %25s = %-7d |\n","MAX_NUM_STATIC_STRINGS", MAX_NUM_STATIC_STRINGS); printf("| %25s = %-7d |\n","MAX_OBJECTS",MAX_OBJECTS); @@ -418,6 +422,7 @@ extern void set_memory_sizes(int size_flag) NUM_ATTR_BYTES_z = 6; NUM_ATTR_BYTES_g = 7; MAX_UNICODE_CHARS = 64; + MEMORY_MAP_EXTENSION = 0; /* We estimate the default Glulx stack size at 4096. That's about enough for 90 nested function calls with 8 locals each -- the same capacity as the Z-Spec's suggestion for Z-machine stack @@ -700,6 +705,13 @@ static void explain_parameter(char *command) during gameplay. (Glulx only)\n"); return; } + if (strcmp(command,"MEMORY_MAP_EXTENSION")==0) + { + printf( +" MEMORY_MAP_EXTENSION is the number of bytes (all zeroes) to map into \n\ + memory after the game file. (Glulx only)\n"); + return; + } printf("No such memory setting as \"%s\"\n",command); @@ -845,6 +857,12 @@ extern void memory_command(char *command) /* Adjust up to a 256-byte boundary. */ MAX_STACK_SIZE = (MAX_STACK_SIZE + 0xFF) & (~0xFF); } + if (strcmp(command,"MEMORY_MAP_EXTENSION")==0) + { + MEMORY_MAP_EXTENSION=j, flag=1; + /* Adjust up to a 256-byte boundary. */ + MEMORY_MAP_EXTENSION = (MEMORY_MAP_EXTENSION + 0xFF) & (~0xFF); + } if (flag==0) printf("No such memory setting as \"%s\"\n", command);