lanceewing / agi

Original source code of Sierra On-Line's AGI adventure game interpreter. Found in the unused parts of original game disks!
106 stars 4 forks source link

Please check MWC reference. #1

Open bushy555 opened 5 months ago

bushy555 commented 5 months ago

Hi Awesome article.

Any chance to fact check the reference : "Compile: MWC" Wouldn't it make more sense that Mark Crowe may have compiled the entire lot, and that he simply put his initials against the comment 'Compile:' ? Why would the developers want to add the word 'Compile:' with the intiials MWC for the Mark Williams compiler -- as the word 'compile' rather than 'compiler'?. This doesn't make a whole lot of sense.

Mark Crowe (initials) against the word, as in 'Compile: MWC' , compiling the source makes far more sense.

lanceewing commented 5 months ago

Hi @bushy555,

Thanks for the feedback.

I initially had exactly the same thought about MWC being Mark Crowe, and didn't question it for a while. But then I started thinking that it was a bit unusual for someone to comment that they had compiled a file. I don't recall seeing this being done before. So I tried to see if I could discover what Mark's middle name was. In summary, I'm fairly sure now that Mark's middle initial is A, i.e. Mark A Crowe.

This is how I reached that conclusion:

He apparently lives in Eugene, Oregon. This fact is repeated in many places across the Internet, including directly from Mark himself. For example, check out his LinkedIn page:

https://www.linkedin.com/in/mark-crowe-71354965/.

That, unfortunately, doesn't tell us his middle name, or middle initial, on its own. The following interview also mentions him living in Eugene, Oregon:

https://www.ign.com/articles/2014/09/15/spaceventure-the-new-game-from-the-creators-of-space-quest

Another detail is that Mark's partner is called Sandy. Its a bit harder to find that online, but one place you can verify that is in the following interview:

https://www.adventureclassicgaming.com/index.php/site/interviews/729/

One of Scott Murphy's replies mentions Mark and Sandy starting their family.

Armed with those details, i.e. that Mark and Sandy Crowe live in Eugene, Oregon, we can start to search online to see if anything turns up.

Perhaps the most conclusive detail is this patent that Mark appears to have:

https://patentimages.storage.googleapis.com/0f/00/52/9a705402ccdab1/US5320313.pdf https://patents.google.com/patent/US5320313A/en?inventor=Mark+A.+Crowe

The PDF scan of the patent document shows that his name is Mark A. Crowe and it gives his street address in Eugene, Oregon. If we search for that same address online for a bit, you'll see some sites come back with the ownership records of that address. Some of them mention Mark A Crowe and Sandra J Crowe as being the owner. Sandy must be short for Sandra, and indeed some of the search results mention Sandy rather than Sandra. I won't link directly to the individual search results, as I don't want to invade their privacy too much, but if you try searching for that, you'll hopefully find the same.

One of the results is of particular note, because it includes historical addresses in Oakhurst for Mark and Sandy, which is obviously where Sierra On-Line was based back when Mark was working for Sierra. Having linked the same address mentioned in the patent up to a Mark A Crowe who has a partner called Sandra/Sandy, and seeing also the Oakhurst reference, I think that is enough to conclude that the Mark A Crowe mentioned in the patent is the Mark Crowe who worked at Sierra.

Let me know if you agree.

Looking at things from the other angle, i.e. MWC being the initials of the C compiler used, there are several bits of evidence to support this. My article talks only about that long continuous section of supposedly unused sectors on the SQ2 disk. Floppy disks also have something known as "slack space", which is the short section of a sector from the end of a file to the end of the sector. Or perhaps it is the end of the cluster; I can't remember off the top of my head. The point is that it is a short unused bit that can't be used by any other file, due to the way that the File Allocation Table works. It almost always has data in it though, and the scary thing is that it is almost always data that wasn't ever actually on the floppy disk in the past. Due to the way that DOS worked in those days, it would copy things that were previously in its buffers into those unused bits, not intentionally of course, but due to the design of how the copying works. I plan to write another article at some point that goes into the actual details, but that gives you an idea. You'll find plenty of articles online already that cover "slack space".

Long story short, many of the original Sierra game disks have some very interesting snippets of files in their slack space. Some of them, e.g. a King's Quest III original game disk, have fragments of compiled OBJ module files from the AGI interpreter. The format of these OBJ files have a record type near the start that identifies the module name, and another record type that identifies the compiler used. I've found multiple examples of AGI interpreter OBJ module files that state "MWC86 V2.3.8" as the compiler, and the names of the modules are an exact match for files that the SQ2 disk has the C source for. The PRINT module is one example. OBJACT is another. PICTURE is a third example.

