aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
authorMartin Kiewitz2010-07-18 18:01:52 +0000
committerMartin Kiewitz2010-07-18 18:01:52 +0000
commita2ea3381feadf69ced8107ca19b9ea029f761189 (patch)
tree9e59159e55dfeef717638fedb26c64dc3d4fb7e7 /engines/sci/engine
parent5b4fd084b066d36cc68c7b9a635f10d6fb3c44d7 (diff)
downloadscummvm-rg350-a2ea3381feadf69ced8107ca19b9ea029f761189.tar.gz
scummvm-rg350-a2ea3381feadf69ced8107ca19b9ea029f761189.tar.bz2
scummvm-rg350-a2ea3381feadf69ced8107ca19b9ea029f761189.zip
SCI: ipToa/ipTos/dpTos more verbose
...and adding ability to add workarounds easily svn-id: r50999
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/vm.cpp42
1 files changed, 30 insertions, 12 deletions
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index d81a004a0d..c77e12443f 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -1740,11 +1740,17 @@ void run_vm(EngineState *s, bool restoring) {
validate_property(obj, (opparams[0] >> 1)) = POP32();
break;
- case op_ipToa: // 0x35 (53)
- // Incement Property and copy To Accumulator
- s->r_acc = validate_property(obj, (opparams[0] >> 1));
- s->r_acc = validate_property(obj, (opparams[0] >> 1)) = ACC_ARITHMETIC_L(1 + /*acc*/);
+ case op_ipToa: { // 0x35 (53)
+ // Increment Property and copy To Accumulator
+ reg_t &opProperty = validate_property(obj, opparams[0] >> 1);
+ uint16 valueProperty;
+ if (validate_unsignedInteger(opProperty, valueProperty))
+ s->r_acc = make_reg(0, valueProperty + 1);
+ else
+ s->r_acc = arithmetic_lookForWorkaround(opcode, NULL, opProperty, NULL_REG);
+ opProperty = s->r_acc;
break;
+ }
case op_dpToa: { // 0x36 (54)
// Decrement Property and copy To Accumulator
@@ -1758,19 +1764,31 @@ void run_vm(EngineState *s, bool restoring) {
break;
}
- case op_ipTos: // 0x37 (55)
+ case op_ipTos: { // 0x37 (55)
// Increment Property and push to Stack
- validate_arithmetic(validate_property(obj, (opparams[0] >> 1)));
- temp = ++validate_property(obj, (opparams[0] >> 1)).offset;
- PUSH(temp);
+ reg_t &opProperty = validate_property(obj, opparams[0] >> 1);
+ uint16 valueProperty;
+ if (validate_unsignedInteger(opProperty, valueProperty))
+ valueProperty++;
+ else
+ valueProperty = arithmetic_lookForWorkaround(opcode, NULL, opProperty, NULL_REG).offset;
+ opProperty = make_reg(0, valueProperty);
+ PUSH(valueProperty);
break;
+ }
- case op_dpTos: // 0x38 (56)
+ case op_dpTos: { // 0x38 (56)
// Decrement Property and push to Stack
- validate_arithmetic(validate_property(obj, (opparams[0] >> 1)));
- temp = --validate_property(obj, (opparams[0] >> 1)).offset;
- PUSH(temp);
+ reg_t &opProperty = validate_property(obj, opparams[0] >> 1);
+ uint16 valueProperty;
+ if (validate_unsignedInteger(opProperty, valueProperty))
+ valueProperty--;
+ else
+ valueProperty = arithmetic_lookForWorkaround(opcode, NULL, opProperty, NULL_REG).offset;
+ opProperty = make_reg(0, valueProperty);
+ PUSH(valueProperty);
break;
+ }
case op_lofsa: // 0x39 (57)
// Load Offset to Accumulator