[I6] Memory limits

Hi all,

I am pottering round a little I6 game every now and then, and the compiler tells me I’ve used 190 out of 233 global variables. I assume my computer will explode once I reach the limit. What can I do to extend it? The output format is currently z5, so I assume switching to z8 would help. How do I do that? And is there any other option?

Thanks and kind regards,
Grues

You can change them into something that isn’t a global variable.
For example, create an object, and move some of the global variables to properties on that object.

Hrmpf. Okay, I could do that. But I picture myself spending half an hour of improving old code to free up memory for every hour I spend on programming new stuff. Can I have z8? :wink:

This is not a memory limit, it’s an architectural limit of the Z-machine. A global variable reference is an 8-bit number. So Z8 has the same number of global variables as Z5.

What about moving to Glulx?

Thanks @Zarf for the info. Thanks @VictorGijsbers for the inspiration, looking into Glulx requirements now.

[spoiler]

[/spoiler] :wink:

Best regards from Italy,

OTOH, 43 global variables available seem to me a sufficient margin for final touch (aka “varnish & veneer” and post-release debugging & improvements based on feedback.

dott. Piergiorgio.

You can also do what I7 does if necessary: make an array to hold spare variables, and use #defines to give them readable names.

Ah, #define is not an I6 feature, I’m afraid. Unless you push the source code through some kind of preprocessor.

Or constants, rather. Basically the same thing, kinda.

So erm, is adding “-z8” to the .bat file enough to do the trick? I tried, but still get the message that there’s less than 10.000 bytes free in the Z-machine, and the output is still a z5 file.

-v8 should do the trick.

Inform -h2 shows all commandline switches

1 Like

It did! Thank you!!!

(I tried -z8 while -v8 was what I should have used.)