Author Topic: GAL (KQ1) extractor and decompiler  (Read 24689 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 »

Offline lance.ewing

Re: GAL (KQ1) extractor and decompiler
« Reply #18 on: October 25, 2023, 07:33:33 PM »
I was revisiting this topic again this evening and I discovered a very interesting thing. Someone added names of people to the end of the WORDS list. It contains the names of six people encoded within the WORDS data, with the first and last names encoded separately. Since Ken and Doug MacNeill share the same surname, then that one appears only once, making a total of eleven words allocated the final 11 word numbers, from hex value 0xC2 to 0xCC:

0xC2: greg
0xC3: rowland
0xC4: ken
0xC5: macneill
0xC6: doug
0xC7: hal
0xC8: schwab
0xC9: arthur
0xCA: abraham
0xCB: charles
0xCC: tingley

i.e. Greg Rowland, Ken MacNeill, Doug MacNeill, Hal Schwab, Arthur Abraham and Charles Tingley.

The best guess then is that Greg Rowland did this, as it doesn't follow any logical order otherwise. My guess is that the person that added these names to the game's words file added their own name first, then the others in the order that they thought of them.

Now, the mystery is, why would someone do this?

I wonder if perhaps the person had been instructed to only include certain names within the official credits screen in the game. Perhaps they felt that it didn't seem right to exclude Arthur Abraham and Hal Schwab, and so they added a kind of hidden "easter egg" credits list at the bottom of the WORDS list.

There is further evidence to support Greg being the person who did this, as there is only one of these "words" that is actually used within the game's room scripts, and that is the word "greg". It isn't configured as a synonym for anything. It is straight out using "greg". I think he might have been playing around with the parser and it ended up in the released game. Or perhaps it was deliberately kept in the game, so that in future years he could say: "Look... if I type "greg rope", then he climbs the rope". Might be an interesting party trick these days!  ;D

For those that haven't heard the name Hal Schwab before, he published a game called "Golf Challenge" through Sierra On-Line in 1982: https://en.wikipedia.org/wiki/Golf_Challenge_(video_game). He would therefore have been around at the time that things were kicking off with the King's Quest project and so may have been involved early on. Given that his name does not appear in the credits list within the game's title screen, then he must have been another one similar to Arthur Abraham that left before the end of the project. Bob Heitman mentioned to me a few years back that the original King's Quest was written by a group under the direction of Hal Schwab, and he believes that it was Greg Rowland who told him this. I hadn't found any other evidence to back this up, until now. Hal really was part of the team, it would seem.

Offline lskovlun

Re: GAL (KQ1) extractor and decompiler
« Reply #19 on: October 25, 2023, 08:13:49 PM »
But Roberta is not mentioned? Or is she encoded elsewhere?

Offline lance.ewing

Re: GAL (KQ1) extractor and decompiler
« Reply #20 on: October 26, 2023, 04:04:28 AM »
Her name appears on the official credits list in the game's title screen, but not in this hidden list at the end of the WORDS data. I guess that whoever added these names was thinking more of those who built it rather than designed it.

I did also spot "chris" and "teresa" in the list of words, but they're not in this same section at the bottom, so not sure why those two are in there. They don't appear to be used in the game scripts.

Immediately above the "build team" list of words (above with regards to word number) is just normal game words, e.g. 0xC1 = "holes", 0xC0 = "floor", 0xBF = "nap", 0xBE = "say", 0xBD = "pluck".

Offline OmerMor

Re: GAL (KQ1) extractor and decompiler
« Reply #21 on: October 26, 2023, 08:36:24 AM »
Very interesting.
Can you write a quick script the dumps all the words that are not referenced by any script? Maybe there are other interesting unused words in AGI games.

Offline Collector

Re: GAL (KQ1) extractor and decompiler
« Reply #22 on: October 26, 2023, 09:20:19 AM »
Would that "Chris" be Chris Iden?
KQII Remake Pic

Offline lskovlun

Re: GAL (KQ1) extractor and decompiler
« Reply #23 on: October 26, 2023, 09:25:47 AM »
Would that "Chris" be Chris Iden?
And Teresa Baker perhaps (see the 1988 Christmas Card)? But this is quite the rabbit hole. I've never heard of Hal Schwab before.

Offline lance.ewing

Re: GAL (KQ1) extractor and decompiler
« Reply #24 on: October 26, 2023, 12:31:47 PM »
Very interesting.
Can you write a quick script the dumps all the words that are not referenced by any script? Maybe there are other interesting unused words in AGI games.

I had the same thought, and I might do this later on as a general tool for AGI V2/3, perhaps as a pop-up within AGILE that shows all unused words in the running game. But as its the original 1984 PCJR "GAL" version of King's Quest that I'm currently looking at, AGILE doesn't yet support that. I have run my eye over the word list a number of times and can't see anything else that stands out. It would be interesting though to see a list of unused words for each AGI game and then make some guesses as to why the words were added but ultimately not used.

Offline lance.ewing

Re: GAL (KQ1) extractor and decompiler
« Reply #25 on: October 26, 2023, 01:17:15 PM »
Would that "Chris" be Chris Iden?

I had the same thought about this one as well. I've spoken to Chris Iden a few times and he assures me that he wasn't part of the original IBM PCJR King's Quest project team. He was, however, the programming department manager for a few months, roughly from the start of September 1983 for about three months. He was based in the programmer's office behind Ponderosa Printing, which was not where the King's Quest project team were based (they were in a secure office about 300 yards along the road). So Chris was the line manager of the programmers on the KQ team for those few months at the end of 1983, but not directly involved in the project itself. Perhaps one of the KQ programmers added his name to the word list for some reason.

Chris Iden was definitely involved with the releases of King's Quest after that original May 1984 releases though. His name appears in the credits of the August 1984 IBM PC release, and also the Tandy release:

https://nerdlypleasures.blogspot.com/2017/04/the-evolution-of-kings-quest.html

but not in the two May 1984 releases.

I have compared the WORDS data from the original PCJR version, IBM PC version from Aug 1984, and the Tandy version, and the WORDS data is identical across all three. If I can trust the PCJR disk image that I have, then that would seem to indicate that the "chris" word was already in the WORDS data in the May 1984 release.

Offline lance.ewing

Re: GAL (KQ1) extractor and decompiler
« Reply #26 on: October 29, 2023, 08:38:39 AM »
I found the following in the 1984 IBM PC booter version of KQ, and also in the TANDY version, but it doesn't appear in the original PCJR version, suggesting that Greg added it after the initial PCJR release:

Code: [Select]
if (curRoom!=10 && curRoom!=11) {
        if (said(greg,!) && v26==0 && v30==0) {
                set(ducking);
                ignore.blocks(ego);
                op65(87);
                end.of.loop(ego);
                assign(v43,2);
        }
        if (said(jump,!) && v26==0) {
                set(jumping);
        }
}

And sure enough, if you run those versions in Dosbox, and you type "greg" in any room that isn't 10 or 11 (those are the goat enclosure rooms), then Graham does the ducking motion.

Charles Tingley's LinkedIn mentions that his contract with Sierra ended in May 1984, but I suspect that it was actually Greg that was preparing the final releases in May 1984. There are a couple of places online where Greg has commented that he was "the last man standing" on the King's Quest project, so both the hidden credits list, and the easter egg mentioned immediately above, might be a bit of evidence to support that.

Hmmm... just a thought. I wonder if this little easter egg is an attempt to show that Greg was the "last man standing", visually. The player types in "greg" and then Graham crouches down and then stands up. I wouldn't be surprised if it was. Perhaps we can call this "the last man standing" easter egg.  :D


Offline Collector

Re: GAL (KQ1) extractor and decompiler
« Reply #27 on: October 29, 2023, 09:04:28 AM »
I just tried it and indeed he does kneel down.
KQII Remake Pic

Offline lance.ewing

Re: GAL (KQ1) extractor and decompiler
« Reply #28 on: October 29, 2023, 10:03:00 AM »
Yes, and if you try it in the PCJR version, you'll notice that it doesn't do anything.

I think that the 1984 IBM PC version I have is the later 16th August release. I don't have the 30th May 1984 release. Which one did you try? If you have the 30th May 1984 release, then can you test if it works on that one?

Greg must have added this after the 10th May 1984 PCJR release, but the question is whether it was only just after, and therefore is in the 30th May release, or whether it was added later on and included in the 16th August release.

Offline Collector

Re: GAL (KQ1) extractor and decompiler
« Reply #29 on: October 29, 2023, 06:51:57 PM »
I have four booter images. The one that starts composite color mode does. The PCjr copy does not. The Tandy/PCjr and the Tandy do. Curious thing about the Tandy versions is that Graham stays crouching, while in the composite color one he bobs right back up.

I wish I could give you more info about the various versions, but since all of the files are in the images I am at a loss to how to get any more info from them. I wish I had a way to extract the files.
KQII Remake Pic


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

Page created in 0.036 seconds with 23 queries.