diff options
author | Martin Kiewitz | 2010-07-18 18:01:52 +0000 |
---|---|---|
committer | Martin Kiewitz | 2010-07-18 18:01:52 +0000 |
commit | a2ea3381feadf69ced8107ca19b9ea029f761189 (patch) | |
tree | 9e59159e55dfeef717638fedb26c64dc3d4fb7e7 | |
parent | 5b4fd084b066d36cc68c7b9a635f10d6fb3c44d7 (diff) | |
download | scummvm-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
-rw-r--r-- | engines/sci/engine/vm.cpp | 42 |
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 |