diff --git a/guide/appendices/appendix-d-compiler-memory-settings.md b/guide/appendices/appendix-d-compiler-memory-settings.md index c45b13a..54e508a 100644 --- a/guide/appendices/appendix-d-compiler-memory-settings.md +++ b/guide/appendices/appendix-d-compiler-memory-settings.md @@ -159,6 +159,9 @@ that the compiler can substitute with single-byte tokens in Z-encoded text, saving space. The Z-machine specification limits this to 96. This setting is not meaningful in Glulx, where abbreviations are unlimited. +`MAX_ABBREVS` and `MAX_DYNAMIC_STRINGS` must sum to exactly 96 in Z-code, so +raising one requires lowering the other. + ```inform6 !% $MAX_ABBREVS=96 Abbreviate "the "; @@ -319,6 +322,9 @@ referenced in strings with the `@00` through `@31` syntax (or `@(N)` for higher numbers). The `string` statement assigns text to these variables at runtime. In Z-code the maximum is 96. +`MAX_DYNAMIC_STRINGS` and `MAX_ABBREVS` must sum to exactly 96 in Z-code, so +raising one requires lowering the other. + ```inform6 !% $MAX_DYNAMIC_STRINGS=64 ``` diff --git a/guide/appendices/appendix-g-system-constants-reference.md b/guide/appendices/appendix-g-system-constants-reference.md index 7a49663..199ab0a 100644 --- a/guide/appendices/appendix-g-system-constants-reference.md +++ b/guide/appendices/appendix-g-system-constants-reference.md @@ -81,7 +81,7 @@ classes. | `highest_object_number` | Z/G | The highest valid object number. The valid range of object numbers is `#lowest_object_number` through `#highest_object_number` inclusive. | | `lowest_class_number` | Z/G | Always 0. Classes are numbered starting from 0. | | `highest_class_number` | Z/G | The index of the last class, equal to (total classes) − 1. | -| `class_objects_array` | Z/G | Address of the class-numbers table. This table maps class indices to their corresponding object numbers. On Glulx, the address is in RAM. | +| `class_objects_array` | Z | Address of the class-numbers table. This table maps class indices to their corresponding object numbers. | --- @@ -209,7 +209,7 @@ error when `$OMIT_SYMBOL_TABLE` is set. | Constant | VM | Description | |----------|-----|-------------| -| `lowest_global_number` | Z/G | Always 16. On the Z-machine, globals 0–15 are reserved for the VM's local variable area. User globals start at index 16. | +| `lowest_global_number` | Z | Always 16. On the Z-machine, globals 0–15 are reserved for the VM's local variable area. User globals start at index 16. | | `highest_global_number` | Z | The index of the last global variable, equal to 16 + (total user globals) − 1. | | `globals_array` | Z/G | Address of the global variables area. On Z-machine, this is the variables offset. On Glulx, this is the variables offset. | | `global_names_array` † | Z | Address of the global-names table. | @@ -253,11 +253,11 @@ targeting Glulx, and vice versa. `attribute_names_array`, `highest_property_number`, `property_names_array`, `highest_routine_number`, `routines_array`, `routine_names_array`, `routine_flags_array`, -`highest_global_number`, `global_names_array`, +`lowest_global_number`, `highest_global_number`, `global_names_array`, `global_flags_array`, `highest_array_number`, `arrays_array`, `array_names_array`, `array_flags_array`, `highest_constant_number`, `constants_array`, -`constant_names_array`, `oddeven_packing`. +`constant_names_array`, `class_objects_array`, `oddeven_packing`. **Glulx only**: @@ -273,10 +273,9 @@ targeting Glulx, and vice versa. `action_names_array`, `lowest_fake_action_number`, `highest_fake_action_number`, `fake_action_names_array`, -`lowest_routine_number`, `lowest_global_number`, `globals_array`, +`lowest_routine_number`, `globals_array`, `lowest_array_number`, `lowest_constant_number`, `lowest_class_number`, `highest_class_number`, -`class_objects_array`, `lowest_object_number`, `highest_object_number`, `grammar_table`, `dictionary_table`, `highest_meta_action_number`. diff --git a/guide/appendices/appendix-k-inform6-bnf-grammar.md b/guide/appendices/appendix-k-inform6-bnf-grammar.md index c29b04b..869586b 100644 --- a/guide/appendices/appendix-k-inform6-bnf-grammar.md +++ b/guide/appendices/appendix-k-inform6-bnf-grammar.md @@ -368,7 +368,9 @@ abbreviate-directive ``` Declares one or more abbreviation strings for Z-machine text compression. -Maximum 96 abbreviations in Z-code (64 in version 3). +The hard ceiling is 96 abbreviations in Z-code; the default `$MAX_ABBREVS` +setting is 64, and the 96-slot pool is shared with `$MAX_DYNAMIC_STRINGS`. +Not supported in Glulx mode. ### §K.3.3 Array diff --git a/guide/part1-language/ch04-expressions-and-operators.md b/guide/part1-language/ch04-expressions-and-operators.md index 48c6fdc..5def94d 100644 --- a/guide/part1-language/ch04-expressions-and-operators.md +++ b/guide/part1-language/ch04-expressions-and-operators.md @@ -50,8 +50,8 @@ a branch jumps past the right operand; for `||`, if the left operand is true, a branch jumps past the right operand. At the constant-folding level, the compiler also applies short-circuit -rules: `0 && ` folds to 0, and `1 || ` folds to 1, -without evaluating the right-hand expression. +rules: `0 && ` folds to 0, and any non-zero constant `|| +` folds to 1, without evaluating the right-hand expression. ## 4.2 Arithmetic Operators diff --git a/guide/part1-language/ch07-objects-classes-inheritance.md b/guide/part1-language/ch07-objects-classes-inheritance.md index def9b4a..577423a 100644 --- a/guide/part1-language/ch07-objects-classes-inheritance.md +++ b/guide/part1-language/ch07-objects-classes-inheritance.md @@ -190,9 +190,10 @@ The number of common properties is limited: `Property`). The standard library declares 47 with `Property`, which together with `name` gives 48 user-visible common properties. - **Glulx**: Limit depends on the `INDIV_PROP_START` setting (default - 256), so by default common properties are numbered 1–255. In - practice the limit is much higher than the standard library - requires. + 256), so by default common property numbers run 1–255 (`INDIV_PROP_START - 1`), + of which `INDIV_PROP_START - 3` (default 253, including the built-in `name`) + are user-declarable. In practice the limit is much higher than the + standard library requires. A default value can be set: @@ -679,11 +680,11 @@ Restrictions on `private`: | Limit | Z-machine | Glulx | |---|---|---| | Maximum objects | 255 (v3); v4+ limited only by memory | Limited only by memory | -| Maximum common properties | 31 (v3, of which 29 are user-declarable), 63 (v4+, of which 61 are user-declarable) | `INDIV_PROP_START - 1` (default 255) | +| Maximum common properties | 31 (v3, of which 29 are user-declarable), 63 (v4+, of which 61 are user-declarable) | `INDIV_PROP_START - 1` (default 255), of which `INDIV_PROP_START - 3` (default 253) are user-declarable | | Maximum attributes | 32 (v3), 48 (v4+) | `NUM_ATTR_BYTES × 8` (default 56, max 312) | | Maximum data per common property | 8 bytes / 4 words (v3), 64 bytes / 32 words (v4+) | 32768 values per property | | Maximum data per individual property | 64 bytes / 32 words | 32768 values per property | -| Maximum classes | Limited only by the maximum number of objects (every class is itself an object and consumes an object-number slot, so on v3 the four built-in metaclasses plus all user classes share the 255-object cap) | Limited only by memory (every class is an object and consumes an object-number slot) | +| Maximum classes | Capped at 256 by the compiler (`VENEER_CONSTRAINT_ON_CLASSES_Z`), and additionally capped by the object limit (on v3, four built-in metaclasses plus all user classes share the 255-object cap) | Capped at 32768 by the compiler (`VENEER_CONSTRAINT_ON_CLASSES_G`); every class is an object and consumes an object-number slot | --- diff --git a/guide/part1-language/ch10-compiler-directives.md b/guide/part1-language/ch10-compiler-directives.md index 60a6457..20165a9 100644 --- a/guide/part1-language/ch10-compiler-directives.md +++ b/guide/part1-language/ch10-compiler-directives.md @@ -597,8 +597,11 @@ Abbreviate "ing "; Abbreviations reduce the size of encoded text in the story file. The compiler substitutes frequently occurring strings with compact tokens. -> **[Z-machine]** The compiler enforces a hard limit of **96** -> abbreviations for all Z-machine versions it targets (3 and later). +> **[Z-machine]** The compiler defaults to a limit of **64** +> abbreviations (controlled by `$MAX_ABBREVS`, which defaults to 64). +> The hard ceiling is **96**: `$MAX_ABBREVS` may be raised up to 96, but +> `$MAX_ABBREVS` and `$MAX_DYNAMIC_STRINGS` must sum to exactly 96, so +> raising one requires lowering the other (their defaults are 64 and 32). > As of compiler 6.42, abbreviation strings may be of any length > (earlier versions limited them to 64 characters). diff --git a/guide/part2-compiler/ch12-compiler-switches.md b/guide/part2-compiler/ch12-compiler-switches.md index 5f87d2a..f765257 100644 --- a/guide/part2-compiler/ch12-compiler-switches.md +++ b/guide/part2-compiler/ch12-compiler-switches.md @@ -479,8 +479,8 @@ text data: | ------- | -------------- | ------------- | ----------- | | `$DICT_WORD_SIZE` | 6 | 9 | Number of characters stored per dictionary word. Z-code words beyond this length are silently truncated. Increasing this value in Glulx allows the parser to distinguish longer words. | | `$DICT_CHAR_SIZE` | 1 | 1 | Bytes per character in dictionary words. Set to 4 in Glulx to support full Unicode dictionary entries. In Z-code, this is always 1. | -| `$MAX_ABBREVS` | 64 | 64 | Maximum number of `Abbreviate` directives. Z-code has a hard upper limit of 96. | -| `$MAX_DYNAMIC_STRINGS` | 32 | 100 | Maximum number of string substitution variables (`@00`, `@(0)`, etc.). Z-code has a hard upper limit of 96. | +| `$MAX_ABBREVS` | 64 | N/A | Maximum number of `Abbreviate` directives. Z-code only; not meaningful in Glulx. In Z-code, `$MAX_ABBREVS` and `$MAX_DYNAMIC_STRINGS` share a pool of exactly 96 slots and must sum to 96. | +| `$MAX_DYNAMIC_STRINGS` | 32 | 100 | Maximum number of string substitution variables (`@00`, `@(0)`, etc.). In Z-code, `$MAX_ABBREVS` and `$MAX_DYNAMIC_STRINGS` share a pool of exactly 96 slots and must sum to 96. | ### 12.4.4 Grammar and Action Settings diff --git a/guide/part2-compiler/ch15-compiler-limits.md b/guide/part2-compiler/ch15-compiler-limits.md index 64ae5ed..c02ab01 100644 --- a/guide/part2-compiler/ch15-compiler-limits.md +++ b/guide/part2-compiler/ch15-compiler-limits.md @@ -119,11 +119,13 @@ Several additional limits apply across all Z-machine versions: - **Global variables:** All versions support a maximum of 240 globals. -- **Abbreviations:** The Z-machine supports a maximum of 96 - abbreviations (though the compiler default `$MAX_ABBREVS` is 64). - -- **Dynamic strings:** Z-code supports a maximum of 96 dynamic string - variables (`@00` through `@95`). +- **Abbreviations and dynamic strings:** The Z-machine allocates a + shared pool of exactly 96 slots for these two features combined. + The defaults are `$MAX_ABBREVS=64` and `$MAX_DYNAMIC_STRINGS=32` + (summing to 96). If only one value is changed, the compiler + automatically adjusts the other to keep the sum at 96; if both are + set to values that do not sum to 96, the compiler warns and resets + both to their defaults. - **Property values per property:** A single property may hold at most 32,768 values (entries) on either platform. This is a compiler-imposed @@ -512,7 +514,7 @@ trade-offs: | Max attributes | 48 | 48 | 56+ (configurable) | | Max properties | 63 | 63 | No hard limit | | Integer size | 16-bit | 16-bit | 32-bit | -| Local variables | 15 | 15 | 119 | +| Local variables | 15 | 15 | 118 | | Dictionary resolution | 9 chars | 9 chars | Configurable | | Interpreter support | Excellent | Good | Good | | Multimedia | Limited | Limited | Full (via Glk) | diff --git a/guide/part3-library/ch26-library-entry-points.md b/guide/part3-library/ch26-library-entry-points.md index 95e0d76..3d001ea 100644 --- a/guide/part3-library/ch26-library-entry-points.md +++ b/guide/part3-library/ch26-library-entry-points.md @@ -107,7 +107,7 @@ and before the first `Look`. |------ |---------------------------------------------------------- | | 0 | Print the banner, then perform an initial `Look`. | | 1 | Print the banner, then perform an initial `Look` (same as 0). | -| 2 | Do not print the banner or perform an initial `Look`. | +| 2 | Do not print the banner. The initial `Look` is still performed (unless `NOINITIAL_LOOK` is defined). | **Typical usage:** @@ -123,8 +123,10 @@ and before the first `Look`. - The `location` variable *must* be set to a valid room object before `Initialise` returns, or the game will crash. - If `Initialise` prints any text, it appears before the banner. -- A return value of 2 is useful when the game wants to display a - custom title screen before normal play begins. +- A return value of 2 is useful when the game provides its own banner + output inside `Initialise` and wants to suppress the library's default + banner. The initial `Look` still runs; to suppress that too, compile + with `Constant NOINITIAL_LOOK;` before including the library. ## 26.3 `BeforeParsing()` diff --git a/guide/part4-vm/ch30-glulx-architecture.md b/guide/part4-vm/ch30-glulx-architecture.md index 95bfceb..b76ad09 100644 --- a/guide/part4-vm/ch30-glulx-architecture.md +++ b/guide/part4-vm/ch30-glulx-architecture.md @@ -493,7 +493,7 @@ over 130 opcodes organised into the following categories: | Search | 0x0150–0x0152 | 3 | Linear, binary, and linked list search | | Memory/heap | 0x170–0x179 | 4 | Zero, copy, malloc, free | | Acceleration | 0x180–0x181 | 2 | Register accelerated functions | -| Floating point | 0x190–0x1C9 | 26 | Single-precision IEEE-754 operations | +| Floating point | 0x190–0x1C9 | 29 | Single-precision IEEE-754 operations | | Double precision | 0x200–0x239 | 32 | Double-precision IEEE-754 operations | ### 30.7.3 Feature-Gated Opcode Groups @@ -702,7 +702,7 @@ Z-machine produces an error. ### 30.9.3 Single-Precision Opcodes -Twenty-six opcodes provide single-precision floating-point operations. +Twenty-nine opcodes provide single-precision floating-point operations. These are gated behind the `GOP_Float` feature flag and require Glulx version 3.1.2 or later. The opcodes fall into several groups: diff --git a/guide/part4-vm/ch31-glulx-instruction-set.md b/guide/part4-vm/ch31-glulx-instruction-set.md index 747b273..2518ba6 100644 --- a/guide/part4-vm/ch31-glulx-instruction-set.md +++ b/guide/part4-vm/ch31-glulx-instruction-set.md @@ -898,17 +898,17 @@ function. Common selectors include: | Selector | Glk Function | Description | |---|---|---| | `$0004` | `glk_gestalt` | Query Glk capabilities. | -| `$0040` | `glk_window_iterate` | Iterate over windows. | -| `$0047` | `glk_window_open` | Open a new window. | -| `$002F` | `glk_window_get_size` | Get window dimensions. | +| `$0020` | `glk_window_iterate` | Iterate over windows. | +| `$0023` | `glk_window_open` | Open a new window. | +| `$0025` | `glk_window_get_size` | Get window dimensions. | | `$0080` | `glk_put_char` | Output a single character. | | `$0081` | `glk_put_char_stream` | Output a character to a stream. | -| `$0086` | `glk_put_buffer` | Output a buffer of characters. | +| `$0084` | `glk_put_buffer` | Output a buffer of characters. | | `$00A0` | `glk_char_to_lower` | Convert character to lowercase. | | `$00D0` | `glk_request_line_event` | Request line input. | | `$00D2` | `glk_request_char_event` | Request character input. | -| `$00E0` | `glk_select` | Wait for and retrieve an event. | -| `$0160` | `glk_fileref_create_by_prompt` | Prompt user for a file. | +| `$00C0` | `glk_select` | Wait for and retrieve an event. | +| `$0062` | `glk_fileref_create_by_prompt` | Prompt user for a file. | These selectors are defined in the `infglk.h` header file. The complete set of selectors is documented in the Glk specification. diff --git a/guide/part5-advanced/ch33-internationalization-localization.md b/guide/part5-advanced/ch33-internationalization-localization.md index c81f985..b0904c8 100644 --- a/guide/part5-advanced/ch33-internationalization-localization.md +++ b/guide/part5-advanced/ch33-internationalization-localization.md @@ -737,7 +737,7 @@ extension table. - The Z-machine can support at most 97 extra characters (ZSCII 155–251) beyond the base Latin-1 set. - Unicode characters beyond U+FFFF cannot be placed in the ZSCII table. -- Alphabet A2 has 21 replaceable positions. Positions 0–2 are reserved for +- Alphabet A2 has 21 replaceable positions. Positions 0 and 1 are reserved for shift characters, and three positions (`.`, `,`, and `~` at positions 12, 13, and 19) are protected as essential punctuation, but the remaining 21 positions (digits 0–9 and miscellaneous punctuation) may be replaced.