EXTRACTION TOOLS: There are two extraction utilities that are finished, one for Black Cauldron booter and another for DDP booter. These extract the game resources from the disk images to the common VOL, LOGDIR, PICDIR, VIEWDIR, SNDDIR, OBJECT, WORDS.TOK files that are found in all AGI v2 games. The DDP extraction utility does not extract OBJECT or WORDS.TOK files because these do not exist or serve any function in the game.
V1 DISASSEMBLER: I wrote a disassembler for V1 logic scripts based on the game resources of Black Cauldron. Actually I first wrote a V2 disassembler taking the instruction tables from ScummVM, and then added another instruction table for V1. Both V1 and V2 handle the IF (FF … FF) and ELSE (or GOTO; FE) constructs in the same way. The disassembler tries to detect IF-ELSE constructs in one pass and indents the code based on the output of this detection. To correctly detect them in all cases would need another pass through the code, which is not difficult to add, but is currently left undone. In the case of incorrect detection only the indentation of the output gets wrong because I decided to always output GOTO statements even though they would be detected as ELSE. In the output the current offset is written to the left of the code and to the right into a comment the bytes that were matched as the instruction. The output could be made more C-like by translating instructions like assign(a,b) to a = b, and increment(a) to a++, and the same for some condition commands in IF expressions (this is what the V2 disassembler from Sarien does). The V1 disassembler translates the logic scripts of Black Cauldron mostly correctly. Many of the instructions are identical to their V2 counterpart, some have a somewhat different functionality (program control instructions), some have different number of arguments (random comes to mind), and a few others do not exist in V2 anymore. To make it more friendly a few command line options could be added, that is, to select between V1 and V2, and to control output formatting (this is taken in account in the design, but the few lines of code for parsing the command line are not written, so that you currently need to recompile for changing these).
AGI ENGINE IN SCUMMVM: I have refactored the AGI engine so that another instruction table for V1 has been added. Also the disk image detection code and game resource loaders (based on the extraction tools) are written for BC and DDP. It turned out the program control is handled differently in V1, that is, how different logic scripts get executed from the logic.0 base script. I have an experimental implementation in my local branch, but there are still some details to be worked out, involving a few internally changed variables that are used by the scripts (I estimate one or two days of work to get it about right). I actually got the intro running by fiddling with some of the variables in the debugger. 🙂 After this it should be mostly fixing a correct implementation for a few instructions that behave differently in V1, since all other game resources are identical to V2 and the code for them is thus already written (with the exception of SOUND resources, but I have already implemented a player for those, one that could maybe still be cleaned up a bit).
DOCUMENTATION: I have written something about how game resources are organized in DDP. This still needs to be done for BC as well (see the extraction tools). Then maybe the V1 instruction table could be written down, along with the differences to V2 and information how the internal variables are handled. Also I fixed the information about V1 SOUND format.
KING’S QUEST: The interpreter in this game seems to be different, but I haven’t delved into the details yet. I guess all other game resources have identical formats to V1 and/or V2.