[Scummvm-cvs-logs] SF.net SVN: scummvm:[54940] tools/branches/gsoc2010-decompiler/decompiler/ doc/disassembler.tex

pidgeot at users.sourceforge.net pidgeot at users.sourceforge.net
Fri Dec 17 01:41:17 CET 2010


Revision: 54940
          http://scummvm.svn.sourceforge.net/scummvm/?rev=54940&view=rev
Author:   pidgeot
Date:     2010-12-17 00:41:16 +0000 (Fri, 17 Dec 2010)

Log Message:
-----------
DECOMPILER: Minor documentation update

Modified Paths:
--------------
    tools/branches/gsoc2010-decompiler/decompiler/doc/disassembler.tex

Modified: tools/branches/gsoc2010-decompiler/decompiler/doc/disassembler.tex
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/doc/disassembler.tex	2010-12-17 00:22:47 UTC (rev 54939)
+++ tools/branches/gsoc2010-decompiler/decompiler/doc/disassembler.tex	2010-12-17 00:41:16 UTC (rev 54940)
@@ -29,6 +29,7 @@
 	virtual bool isStore() const;
 	virtual uint32 getDestAddress() const;
 	virtual void processInst(ValueStack &stack, Engine *engine, CodeGenerator *codeGen) = 0;
+	void copy(InstPtr other);
 };
 \end{lstlisting}
 \end{C++}
@@ -85,6 +86,8 @@
 
 When disassembling, you will need to create an instance of the correct instruction type for each of your instructions. For this purpose, \code{Disassembler} defines a factory \code{\_instFactory} where you can register your classes with an integer key. To do this, call \code{\_instFactory.addEntry<Type>(key)} in the constructor for your Disassemlber, where \code{Type} is the name of the type to register, and \code{key} is an integer key. To create an instance of the appropriate type, simply call \code{\_instFactory.create} with your key.
 
+In a few cases, you may not know which instruction type is correct. For example, in Kyra, the same opcode is used for unconditional jumps and script function calls, but the correct type cannot be determined before all of the instructions have been disassembled. In such a case, you will have to correct the instruction before moving on to the code flow analysis. Once you have created the correct instruction type, you can use the \code{copy} method to copy the base fields from the incorrect instruction.
+
 By default, only some of the instruction types are registered automatically; for other types, you will have to register your own classes since it is not possible to fully define them in a generic fashion. The pre-registered types are \code{kBinaryOpInst}, \code{kBoolNegateInst}, \code{kDupInst}, \code{kKernelCallInst}, \code{kReturnInst}, \code{kUnaryOpPreInst} and \code{kUnaryOpPostInst}, but you can substitute any or all of these by registering your own type with the same key.
 
 For some engines, you will need to go beyond the existing types to implement very special behavior. In those cases, simply define a \code{const int} and give it a value to be able to use this as a new key. Use the value \code{kFirstCustomInst} for your first custom instruction type, and continue from there for new keys, as this will prevent conflict with future instruction types.


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list