Author Topic: Pre-AGI2 versions  (Read 23705 times)

0 Members and 1 Guest are viewing this topic.

Offline lance.ewing

Pre-AGI2 versions
« on: October 19, 2016, 05:49:09 PM »
How many AGI versions are we aware of prior to the introduction of AGI 2?

Recently I've seen:

v1.10: User by the Apple II version of King's Quest 2
v1.12: Used by the original booter PC versions of Black Cauldron
v1.20: Used by the Apple II version of Black Cauldron

I'm pretty sure there must be others.

What version of AGI did the original booter PC versions of King's Quest 2 use?



Offline lskovlun

Re: Pre-AGI2 versions
« Reply #1 on: October 19, 2016, 06:22:31 PM »
Are these numbers even comparable? I hate to be the one to ask all these questions, but at least in SCI, each platform seems to have had its own versioning scheme. That's one reason why ScummVM dropped the idea of using version numbers directly, as we had done in FreeSCI (another reason being unmarked interpreters - x.yyy.zzz - and partially textual version numbers, such as T.A00.081; I never did find out what lay behind these).

Offline Collector

Re: Pre-AGI2 versions
« Reply #2 on: October 19, 2016, 10:40:16 PM »
The HWM list IDs 5. With the addition of Apple and Atari 9 KQ1.

http://agiwiki.sierrahelp.com/index.php?title=Sierra_AGI_Release_List#AGI1

ETA: Also of note is that he calls KQ1 "AGI0"
« Last Edit: October 19, 2016, 10:56:15 PM by Collector »
KQII Remake Pic

Offline NewRisingSun

Re: Pre-AGI2 versions
« Reply #3 on: October 20, 2016, 01:32:10 PM »
Quote
What version of AGI did the original booter PC versions of King's Quest 2 use?
Unfortunately, it does not print a version number when entering the debug mode, nor is there any version string in the data segment. Version 1.0W's executable however differs from version 1.1H's, so there must be at least two non-numbered versions.

I have managed to extract the resources from version 1.0W and recompile the VOL.X packages so that I can open it in AGI Studio. The picture and view resources open flawlessly (so you know I did not goof in compiling the VOL.X files); the sound resources are known to be in a different format --- Sierra accidently left a utility on the SQ1 1.1A disk to convert sounds to the AGI v2 format --- but the logic resources cannot be decoded at all, and obviously, the game doesn't run when fit with a v2 interpreter.
« Last Edit: October 20, 2016, 01:37:54 PM by NewRisingSun »

Offline lance.ewing

Re: Pre-AGI2 versions
« Reply #4 on: October 20, 2016, 01:58:31 PM »
Are these numbers even comparable?

Looking at the link that Collector provided, then I'd say no.   :(

That's unfortunate. Clearly the Atari ST version of Donald Duck's Playground can't be using version 1.00C of the Interpreter, in fact given the release date, we'd expect that to actually be AGI v2. So either that number is wrong, or the numbering restarted on the Atari ST platform.

I'm surprised that the Apple II version of KQ1 is also v1.10 of the interpreter. KQ2 on Apple II also uses v1.10. I might need to go and double check that now to make sure I was looking at the right game. Did the two games come out at roughly the same time on that platform?

I have hopes that perhaps the Apple II versioning is in alignment with the versioning used for the PC variants, but perhaps this isn't the case. We'll never know I guess.

Offline lance.ewing

Re: Pre-AGI2 versions
« Reply #5 on: October 20, 2016, 02:08:54 PM »
I have managed to extract the resources from version 1.0W and recompile the VOL.X packages so that I can open it in AGI Studio. The picture and view resources open flawlessly (so you know I did not goof in compiling the VOL.X files); the sound resources are known to be in a different format --- Sierra accidently left a utility on the SQ1 1.1A disk to convert sounds to the AGI v2 format --- but the logic resources cannot be decoded at all, and obviously, the game doesn't run when fit with a v2 interpreter.

