Who is able to update that wiki? Anyone?
I've written the code to generate SCI1.1 script resources, and I'm trying to test it - unsuccessfully. I'm basically just recompiling an unmodified script 100 (the title screen) from SQ5.
Sierra's interpreter crashed with the script, but with ScummVM's debugger I was able to figure out the cause. It turns out there is another error on the pmachine page. The pushSelf opcode must not have the high bit set (at least in SCI1). After making changes to always output the "word" version of opcodes that have no operands (such as pushSelf, or ret), ScummVM happily ran the game. And then I poked around in the Scumm source code and found this:
// Special handling of the op_line opcode
if (opcode == op_pushSelf) {
// Compensate for a bug in non-Sierra compilers, which seem to generate
// pushSelf instructions with the low bit set. This makes the following
// heuristic fail and leads to endless loops and crashes. Our
// interpretation of this seems correct, as other SCI tools, like for
// example SCI Viewer, have issues with these scripts (e.g. script 999
// in Circus Quest). Fixes bug #3038686.
if (!(extOpcode & 1) || g_sci->getGameId() == GID_FANMADE) {
// op_pushSelf: no adjustment necessary
} else {
// Debug opcode op_file, skip null-terminated string (file name)
while (src[offset++]) {}
}
}
So yeah, the "high bit" version of pushSelf is actually a different opcode.
Unfortunately even with my fix, Sierra's interpreter crashes...
[edit:]
Ok, I found the problem pretty quickly. It looks like any opcode that doesn't have variable-sized operands needs to have the high bit set. So it's not just pushSelf that's weird, even other opcodes like send need to not have the high bit set (e.g. 0x4a and not 0x4b for send)
I wonder if those opcodes have any use at all, or do they just make the interpreter crash?