Author Topic: GAL (KQ1) extractor and decompiler  (Read 9483 times)

0 Members and 1 Guest are viewing this topic.

Offline NewRisingSun

Re: GAL (KQ1) extractor and decompiler
« Reply #15 on: November 04, 2016, 01:47:15 AM »
GALdecompile:
- Corrected the control flow regarding "else" statements.
- Action command definitions as well as variable and object names are now taken from a GAMEDEFS text file which %includes SYSDEFS. That will allow any user to adjust the output for different game versions, and contribute the meaning of the unknown action commands without having to recompile GALdecompile. GAMEDEFS.CGA-1984-08 is the definition file for the August 1984 PC CGA version, which must be renamed to GAMEDEFS to be used by GALdecompile.

GALextract:
- Now adds the proper two-byte header to GAL sound files. GALsnd2vgm modified to account for that.
- Now extracts the WORDS.BIN file from the disk image.
« Last Edit: November 04, 2016, 02:28:31 AM by NewRisingSun »

Offline lance.ewing

Re: GAL (KQ1) extractor and decompiler
« Reply #16 on: November 09, 2016, 06:27:39 PM »
It is interesting to see just how similar the decompiled script from the original KQ1 version is to what was in Donald B. Trivette's February 1985 article.

This is from the article:

Code: [Select]
IF HAS-GOAT 0 AND OBJHIT-EDGE 14 AND EDGEOBJ-HIT 1 AND GOAT-GONE 0 AND SHOWCARROT 0 THEN ASSIGN GOAT-ROOM 11, ERASE 14.

This is from the decompilation of the original KQ1 versions:

Code: [Select]
PC JR:

if (v41==0 && objectHitEdge==14 && edgeObjectHit==2 && v121==0 && v50==0) {
assign(v51,11);
sound(0);
erase(o14);
}

IBM PC and TANDY:

if (v41==0 && objectHitEdge==14 && edgeObjectHit==2 && v122==0 && v52==0) {
assign(v53,11);
sound(0);
erase(o14);
}

So if we take the PC JR example:

v41  = HAS-GOAT
v121 = GOAT-GONE
v50  = SHOWCARROT
v51  = GOAT-ROOM

The edgeObjectHit value is different, and there is an extra sound command in there, but the rest seems to line up quite well. The AGIv2 version of KQ1 is quite different with regards to this particular piece of logic.

Offline lance.ewing

Re: GAL (KQ1) extractor and decompiler
« Reply #17 on: November 18, 2016, 05:06:45 PM »
I've just used the GALtools decompiler with a RM.1 logic extracted from the Apple II version of KQ1 and I can confirm that it decompiled it without issue. There were a few differences in the logic of the script, and the word numbers have been rearranged a bit, but in general it was the same script, and the format was the same as supported by the GAL decompiler.

I find this interesting because Jeff Stephenson was the one that ported KQ1 to the Apple II. The data in the main part I would guess is very similar to the PCJR version of the KQ1 game, so Jeff would have simply been porting the interpreter to the Apple II. What I find interesting is that I'm currently imagining that Jeff was the one that brought about the rather dramatic changes to the interpreter that were introduced with King's Quest 2. NewRisingSun is quite right in that the original KQ1 interpreter is quite different from all other versions of the AGI interpreter that followed. I think we've already established that the interpreter was known as GAL or Game Adaptation Language prior to the release of King's Quest 2, so it seems reasonable that we call the KQ1 interpreter GAL, not only because we know it was called that, but also because of how different it is from the other AGI games. King's Quest 2 and all AGI games that followed were quite comparable to each other (ignoring the fact that in AGIv1 games, vars and flags were the same thing). - Jeff claims that he wasn't involved in writing the original interpreter used with KQ1, so in my mind I'm imagining Jeff porting it to the Apple II and thinking of all these ways in which he could improve the interpreter, and perhaps that was what we saw with KQ2, i.e. the incorporation of his improvements.
« Last Edit: November 18, 2016, 05:08:38 PM by lance.ewing »


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.052 seconds with 23 queries.