As part of the ongoing “make z3 games as small as possible” retro effort, @heasm66 proposed an Inform 6 compiler option to squash array space down into the global variables segment if the game doesn’t use all 240 global variables.
That is, if the game only uses 32 global variables (let’s say, at addresses $300 to $340), then the first array could start at $340, rather than wasting all the space from $340 to $4E0.
(This requires rearranging how I6 uses globals, but whatever, small matter of programming.)
Henrik says:
There’s precedence for this, for example, look at Hitchhiker’s Guide, r31, 871119 (Solid Gold) that only use 364, istead of 480, bytes for the globals.
So that’s fine as far as it goes. However, when I tested the change with a very small game, I ran into problems:
Global vv1;
Global vv2;
Global vv3;
Global vv4;
Array arr --> 4;
[ Main; ];
Runs in Frotz, but Bocfel (and Gargoyle) throws a consistency check error:
[Fatal error: corrupted story: global variables are not in dynamic memory]
The problem is that there’s only four globals and eight bytes of array space. So the static memory range (ROM) begins inside what the spec says is the global variables segment, even though the compiler knows that it will never touch globals past the fourth one.
The HHGG Solid Gold game file doesn’t have this problem, to be clear. It only uses 182 global variables but it then has plenty of arrays and other RAM data. So Bocfel’s check doesn’t fail. I’m sure the same would be true of any PunyInform game. The error only appears for very small test games.
I guess there’s a few ways we could think about this.
- (1) “This compiler option is stupid, don’t implement it.”
- (2) “Bocfel’s check is a bug; it should be removed.”
- (3) “Very compact Z-code files are meant for retro platforms, so if the game file runs on Ozmoo, there’s no problem.”
- (4) “The compiler should show a warning if you get into this situation. Then the author can decide whether to proceed.”
- (5) “The compiler should nudge up the static memory limit to avoid this situation.”