This is my current best effort of working through LOGIC.1 in the Apple II KQ2 1.0H game:
[
[ 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.