I've done something similar for the Apple II KQ2 game, but rather than rebuild a whole VOL, I instead extracted a couple of PICTURE and VIEW resources. These also loaded flawlessly in to AGI Studio. But the LOGIC resources I tried did not. I didn't even try a SOUND because I knew it was a different format.

So there's a mystery around the LOGIC then. It looks to be similar to the AGI v2 LOGIC format. I can see the test sections and even test command patterns that I recognise. I'll take a closer look when I get a bit more time.

Offline NewRisingSun

Re: Pre-AGI2 versions
« Reply #6 on: October 20, 2016, 05:01:53 PM »
Quote
I'm surprised that the Apple II version of KQ1 is also v1.10 of the interpreter. KQ2 on Apple II also uses v1.10. I might need to go and double check that now to make sure I was looking at the right game.
Please check again, because that seems highly unlikely, given that all text is in the clear on the KQ1 Apple disk but Avis-Durgan-encrypted on the KQ2 Apple disks. (And my KQ2 Apple disk says AGI v1.08, not 1.10.)

Of course, we also may be dealing with several versions of the same game having come out on the Apple II, just like on the PC, in case of which everyone would be correct. I would definitely insist however on not mixing version numbers --- interpreter or game --- from different platforms, otherwise we're creating a mess.
« Last Edit: October 20, 2016, 05:07:54 PM by NewRisingSun »

Offline Kawa

Re: Pre-AGI2 versions
« Reply #7 on: October 20, 2016, 05:41:56 PM »
otherwise we're creating a mess.
Too late.

Offline lance.ewing

Re: Pre-AGI2 versions
« Reply #8 on: October 20, 2016, 07:31:28 PM »
Please check again, because that seems highly unlikely, given that all text is in the clear on the KQ1 Apple disk but Avis-Durgan-encrypted on the KQ2 Apple disks. (And my KQ2 Apple disk says AGI v1.08, not 1.10.)

We appear to have different KQ2 Apple II disks. I've just checked it again and my one is definitely saying 1.10 for the interpreter version and 1.0H for the game version.

Offline lance.ewing

Re: Pre-AGI2 versions
« Reply #9 on: October 21, 2016, 05:57:29 PM »
I would definitely insist however on not mixing version numbers --- interpreter or game --- from different platforms, otherwise we're creating a mess.

I think I'm starting to agree with this. I'm going to take the BC PC versions out of my original post list and stick to the Apple II versions for now.

So we have:

v1.08 Used by King's Quest 2 version 1.0G
v1.10 Used by King's Quest 2 version 1.0H and King's Quest 1 version 2.0C
v1.20 Used by Black Cauldron (not sure what version)

The main reason for laying out the above is to highlight that the shared 1.10 version between KQ1 and KQ2 seems to be due to the fact that the KQ1 is a version 2.0 of the game. The original 1.0 version of KQ would not have been on that version of the interpreter.

This is actually very interesting. The KQ2 1.0H version that I've been looking at looks very AGI like. The PICTURE format is identical. The VIEW format is identical. The LOGIC format, although not compatible with AGI Studio, still looks to be using a recognisable AGI LOGIC structure (I'm guessing that some of the action and test commands have changed in some way). Is there a version of KQ1 out there somewhere for the Apple II (i.e. KQ1 version 2.0C) where the data looks as AGI-like as this? Probably very rare these days.

Offline lance.ewing

Re: Pre-AGI2 versions
« Reply #10 on: October 21, 2016, 06:04:07 PM »
So there's a mystery around the LOGIC then. It looks to be similar to the AGI v2 LOGIC format. I can see the test sections and even test command patterns that I recognise. I'll take a closer look when I get a bit more time.

