[Scummvm-cvs-logs] SF.net SVN: scummvm:[49587] tools/branches/gsoc2010-decompiler/decompiler
pidgeot at users.sourceforge.net
pidgeot at users.sourceforge.net
Fri Jun 11 02:25:21 CEST 2010
Revision: 49587
http://scummvm.svn.sourceforge.net/scummvm/?rev=49587&view=rev
Author: pidgeot
Date: 2010-06-11 00:25:21 +0000 (Fri, 11 Jun 2010)
Log Message:
-----------
Fix signedness of SCUMMv6 opcode parameters
Modified Paths:
--------------
tools/branches/gsoc2010-decompiler/decompiler/scummv6/disassembler.cpp
tools/branches/gsoc2010-decompiler/decompiler/test/disassembler_test.h
Modified: tools/branches/gsoc2010-decompiler/decompiler/scummv6/disassembler.cpp
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/scummv6/disassembler.cpp 2010-06-10 23:16:32 UTC (rev 49586)
+++ tools/branches/gsoc2010-decompiler/decompiler/scummv6/disassembler.cpp 2010-06-11 00:25:21 UTC (rev 49587)
@@ -55,13 +55,13 @@
START_OPCODES;
OPCODE(0x00, "pushByte", kLoad, 1, "B");
- OPCODE(0x01, "pushWord", kLoad, 1, "w");
+ OPCODE(0x01, "pushWord", kLoad, 1, "s");
OPCODE(0x02, "pushByteVar", kLoad, 1, "B");
- OPCODE(0x03, "pushWordVar", kLoad, 1, "w");
+ OPCODE(0x03, "pushWordVar", kLoad, 1, "s");
OPCODE(0x06, "byteArrayRead", kLoad, 0, "B");
- OPCODE(0x07, "wordArrayRead", kLoad, 0, "w");
+ OPCODE(0x07, "wordArrayRead", kLoad, 0, "s");
OPCODE(0x0A, "byteArrayIndexedRead", kLoad, -1, "B");
- OPCODE(0x0B, "wordArrayIndexedRead", kLoad, -1, "w");
+ OPCODE(0x0B, "wordArrayIndexedRead", kLoad, -1, "s");
OPCODE(0x0C, "dup", kLoad, 1, "");
OPCODE(0x0D, "not", kBoolean, 0, "");
OPCODE(0x0E, "eq", kComparison, -1, "");
@@ -78,21 +78,21 @@
OPCODE(0x19, "lor", kBoolean, -1, "");
OPCODE(0x1A, "pop", kStack, -1, "");
OPCODE(0x42, "writeByteVar", kStore, -1, "B");
- OPCODE(0x43, "writeWordVar", kStore, -1, "w");
+ OPCODE(0x43, "writeWordVar", kStore, -1, "s");
OPCODE(0x46, "byteArrayWrite", kStore, -2, "B");
- OPCODE(0x47, "wordArrayWrite", kStore, -2, "w");
+ OPCODE(0x47, "wordArrayWrite", kStore, -2, "s");
OPCODE(0x4A, "byteArrayIndexedWrite", kStore, -3, "B");
- OPCODE(0x4B, "wordArrayIndexedWrite", kStore, -3, "w");
+ OPCODE(0x4B, "wordArrayIndexedWrite", kStore, -3, "s");
OPCODE(0x4E, "byteVarInc", kArithmetic, 0, "B");
- OPCODE(0x4F, "wordVarInc", kArithmetic, 0, "w");
+ OPCODE(0x4F, "wordVarInc", kArithmetic, 0, "s");
OPCODE(0x52, "byteArrayInc", kArithmetic, -1, "B");
- OPCODE(0x53, "wordArrayInc", kArithmetic, -1, "w");
+ OPCODE(0x53, "wordArrayInc", kArithmetic, -1, "s");
OPCODE(0x56, "byteVarDec", kArithmetic, 0, "B");
- OPCODE(0x57, "wordVarDec", kArithmetic, 0, "w");
+ OPCODE(0x57, "wordVarDec", kArithmetic, 0, "s");
OPCODE(0x5A, "byteArrayDec", kArithmetic, -1, "B");
- OPCODE(0x5B, "wordArrayDec", kArithmetic, -1, "w");
- OPCODE(0x5C, "jumpTrue", kCondJumpRel, -1, "w");
- OPCODE(0x5D, "jumpFalse", kCondJumpRel, -1, "w");
+ OPCODE(0x5B, "wordArrayDec", kArithmetic, -1, "s");
+ OPCODE(0x5C, "jumpTrue", kCondJumpRel, -1, "s");
+ OPCODE(0x5D, "jumpFalse", kCondJumpRel, -1, "s");
OPCODE(0x5E, "startScript", kSpecial, -255, ""); //Variable stack arguments
OPCODE(0x5F, "startScriptQuick", kSpecial, -255, ""); //Variable stack arguments
OPCODE(0x60, "startObject", kSpecial, -255, ""); //Variable stack arguments
@@ -128,7 +128,7 @@
OPCODE(0x70, "setState", kSpecial, -2, "");
OPCODE(0x71, "setOwner", kSpecial, -2, "");
OPCODE(0x72, "getOwner", kSpecial, 0, "");
- OPCODE(0x73, "jump", kJumpRel, 0, "w");
+ OPCODE(0x73, "jump", kJumpRel, 0, "s");
OPCODE(0x74, "startSound", kSpecial, -1, "");
OPCODE(0x75, "stopSound", kSpecial, -1, "");
OPCODE(0x76, "startMusic", kSpecial, -1, "");
@@ -268,9 +268,9 @@
OPCODE(0xA2, "getActorElevation", kSpecial, 0, "");
OPCODE(0xA3, "getVerbEntrypoint", kSpecial, -1, "");
START_SUBOPCODE(0xA4); //arrayOps
- OPCODE(0xCD, "arrayOp_assignString", kSpecial, -1, "wc");
- OPCODE(0xD0, "arrayOp_assignIntList", kSpecial, -255, "w"); //Variable stack arguments
- OPCODE(0xD4, "arrayOp_assign2DimList", kSpecial, -255, "w"); //Variable stack arguments
+ OPCODE(0xCD, "arrayOp_assignString", kSpecial, -1, "sc");
+ OPCODE(0xD0, "arrayOp_assignIntList", kSpecial, -255, "s"); //Variable stack arguments
+ OPCODE(0xD4, "arrayOp_assign2DimList", kSpecial, -255, "s"); //Variable stack arguments
END_SUBOPCODE;
START_SUBOPCODE(0xA5); //saveRestoreVerbs
OPCODE(0x8D, "srVerb_saveVerbs", kSpecial, -3, "");
@@ -281,12 +281,12 @@
OPCODE(0xA7, "pop", kStack, -1, "");
OPCODE(0xA8, "getActorWidth", kSpecial, 0, "");
START_SUBOPCODE(0xA9); //wait
- OPCODE(0xA8, "waitForActor", kSpecial, -1, "w");
+ OPCODE(0xA8, "waitForActor", kSpecial, -1, "s");
OPCODE(0xA9, "waitForMessage", kSpecial, 0, "");
OPCODE(0xAA, "waitForCamera", kSpecial, 0, "");
OPCODE(0xAB, "waitForSentence", kSpecial, 0, "");
- OPCODE(0xE2, "waitUntilActorDrawn", kSpecial, -1, "w");
- OPCODE(0xE8, "waitUntilActorTurned", kSpecial, -1, "w");
+ OPCODE(0xE2, "waitUntilActorDrawn", kSpecial, -1, "s");
+ OPCODE(0xE8, "waitUntilActorTurned", kSpecial, -1, "s");
END_SUBOPCODE;
OPCODE(0xAA, "getActorScaleX", kSpecial, 0, "");
OPCODE(0xAB, "getActorAnimCounter", kSpecial, 0, "");
@@ -377,21 +377,21 @@
OPCODE(0xBA, "talkActor", kSpecial, -1, "c");
OPCODE(0xBB, "talkEgo", kSpecial, 0, "c");
START_SUBOPCODE(0xBC); //dimArray
- OPCODE(0xC7, "dimArrayInt", kSpecial, -1, "w");
- OPCODE(0xC8, "dimArrayBit", kSpecial, -1, "w");
- OPCODE(0xC9, "dimArrayNibble", kSpecial, -1, "w");
- OPCODE(0xCA, "dimArrayByte", kSpecial, -1, "w");
- OPCODE(0xCB, "dimArrayString", kSpecial, -1, "w");
- OPCODE(0xCC, "dimArray_nukeArray", kSpecial, 0, "w");
+ OPCODE(0xC7, "dimArrayInt", kSpecial, -1, "s");
+ OPCODE(0xC8, "dimArrayBit", kSpecial, -1, "s");
+ OPCODE(0xC9, "dimArrayNibble", kSpecial, -1, "s");
+ OPCODE(0xCA, "dimArrayByte", kSpecial, -1, "s");
+ OPCODE(0xCB, "dimArrayString", kSpecial, -1, "s");
+ OPCODE(0xCC, "dimArray_nukeArray", kSpecial, 0, "s");
END_SUBOPCODE;
OPCODE(0xBE, "startObjectQuick", kSpecial, -255, ""); //Variable stack arguments
OPCODE(0xBF, "startScriptQuick2", kSpecial, -255, ""); //Variable stack arguments
START_SUBOPCODE(0xC0); //dim2DimArray
- OPCODE(0xC7, "dim2DimArrayInt", kSpecial, -2, "w");
- OPCODE(0xC8, "dim2DimArrayBit", kSpecial, -2, "w");
- OPCODE(0xC9, "dim2DimArrayNibble", kSpecial, -2, "w");
- OPCODE(0xCA, "dim2DimArrayByte", kSpecial, -2, "w");
- OPCODE(0xCB, "dim2DimArrayString", kSpecial, -2, "w");
+ OPCODE(0xC7, "dim2DimArrayInt", kSpecial, -2, "s");
+ OPCODE(0xC8, "dim2DimArrayBit", kSpecial, -2, "s");
+ OPCODE(0xC9, "dim2DimArrayNibble", kSpecial, -2, "s");
+ OPCODE(0xCA, "dim2DimArrayByte", kSpecial, -2, "s");
+ OPCODE(0xCB, "dim2DimArrayString", kSpecial, -2, "s");
END_SUBOPCODE;
OPCODE(0xC4, "abs", kArithmetic, 0, "");
OPCODE(0xC5, "getDistObjObj", kSpecial, -1, "");
@@ -406,7 +406,7 @@
OPCODE(0xD0, "getDateTime", kSpecial, 0, "");
OPCODE(0xD1, "stopTalking", kSpecial, 0, "");
OPCODE(0xD2, "getAnimateVariable", kSpecial, -1, "");
- OPCODE(0xD4, "shuffle", kSpecial, -2, "w");
+ OPCODE(0xD4, "shuffle", kSpecial, -2, "s");
OPCODE(0xD5, "jumpToScript", kSpecial, -255, ""); //Variable stack arguments
OPCODE(0xD6, "band", kBoolean, -1, "");
OPCODE(0xD7, "bor", kBoolean, -1, "");
Modified: tools/branches/gsoc2010-decompiler/decompiler/test/disassembler_test.h
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/test/disassembler_test.h 2010-06-10 23:16:32 UTC (rev 49586)
+++ tools/branches/gsoc2010-decompiler/decompiler/test/disassembler_test.h 2010-06-11 00:25:21 UTC (rev 49587)
@@ -79,15 +79,15 @@
s.open("decompiler/test/script-15.dmp");
std::vector<Instruction> insts = s.disassemble();
TS_ASSERT(insts.size() == 11);
- TS_ASSERT(insts[0]._address == 0 && insts[0]._name == "pushWordVar" && insts[0]._params[0].getUnsigned() == 16384);
- TS_ASSERT(insts[1]._address == 3 && insts[1]._name == "writeWordVar" && insts[1]._params[0].getUnsigned() == 197);
- TS_ASSERT(insts[2]._address == 6 && insts[2]._name == "pushWord" && insts[2]._params[0].getUnsigned() == 0);
- TS_ASSERT(insts[3]._address == 9 && insts[3]._name == "pushWord" && insts[3]._params[0].getUnsigned() == 11);
- TS_ASSERT(insts[4]._address == 12 && insts[4]._name == "pushWord" && insts[4]._params[0].getUnsigned() == 0);
+ TS_ASSERT(insts[0]._address == 0 && insts[0]._name == "pushWordVar" && insts[0]._params[0].getSigned() == 16384);
+ TS_ASSERT(insts[1]._address == 3 && insts[1]._name == "writeWordVar" && insts[1]._params[0].getSigned() == 197);
+ TS_ASSERT(insts[2]._address == 6 && insts[2]._name == "pushWord" && insts[2]._params[0].getSigned() == 0);
+ TS_ASSERT(insts[3]._address == 9 && insts[3]._name == "pushWord" && insts[3]._params[0].getSigned() == 11);
+ TS_ASSERT(insts[4]._address == 12 && insts[4]._name == "pushWord" && insts[4]._params[0].getSigned() == 0);
TS_ASSERT(insts[5]._address == 15 && insts[5]._name == "startScript");
- TS_ASSERT(insts[6]._address == 16 && insts[6]._name == "pushWord" && insts[6]._params[0].getUnsigned() == 0);
- TS_ASSERT(insts[7]._address == 19 && insts[7]._name == "pushWord" && insts[7]._params[0].getUnsigned() == 14);
- TS_ASSERT(insts[8]._address == 22 && insts[8]._name == "pushWord" && insts[8]._params[0].getUnsigned() == 0);
+ TS_ASSERT(insts[6]._address == 16 && insts[6]._name == "pushWord" && insts[6]._params[0].getSigned() == 0);
+ TS_ASSERT(insts[7]._address == 19 && insts[7]._name == "pushWord" && insts[7]._params[0].getSigned() == 14);
+ TS_ASSERT(insts[8]._address == 22 && insts[8]._name == "pushWord" && insts[8]._params[0].getSigned() == 0);
TS_ASSERT(insts[9]._address == 25 && insts[9]._name == "startScript");
TS_ASSERT(insts[10]._address == 26 && insts[10]._name == "stopObjectCodeB");
} catch (...) {
@@ -103,10 +103,10 @@
s.open("decompiler/test/script-31.dmp");
std::vector<Instruction> insts = s.disassemble();
TS_ASSERT(insts.size() == 5);
- TS_ASSERT(insts[0]._address == 0 && insts[0]._name == "pushWord" && insts[0]._params[0].getUnsigned() == 0);
- TS_ASSERT(insts[1]._address == 3 && insts[1]._name == "writeWordVar" && insts[1]._params[0].getUnsigned() == 180);
- TS_ASSERT(insts[2]._address == 6 && insts[2]._name == "pushWord" && insts[2]._params[0].getUnsigned() == 0);
- TS_ASSERT(insts[3]._address == 9 && insts[3]._name == "writeWordVar" && insts[3]._params[0].getUnsigned() == 181);
+ TS_ASSERT(insts[0]._address == 0 && insts[0]._name == "pushWord" && insts[0]._params[0].getSigned() == 0);
+ TS_ASSERT(insts[1]._address == 3 && insts[1]._name == "writeWordVar" && insts[1]._params[0].getSigned() == 180);
+ TS_ASSERT(insts[2]._address == 6 && insts[2]._name == "pushWord" && insts[2]._params[0].getSigned() == 0);
+ TS_ASSERT(insts[3]._address == 9 && insts[3]._name == "writeWordVar" && insts[3]._params[0].getSigned() == 181);
TS_ASSERT(insts[4]._address == 12 && insts[4]._name == "stopObjectCodeB");
} catch (...) {
TS_ASSERT(false);
@@ -121,14 +121,14 @@
s.open("decompiler/test/script-33.dmp");
std::vector<Instruction> insts = s.disassemble();
TS_ASSERT(insts.size() == 10);
- TS_ASSERT(insts[0]._address == 0 && insts[0]._name == "pushWord" && insts[0]._params[0].getUnsigned() == 0);
- TS_ASSERT(insts[1]._address == 3 && insts[1]._name == "writeWordVar" && insts[1]._params[0].getUnsigned() == 71);
- TS_ASSERT(insts[2]._address == 6 && insts[2]._name == "pushWordVar" && insts[2]._params[0].getUnsigned() == 177);
- TS_ASSERT(insts[3]._address == 9 && insts[3]._name == "writeWordVar" && insts[3]._params[0].getUnsigned() == 173);
- TS_ASSERT(insts[4]._address == 12 && insts[4]._name == "pushWord" && insts[4]._params[0].getUnsigned() == 874);
- TS_ASSERT(insts[5]._address == 15 && insts[5]._name == "writeWordVar" && insts[5]._params[0].getUnsigned() == 177);
- TS_ASSERT(insts[6]._address == 18 && insts[6]._name == "pushWordVar" && insts[6]._params[0].getUnsigned() == 177);
- TS_ASSERT(insts[7]._address == 21 && insts[7]._name == "pushWord" && insts[7]._params[0].getUnsigned() == 93);
+ TS_ASSERT(insts[0]._address == 0 && insts[0]._name == "pushWord" && insts[0]._params[0].getSigned() == 0);
+ TS_ASSERT(insts[1]._address == 3 && insts[1]._name == "writeWordVar" && insts[1]._params[0].getSigned() == 71);
+ TS_ASSERT(insts[2]._address == 6 && insts[2]._name == "pushWordVar" && insts[2]._params[0].getSigned() == 177);
+ TS_ASSERT(insts[3]._address == 9 && insts[3]._name == "writeWordVar" && insts[3]._params[0].getSigned() == 173);
+ TS_ASSERT(insts[4]._address == 12 && insts[4]._name == "pushWord" && insts[4]._params[0].getSigned() == 874);
+ TS_ASSERT(insts[5]._address == 15 && insts[5]._name == "writeWordVar" && insts[5]._params[0].getSigned() == 177);
+ TS_ASSERT(insts[6]._address == 18 && insts[6]._name == "pushWordVar" && insts[6]._params[0].getSigned() == 177);
+ TS_ASSERT(insts[7]._address == 21 && insts[7]._name == "pushWord" && insts[7]._params[0].getSigned() == 93);
TS_ASSERT(insts[8]._address == 24 && insts[8]._name == "cursorCmd_Image");
TS_ASSERT(insts[9]._address == 26 && insts[9]._name == "stopObjectCodeB");
} catch (...) {
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