[Scummvm-cvs-logs] SF.net SVN: scummvm:[51126] tools/branches/gsoc2010-decompiler/decompiler
pidgeot at users.sourceforge.net
pidgeot at users.sourceforge.net
Thu Jul 22 01:34:09 CEST 2010
Revision: 51126
http://scummvm.svn.sourceforge.net/scummvm/?rev=51126&view=rev
Author: pidgeot
Date: 2010-07-21 23:34:08 +0000 (Wed, 21 Jul 2010)
Log Message:
-----------
Add UnaryOp handling in generic class
Modified Paths:
--------------
tools/branches/gsoc2010-decompiler/decompiler/codegen.cpp
tools/branches/gsoc2010-decompiler/decompiler/scummv6/codegen.cpp
Modified: tools/branches/gsoc2010-decompiler/decompiler/codegen.cpp
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/codegen.cpp 2010-07-21 23:30:53 UTC (rev 51125)
+++ tools/branches/gsoc2010-decompiler/decompiler/codegen.cpp 2010-07-21 23:34:08 UTC (rev 51126)
@@ -159,8 +159,13 @@
_stack.push(p);
break;
}
+ case kUnaryOp:
+ //TODO: Allow operator to be placed on either side of operand
+ _stack.push(new UnaryOpEntry(_stack.pop(), inst._codeGenData));
+ break;
case kBinaryOp:
case kComparison:
+ //TODO: Allow specification of order in which operands appear on stack
{
EntryPtr rhs = _stack.pop();
EntryPtr lhs = _stack.pop();
Modified: tools/branches/gsoc2010-decompiler/decompiler/scummv6/codegen.cpp
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/scummv6/codegen.cpp 2010-07-21 23:30:53 UTC (rev 51125)
+++ tools/branches/gsoc2010-decompiler/decompiler/scummv6/codegen.cpp 2010-07-21 23:34:08 UTC (rev 51126)
@@ -95,39 +95,28 @@
// Only two opcodes in SCUMMv6, 0x1A and 0xA7: both are single item pop
_stack.pop();
break;
- case kBinaryOp:
- case kComparison:
- {
- EntryPtr rhs = _stack.pop();
- EntryPtr lhs = _stack.pop();
- _stack.push(new BinaryOpEntry(lhs, rhs, inst._codeGenData));
- break;
- }
case kCondJumpRel:
switch (_curGroup->_type) {
- case kIfCond:
- case kWhileCond:
- if (inst._opcode == 0x5C) // jumpTrue
- _stack.push(new UnaryOpEntry(_stack.pop(), "!"));
+ case kIfCond:
+ case kWhileCond:
+ if (inst._opcode == 0x5C) // jumpTrue
+ _stack.push(new UnaryOpEntry(_stack.pop(), "!"));
+ break;
+ case kDoWhileCond:
+ if (inst._opcode == 0x5D) // jumpFalse
+ _stack.push(new UnaryOpEntry(_stack.pop(), "!"));
+ break;
+ default:
+ {
+ std::stringstream s;
+ s << boost::format("Couldn't handle conditional jump at address %08X") % inst._address;
+ addOutputLine(s.str());
break;
- case kDoWhileCond:
- if (inst._opcode == 0x5D) // jumpFalse
- _stack.push(new UnaryOpEntry(_stack.pop(), "!"));
- break;
- default:
- {
- std::stringstream s;
- s << boost::format("Couldn't handle conditional jump at address %08X") % inst._address;
- addOutputLine(s.str());
- break;
- }
+ }
}
break;
case kUnaryOp:
switch (inst._opcode) {
- case 0x0D: // not
- _stack.push(new UnaryOpEntry(_stack.pop(), inst._codeGenData));
- break;
case 0x4E: // byteVarInc
case 0x4F: // wordVarInc
case 0x56: // byteVarDec
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