I've found a fairly short LOGIC in the Apple II KQ2 that I'm going to try to work out by hand. AGI Studio complains that it has an unknown test command. I guess my first thought in response to that is that maybe one of the test commands has a different number of parameters in this version. Or it could be that the test commands have been reassigned numbers. I'm surprised though that it got to position 0x0086 in to the LOGIC file before it complained. Seems like there might not be too many changes then.

Offline lance.ewing

Re: Pre-AGI2 versions
« Reply #11 on: October 21, 2016, 08:54:57 PM »
So it turns out that the LOGIC I chose is for room 1 of KQ2.

The general structure is the same, in that the FF, FE, FD, and FC codes are doing the if, else, !, || and &&. The size of the if block is handled the same as well.

Some of the test commands have the same code, e.g. 07 is still testing a flag value and 01 a variable value. But posn appears to have a different code, and that means others will as well.

The action command codes are quite a bit different. Variable assignment has the same code but new.room has a different code, as do most of the others.

Still working through it.

Edit:

The flags are in different places as well. For example, the init.log flag mentioned in the AGI.DOC. This is flag 5 in AGIv2 but is flag 13 in what I'm currently looking at. At the moment it is an assumption that flag 13 is init.log given that it is tested at the start of every room in the same way that flag 5 is in the AGIv2 games.

Edit Edit:

Some examples of commands with different codes: The new.room command is 0x12 in AGIv2 but is 0x0B in the Apple II KQ2 game. The position command is 0x25 in AGIv2 but is 0x18 in the Apple II KQ2.
« Last Edit: October 22, 2016, 05:31:01 AM by lance.ewing »

Offline lance.ewing

Re: Pre-AGI2 versions
« Reply #12 on: October 22, 2016, 01:07:33 PM »
This is my current best effort of working through LOGIC.1 in the Apple II KQ2 1.0H game:

