AGI Information
By Nick Sonneveld
Last updated 23/2/2001
23/2/2001
On the current
AGI Messageboard there was a
discussion about a "stack blown error" in the same thread where an author
of a new AGI game (Pimp Quest) had just announced the release of a new demo
and website.
Users of Windows were getting this error.
There were a lot of attempts to explain this error. Most
Sierra AGI games work just under Windows. The reason why I think
this stack error occurs is because (kinda obviously) the stack is being filled
up. The culprits are the AGI itself (because it is filling around a
brushed object in the Pimp Quest title screen.. so there's lots of little
lines to fill up and all these lines get pushed onto stack) and Windows.
I'm not quite sure, but I think Windows has some sort of timer running in
DOS mode that is called and pushes a bit too much on the stack.
So while the picture fill routine has a lot
of information pushed onto the stack, Windows pushes some extra stuff on
and the stack overflows. AGI actually checks
if the head of the stack is overwritten and so trips this stack error in
the middle of a screen write.
Solutions:
1) Don't create a stack heavy picture.
Don't fill around brushed objects. In the Pimp Quest case, you should
fill the screen first before drawing in the title with the brush. Here's
the actual modified picture file.

Bad picture. (filled after)

Good picture. (filled before)
2) Don't use Windows
You could go straight into pure DOS if you *really* wanted to. This
isn't very helpful if you're using
AGI Studio as your main editor.
3) Patch the Interpreter
This is what I kinda wrote myself. I wrote a small patch program (that
will only work in Windows.. I used MinGW
as my compiler) that lets you change the stack size in the interpreter.
It's usually 0xA00 bytes (in all interpreter's I have checked).
The cool thing about this program is that it works with all the versions
of Sierra's interpreter that I have checked. (including v3!) The stack
code didn't vary much over the different versions.
Steps:
1) Get a working AGI file. Try Demo Pack 3 that you can get from
The Ultimate AGI & SCI Web Site which is version 2.917 . There
is a later v2.936 interpreter which comes with some versions of SQ2 and KQ3
but isn't freely available without breaking some copyright law.
2) Uncompress AGI executable file. Sierra encrypted their interpreters most
of the time and some (like the demo pack 3) aren't encrypted. Use SUP
(available from Ultimate AGI again) to insert a key into SIERRA.COM and the
adecrypt (ditto) to decrypt the AGI file.
3) Run stackpatch.exe. The proper way to run it is:
stackpatch agi.exe 0xA00
where agi.exe is the interpreter and 0xA00 is the stack size to change.
0xA00 is the AGI default. If you get a stack error, try increasing
it to 0xB00 or 0xC00
4) Play with your working game.
Anyway, if you want more information, check out this
discussion that had all this information (except about the patch) and
probably a bit more.
Files:
stackpatch try this stuff man
modified agi 2.936 with stack set to
0xC00. Works with Pimp Quest on my computer.
modified PIC file for the title
Links:
to do later....
agi messageboard
other games
ultimate site
ice
vortex
The Ultimate AGI & SCI Web Site
http://www.geocities.com/smithgdwg/Smithgdwg_World.html