diff --git a/ReleaseNotes.html b/ReleaseNotes.html index abcc2552..45e60bd9 100644 --- a/ReleaseNotes.html +++ b/ReleaseNotes.html @@ -96,7 +96,12 @@

Features added

more efficient implementation, using Glulx’s unsigned comparison opcodes.
  • The debugging output file, generated when the -k is used, has been changed to a new, XML-based format. -

  • A new Glulx-only setting $GLULX_OBJECT_EXT_BYTES has been added, which specifies an +

  • Two new Z-code settings have been added to support the extra words in the header extension table +specified in section 11.1.7 of the Z-Machine Standards Document version 1.1. $ZCODE_HEADER_EXT_WORDS +specifies how many extra words to add (so for all three words defined in the 1.1 standard, this would +be set to 3). $ZCODE_HEADER_FLAGS_3 specifies the value to put in the first of these three words, +which is the "flags3" field. +

  • A new Glulx setting $GLULX_OBJECT_EXT_BYTES has been added, which specifies an amount of additional space to add to each object record. The default is 0.

    Bugs fixed

    @@ -128,7 +133,7 @@

    Bugs fixed

    third argument to the statement will not change the global variable that the statement uses internally. [Mantis 1084]
  • The 'Abbreviate' statement now works with words containing non-English characters. [Mantis 1130]

  • Attempting to use @pop opcode for V5 or higher no longer results in a crash. [Mantis 1172] -

  • The Glulx-only setting $NUM_ATTR_BYTES, which determines the number of bytes in an object set aside +

  • The Glulx setting $NUM_ATTR_BYTES, which determines the number of bytes in an object set aside for attribute flags, now works correctly. Note that this has required a change to the veneer routines that conflicts with the definition of FUNC_2_CP__Tab() in the ‘Accelerated Functions’ section of the Glulx 3.1.2 specification. If you change this setting, you should take great care if you also use the Glulx accelerated functions diff --git a/header.h b/header.h index 89ddee3f..612f7654 100644 --- a/header.h +++ b/header.h @@ -2412,7 +2412,7 @@ extern int32 requested_glulx_version; extern int error_format, store_the_text, asm_trace_setting, double_space_setting, trace_fns_setting, character_set_setting, - character_set_unicode, header_ext_setting; + character_set_unicode; extern char Debugging_Name[]; extern char Transcript_Name[]; @@ -2519,6 +2519,7 @@ extern int32 MAX_STATIC_STRINGS, MAX_ZCODE_SIZE, MAX_LINK_DATA_SIZE, extern int32 MAX_OBJ_PROP_COUNT, MAX_OBJ_PROP_TABLE_SIZE; extern int MAX_LOCAL_VARIABLES, MAX_GLOBAL_VARIABLES; extern int DICT_WORD_SIZE, DICT_CHAR_SIZE, DICT_WORD_BYTES; +extern int ZCODE_HEADER_EXT_WORDS, ZCODE_HEADER_FLAGS_3; extern int NUM_ATTR_BYTES, GLULX_OBJECT_EXT_BYTES; extern int WARN_UNUSED_ROUTINES, OMIT_UNUSED_ROUTINES; diff --git a/inform.c b/inform.c index 888b9c14..ae4af295 100644 --- a/inform.c +++ b/inform.c @@ -256,7 +256,6 @@ int character_set_setting, /* set by -C0 through -C9 */ double_space_setting, /* set by -d: 0, 1 or 2 */ trace_fns_setting, /* set by -g: 0, 1 or 2 */ linker_trace_setting, /* set by -y: ditto for linker_... */ - header_ext_setting, /* set by -W */ store_the_text; /* when set, record game text to a chunk of memory (used by both -r & -k) */ static int r_e_c_s_set; /* has -S been explicitly set? */ @@ -314,7 +313,6 @@ static void reset_switch_settings(void) character_set_setting = 1; /* Default is ISO Latin-1 */ character_set_unicode = FALSE; - header_ext_setting = 0; compression_switch = TRUE; glulx_mode = FALSE; @@ -1411,10 +1409,10 @@ extern void switches(char *p, int cmode) case 'H': compression_switch = state; break; case 'U': define_USE_MODULES_switch = state; break; case 'W': if ((p[i+1]>='0') && (p[i+1]<='9')) - { s=2; header_ext_setting = p[i+1]-'0'; + { s=2; ZCODE_HEADER_EXT_WORDS = p[i+1]-'0'; if ((p[i+2]>='0') && (p[i+2]<='9')) - { s=3; header_ext_setting *= 10; - header_ext_setting += p[i+2]-'0'; + { s=3; ZCODE_HEADER_EXT_WORDS *= 10; + ZCODE_HEADER_EXT_WORDS += p[i+2]-'0'; } } break; diff --git a/memory.c b/memory.c index e5b209b2..f0a36ebc 100644 --- a/memory.c +++ b/memory.c @@ -254,6 +254,8 @@ int MAX_GLOBAL_VARIABLES; int DICT_WORD_SIZE; /* number of characters in a dict word */ int DICT_CHAR_SIZE; /* (glulx) 1 for one-byte chars, 4 for Unicode chars */ int DICT_WORD_BYTES; /* DICT_WORD_SIZE*DICT_CHAR_SIZE */ +int ZCODE_HEADER_EXT_WORDS; /* (zcode 1.0) requested header extension size */ +int ZCODE_HEADER_FLAGS_3; /* (zcode 1.1) value to place in Flags 3 word */ int NUM_ATTR_BYTES; int GLULX_OBJECT_EXT_BYTES; /* (glulx) extra bytes for each object record */ int32 MAX_NUM_STATIC_STRINGS; @@ -297,6 +299,10 @@ static void list_memory_sizes(void) printf("| %25s = %-7d |\n","MAX_EXPRESSION_NODES",MAX_EXPRESSION_NODES); printf("| %25s = %-7d |\n","MAX_GLOBAL_VARIABLES",MAX_GLOBAL_VARIABLES); printf("| %25s = %-7d |\n","HASH_TAB_SIZE",HASH_TAB_SIZE); + if (!glulx_mode) + printf("| %25s = %-7d |\n","ZCODE_HEADER_EXT_WORDS",ZCODE_HEADER_EXT_WORDS); + if (!glulx_mode) + printf("| %25s = %-7d |\n","ZCODE_HEADER_FLAGS_3",ZCODE_HEADER_FLAGS_3); printf("| %25s = %-7d |\n","MAX_INCLUSION_DEPTH",MAX_INCLUSION_DEPTH); printf("| %25s = %-7d |\n","MAX_INDIV_PROP_TABLE_SIZE", MAX_INDIV_PROP_TABLE_SIZE); @@ -510,6 +516,11 @@ extern void set_memory_sizes(int size_flag) DICT_WORD_SIZE_g = 9; NUM_ATTR_BYTES_z = 6; NUM_ATTR_BYTES_g = 7; + /* Backwards-compatible behavior: allow for a unicode table + whether we need one or not. The user can set this to zero if + there's no unicode table. */ + ZCODE_HEADER_EXT_WORDS = 3; + ZCODE_HEADER_FLAGS_3 = 0; GLULX_OBJECT_EXT_BYTES = 0; MAX_UNICODE_CHARS = 64; MEMORY_MAP_EXTENSION = 0; @@ -622,6 +633,20 @@ static void explain_parameter(char *command) plus three.\n"); return; } + if (strcmp(command,"ZCODE_HEADER_EXT_WORDS")==0) + { printf( +" ZCODE_HEADER_EXT_WORDS is the number of words in the Z-code header \n\ + extension table (Z-Spec 1.0). The -W switch also sets this. It defaults \n\ + to 3, but can be set higher. (It can be set lower if no Unicode \n\ + translation table is created.)\n"); + return; + } + if (strcmp(command,"ZCODE_HEADER_FLAGS_3")==0) + { printf( +" ZCODE_HEADER_FLAGS_3 is the value to store in the Flags 3 word of the \n\ + header extension table (Z-Spec 1.1).\n"); + return; + } if (strcmp(command,"GLULX_OBJECT_EXT_BYTES")==0) { printf( " GLULX_OBJECT_EXT_BYTES is an amount of additional space to add to each \n\ @@ -892,6 +917,10 @@ extern void memory_command(char *command) { NUM_ATTR_BYTES=j, flag=1; NUM_ATTR_BYTES_g=NUM_ATTR_BYTES_z=j; } + if (strcmp(command,"ZCODE_HEADER_EXT_WORDS")==0) + ZCODE_HEADER_EXT_WORDS=j, flag=1; + if (strcmp(command,"ZCODE_HEADER_FLAGS_3")==0) + ZCODE_HEADER_FLAGS_3=j, flag=1; if (strcmp(command,"GLULX_OBJECT_EXT_BYTES")==0) GLULX_OBJECT_EXT_BYTES=j, flag=1; if (strcmp(command,"MAX_STATIC_DATA")==0) diff --git a/tables.c b/tables.c index 2a6f2aa2..54615f12 100644 --- a/tables.c +++ b/tables.c @@ -145,7 +145,7 @@ static int32 rough_size_of_paged_memory_z(void) + 6*32; /* abbreviations table */ total += 8; /* header extension table */ - if (header_ext_setting>3) total += (header_ext_setting-3)*2; + if (ZCODE_HEADER_EXT_WORDS>3) total += (ZCODE_HEADER_EXT_WORDS-3)*2; if (alphabet_modified) total += 78; /* character set table */ @@ -290,8 +290,17 @@ static void construct_storyfile_z(void) /* ------------------- Header extension table ------------------------- */ headerext_at = mark; - headerext_length = 3; /* Usually 3 words long */ - if (header_ext_setting>3) headerext_length = header_ext_setting; + headerext_length = ZCODE_HEADER_EXT_WORDS; + if (zscii_defn_modified) { + /* Need at least 3 words for unicode table address */ + if (headerext_length < 3) + headerext_length = 3; + } + if (ZCODE_HEADER_FLAGS_3) { + /* Need at least 4 words for the flags-3 field (ZSpec 1.1) */ + if (headerext_length < 4) + headerext_length = 4; + } p[mark++] = 0; p[mark++] = headerext_length; for (i=0; i