Code: [Select]
[
[ Apple II - KQ2 1.0H - ROOM 1 (STARTING ROOM - BEACH)
[
[ v0 = (no idea at present)
[ v1 = Current room
[ v2 = Previous room
[ v3 = Edge ego hit
[
[ v20 = Used to work with ego X pos
[ v21 = Used to work with ego Y pos
[

ff 07 0d ff                  if (isset(init.log)) {
6d 00
  58 00 00                     [ Unknown. Something done to ego maybe?
  38 01                        load.pic(v1);
  36 98                        load.logics(152);   [ Beach logic
  36 65                        load.logics(101);   [ Swimming logic
  09 01                        load.view(1);       [ Splashing wave
  09 61                        load.view(97);      [ Ego Swimming
  09 68                        load.view(104);     [ Ego drowning
  09 41                        load.view(65);      [ Magic lamp
  09 62                        load.view(98);      [ Magic carpet
  0c 01                        draw.pic(v1);

  18 1c 00 32                  position(o28, 0, 50);   [ Wave

  ff fc 07 0f                  if (isset(f15) ||
        01 02 61                   (previous.room == 97) ||
        01 02 68 fc ff             (previous.room == 104)) {   
  07 00
    18 00 64 64                  position(ego, 100, 100);

  fe                           } else {
  1a 00
    ff 01 02 2b ff               if (previous.room == 43) { [ From north
    13 00
      ff fd 01 8d 00 ff            if (v141 != 0) {
      07 00
        18 00 0a 3c                  position(ego, 10, 60);

      fe                           } else {
      04 00
        18 00 6e 28                  position(ego, 110, 40);
                                   }
                                 }
                               }

  ff 01 02 08 ff               if (previous.room == 8) {    [ From south
  03 00
    20 00 00                     [ Unknown. Could be: set.view(ego, 0);
                               }

  ff 01 02 32 ff               if (previous.room == 50) {   [ From ocean
  12 00
    1a 00 14 15                  get.posn(ego, v20, v21);

    ff 05 15 87 ff               if (v21 > 135) {
    07 00
      03 15 87                     v21 = 135;
      19 00 14 15                  position.v(ego, v20, v21);
                                 }
                               }

  16 00                        draw(ego);
                             }


ff fd 07 8d 07 04 ff         if (!isset(f141) && isset(f4)) {
1f 00
  03 8e ff                     v142 = 255;

  ff 0a 00 20 30 2b 35 ff      if (posn(ego, 32, 48, 43, 53)) {
  06 00
    03 8e 0a                     v142 = 10;
    03 8f 37                     v143 = 55;
                               }

  ff 01 8e ff ff               if (v142 == 255) {
  05 00
    3d 8e                        reset(f142);

  fe                           } else {
  0c 00
    1a 00 14 15                  get.posn(ego, v20, v21);
    08 8e 14                     v142 -= v20;
    08 8f 15                     v143 -= v21;
    3c 8c                        set(f140);
                               }
                             }

ff fd 01 03 00 ff            if (edge.ego.hit != 0) {
02 00
  3c c4                        set(f196);
                             }

ff 0a 00 00 32 1e 35         if (posn(ego, 0, 50, 30, 53) &&
   fd 01 8d 00 ff                (v141 != 0)) {
02 00
  0b 2b                        new.room(43);
                             }

ff 01 03 01 ff               if (edge.ego.hit == 1) {
02 00
  0b 2b                        new.room(43);
                             }

ff 01 03 02 ff               if (edge.ego.hit == 2) {
02 00
  0b 02                        new.room(2);
                             }

ff 01 03 04 ff               if (edge.ego.hit == 4) {
02 00
  0b 32                        new.room(50);
                             }

ff 01 03 03 ff               if (edge.ego.hit == 3) {
02 00
  0b 08                        new.room(8);
                             }

00                           return();


[ Messages (none in this example)
00

02 00


So the LOGIC format itself appears to match the AGIv2 format. This example doesn't have messages, so I didn't look at what is happening in that section yet.

The reason that AGI Studio would not like it though is because the test and action commands do not have the same assigned numbers.

I didn't look at any Interpreter code to work any of this out. It was just deducing what the actions and test commands must be, using the AGIv2 KQ1 as a guide, and working out what made sense.

So far we have these test commands:

0x01 = equaln (==)
0x05 = greatern (>)
0x07 = isset
0x0A = posn

The first three are in the right place compared to AGIv2, but posn is one lower.

For the action commands we have:

0x00 = return
0x03 = assignn (=)
0x08 = subn (-=)
0x09 = load.view
0x0B = new.room
0x0C = draw.pic
0x16 = draw
0x18 = position
0x19 = position.v
0x1A = get.posn
0x36 = load.logics
0x38 = load.pic
0x3C = set
0x3D = reset

I'm going to continue working through some more examples to try to identify the number codes for other AGI commands. With set and reset being quite low down, it does seem to support the idea that flags were not present in earlier versions.

Edit:

It is interesting to note that both the  variables and flags use different numbers for a lot of the ones we're familiar with. For example, v1, v2, and v3 all have different purposes than they do in AGI v2 (where v0, v1 and v2 are used instead for those same purposes). The flag to say that the logic should initialise itself also has a different number.

All the concepts that we're familiar with are there though.
« Last Edit: October 22, 2016, 05:07:22 PM by lance.ewing »

Offline lance.ewing

Re: Pre-AGI2 versions
« Reply #13 on: October 22, 2016, 07:20:47 PM »
This one is LOGIC.2:

Code: [Select]
[
[ Apple II - KQ2 1.0H - ROOM 2
[

ff 07 0d ff                            if (isset(init.log)) {
15 00
  58 14 08                               [ Still not sure what this is.
  38 01                                  load.pic(current.room);
  36 99                                  load.logics(153);
  36 97                                  load.logics(151);
  09 41                                  load.view(65);      [ Magic lamp
  09 62                                  load.view(98);      [ Magic carpet
  09 03                                  load.view(3);       [ Red riding hood
  09 02                                  load.view(2);       [ Red riding hood
  0c 01                                  draw.pic(current.room);
  16 00                                  draw(ego);
                                       }

ff 09 02 00 99 00 ff                   if (said("look", "fence"))
02 00
  0d 02                                  print("You see a low white fence.");
                                       }

ff 09 01 00 99 00                      if (said("anyword", "fence") &&
   fd 09 04 00 99 00                       !said("enter", "fence")
   fd 09 02 00 99 00 ff                    !said("look", "fence")
02 00
  0d 01                                  print("You should do nothing with the fence!");
                                       }

ff 01 03 01 ff                         if (edge.ego.hit == 1) {
02 00
  0b 2c                                  new.room(44);
                                       }

ff 01 03 02 ff                         if (edge.ego.hit == 2) {
02 00
  0b 03                                  new.room(3);
                                       }

ff 01 03 04 ff                         if (edge.ego.hit == 4) {
02 00
  0b 01                                  new.room(1);
                                       }

ff 01 03 03 ff                         if (edge.ego.hit == 3) {
02 00
  0b 09                                  new.room(9);
                                       }

00                                     return();


[ Messages
02                                     [ 2 messages
47 00                                  [ Pointer to end of messages
06 00                                  [ Pointer to first message
2c 00                                  [ Pointer to second message

18 19 1c 53 53 2c 1a 07 0b 05 4e       [ "You should do nothing with the fence!"
25 19 49 1d 4f 30 1d 1b 09 06 4e
36 1f 1d 1b 00 30 1d 17 47 07 0b
2f 15 0c 52 20
 
1d 1a 07 47 12 0b 24 56 08 53 4c       [ "You see a low white fence."
2b 02 52 10 09 07 35 13 49 15 45
2a 16 17 49 61

The message section is as expected, and as documented in the AGI specs. The message text is XORed with Avis Durgan.

One new test command discovered:       0x09  said

One new action command discovered:   0x0D  print

Offline lance.ewing

Re: Pre-AGI2 versions
« Reply #14 on: October 24, 2016, 04:37:56 AM »
LOGIC.3 had quite a few additional commands. The list of known commands and variables in the Apple II KQ2 1.0H now looks like this:

[  v1 = Current room
[  v2 = Previous room
[  v3 = Edge ego hit
[  v6 = Score

0x01 = equaln
0x05 = greatern
0x07 = isset
0x09 = said
0x0A = posn

0x00 = return
0x03 = assignn
0x05 = addn
0x08 = subn
0x09 = load.view
0x0A = animate.obj
0x0B = new.room
0x0C = draw.pic
0x0D = print
0x14 = get
0x16 = draw
0x18 = position
0x19 = position.v
0x1A = get.posn
0x1B = set.cel
0x1D = end.of.loop
0x1E = reverse.loop
0x20 = set.view
0x24 = ignore.blocks
0x25 = observe.blocks
0x2A = (???stop.cycling???)
0x2C = stop.update
0x2D = start.update
0x30 = set.priority
0x36 = load.logics
0x38 = load.pic
0x3C = set
0x3D = reset
0x49 = ignore.objs
0x4A = observe.objs
0x4B = distance

While decompiling the first three LOGICs by hand was fun, and good as a refresher, I think I'm going to switch to something a bit more automatic now.

I've identified where the four DIR "files" are on the KQ2 Apple II game, so I'll use those to extract the games resources, and then I'll feed the LOGICs through a decompiler and work out the rest of the commands as I go through each LOGIC.

FYI, the four DIRs are at these offsets on the first disk:  LOGDIR (0x1000), PICDIR (0x1300), SNDDIR (0x1600), VIEWDIR (0x1900). The OBJECT data is at 0x2900, and the WORDS at 0x3000.
« Last Edit: October 25, 2016, 08:12:21 PM by lance.ewing »


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

Page created in 0.05 seconds with 22 queries.