Other clues in the slack space of original game disks are the names of several of the Mark Williams Compiler's EXE files. I have found all of the following listed in fragments of DOS directory entries:

CC0.EXE CC1.EXE CC2.EXE CC3.EXE

I guess that's not conclusive, but it does add support to the compiler identification in the OBJ module fragments, i.e. the fact that someone had EXE files on their hard disk (the slack space data quite often comes from files on the hard disk) that match the names of the EXE files that the MWC compiler includes. I also found an MWC.EXE mentioned in a few places but I haven't been able to verify a version of the MWC compiler ever had such an EXE. I've looked over two versions of MWC and neither had that one, but they both had the CC0, CC1, CC2, and CC3 EXE files.

Incidentally, when I tried using the MWC compiler myself within dosbox to compile a C source file, I can see the following in the OBJ module file: MWC86 V3.0.0. That adds a bit more support to the "MWC86 V2.3.8" being from the Mark Williams compiler.

As to why the developers put that in there, I'm not sure. I believe that they were also using the Microsoft C compiler a lot for various other things, so perhaps it was a way to identify these C source files as needing to be compiled by the MWC compiler rather than the Microsoft one. Maybe they had a script that added it? Who knows. Just guessing on the reason, but it does appear to be identifying the compiler.

Btw, I was just looking over your repos. I love that you have one there for the VZ200. I never owned one of those machines, but I remember drooling over it in the local stores when I was growing up. The Aquarius was another one that I similarly wished I had back then.

bushy555 commented 5 months ago

Hi Mate,

Goodness! I didn't mean for you to do any of that research. I feel bad now! I really really wished I had just read all of the source before writing the above question. Makes for some awesome research reading though! As soon as I read SETJMP.H , there's the answer right there.

/*

I do sincerely apologise!

Incidentally Mark Crowe actually joined the SQ facebook group few years back. It was indeed him. However he has since left the group.

Way back in 1993 I was trying to hack/bypass the conditional JMP's in LSL2 and SQ2 sierra.com , since of course they both used the same CRC type copy protection. I recall like it was yesterday, seeing all of this extra text in Nortons NDD, which was of course, all of this source text. I had absolutely no idea what I was looking at though. I didnt even know what C source code even looked like at the time. Using DEBUG I spent days tracing through sierra.com trying to find where to bypass it. Gave up. 12 months later when I had my first internet account, doing a quick search in newsnet , walla, was a semi-well known common thing. NOP out three conditional jumps from memory. I was stoked.

Anyway, thanks for the whole source code thing; Found from hackaday news item last week. And thanks for the VZ comments. I spend far too much time fiddling with z80 asm for this computer these days. cheers

lanceewing commented 5 months ago

No worries. I'd actually done all that research previously, so it was mostly a matter of me typing it up and checking a few things along the way. You've actually given me an idea for a follow up article, which I was thinking of doing anyway, but the "Did Mark Crowe compile Sierra's AGI interpreter?" angle might be a good way to introduce it, as I also had the same thought. I think it is due to JAS being used by Jeff Stephenson in his change history comments. I just assumed MWC was someone's initials.

Regarding that SETJMP.H file, I perhaps shouldn't have added that one. It wasn't on the original SQ2 game disk, but in analysing the AGI.MAP file that does appear on the SQ2 disk, I determined that some of the code must have been linked in from libraries that were not Sierra's own code. I think that at least two of the modules came from the Mark Williams Compiler, that SETJMP module being one of them. It certainly has a header file with that name, and the function names match up. So if Sierra did use MWC to compile with, and if they were including "setjmp.h" in their files, which they were (see below)...:

ERROR.C:#include "setjmp.h"

MAIN.C:#include "setjmp.h"

...then I think it had to have come from MWC rather than them having their own setjmp.h file. For that reason, I added it to the repo.

I've also been able to determine that they used a linker called PLINK86, which came with a library called OVERLAY.LIB. Parts of this have also been linked into AGI.EXE file, in fact the PLINK86 overlay manager is what AGI uses to load those various .OVL files.

I think I might move that SETJMP.H file into a separate folder, with an appropriate name to indicate that it wasn't actually found on an original Sierra game disk. There are other files that I intend to add soon as well, which I'll put into the same folder. I might called it "missing" or something along those lines. The long term goal is to hopefully compile the code using the original tools, i.e. MWC, MASM and PLINK86, for no other reason than to attempt to capture and preserve the way in which Sierra built the AGI interpreter. I think it could be set up as a Github action. I've seen people use dosbox in Github actions, so it would be something along those lines.