Community
SCI Programming => SCI Syntax Help => Topic started by: MusicallyInspired on April 30, 2018, 10:47:48 AM
-
Can someone help me make sense of them? Some of the scripts I decompile from Sierra games fall back to assembly for certain code blocks. I've tried taking the disassembly and comparing it to its successful decompile to try to see a similarity but I'm not getting it. I assume this can't be explained easily (because if it could SCI Companion would have decompiled correctly), but I'm wondering if I can rewrite blocks of code by hand if I understand enough of the language. Or can someone point me in the direction of something that would help more than a reply here would (if such is the case).
-
You could rewrite it by hand considering that's what Brian originally did, yeah. The trick, no matter what machine code you're targeting, is mostly in recognizing patterns. Or at least that's what I know. Patterns that the decompiler can't work out.
-
anything in particular you're struggling with?
-
I just don't know where to begin. I don't understand the language at all. I assume assembly code blocks are a syntax? Or is it more of a summary or something?
-
Here are some links that might help you with specific instructions:
- ScummVM Wiki - Instruction Set (http://wiki.scummvm.org/index.php/SCI/Specifications/SCI_virtual_machine/The_Sierra_PMachine#The_instruction_set)
- SCript Interpeter - Instruction Set (http://www.scriptinterpreter.com/instruction-set)
- SCI Companion - PMachine (https://github.com/icefallgames/SCICompanion/blob/master/SCICompanionLib/Src/Compile/PMachine.h)
- ScummVM - SCI's virtual machine (https://github.com/scummvm/scummvm/blob/master/engines/sci/engine/vm.cpp)
- SCI Specifications: The SCI Virtual Machine (http://sierrahelp.com/SCI/Wiki/index.php?title=SCI_Specifications:_Chapter_5_-_The_SCI_Virtual_Machine#The_Sierra_PMachine)
-
but I'm wondering if I can rewrite blocks of code by hand if I understand enough of the language.
Yes, you can. Omer's links are good, especially the first one, which explains all the SCI machine instructions in detail.
It's very similar to any other kind of assembly language (very low level, basically a 1-to-1 mapping of what the processor can do), but has a few fancy instructions like sends and such. So if you have a basic familiarity with any other assembly languages, and notions like registers and push/popping from a stack, it isn't too difficult to figure out (just extremely tedious).
-
Thanks, guys. Will definitely check out those links.