diff options
author | Vladimir | 2011-06-09 01:11:03 +0400 |
---|---|---|
committer | Alyssa Milburn | 2011-06-15 17:33:11 +0200 |
commit | a6fb92d230a08829c7e313665396d9c81fb545d8 (patch) | |
tree | 7d8c0cae0c7f35c819d147cc23c44b234ef19856 | |
parent | a1b1d78e69bca1c274106cdea988be7d2452dc72 (diff) | |
download | scummvm-rg350-a6fb92d230a08829c7e313665396d9c81fb545d8.tar.gz scummvm-rg350-a6fb92d230a08829c7e313665396d9c81fb545d8.tar.bz2 scummvm-rg350-a6fb92d230a08829c7e313665396d9c81fb545d8.zip |
DREAMWEB: added o flag handling for shr/shl instructions
-rw-r--r-- | engines/dreamweb/runtime.h | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/engines/dreamweb/runtime.h b/engines/dreamweb/runtime.h index b69bd15d52..e474c1bc6f 100644 --- a/engines/dreamweb/runtime.h +++ b/engines/dreamweb/runtime.h @@ -225,23 +225,19 @@ public: } inline void _cmp(uint8 a, uint8 b) { - uint8 x = a; - _sub(x, b); + _sub(a, b); } inline void _cmp(uint16 a, uint16 b) { - uint16 x = a; - _sub(x, b); + _sub(a, b); } inline void _test(uint8 a, uint8 b) { - uint8 x = a; - _and(x, b); + _and(a, b); } inline void _test(uint16 a, uint16 b) { - uint16 x = a; - _and(x, b); + _and(a, b); } inline void _add(uint8 &dst, uint8 src) { @@ -307,36 +303,50 @@ public: } inline void _shr(uint8 &dst, uint8 src) { - if (src > 0 && src < 32) { + src &= 0x1f; + if (src > 0) { dst >>= (src - 1); flags._c = dst & 1; dst >>= 1; } flags.update(dst); + if (src == 1) + flags._o = dst & 0x80; } + inline void _shr(uint16 &dst, uint8 src) { - if (src > 0 && src < 32) { + src &= 0x1f; + if (src > 0) { dst >>= (src - 1); flags._c = dst & 1; dst >>= 1; } flags.update(dst); + if (src == 1) + flags._o = dst & 0x8000; } + inline void _shl(uint8 &dst, uint8 src) { - if (src > 0 && src < 32) { + src &= 0x1f; + if (src > 0) { dst <<= (src - 1); flags._c = dst & 0x80; dst <<= 1; } flags.update(dst); + if (src == 1) + flags._o = ((dst & 0x80) != 0) == flags._c; } inline void _shl(uint16 &dst, uint8 src) { - if (src > 0 && src < 32) { + src &= 0x1f; + if (src > 0) { dst <<= (src - 1); flags._c = dst & 0x8000; dst <<= 1; } flags.update(dst); + if (src == 1) + flags._o = ((dst & 0x8000) != 0) == flags._c; } inline void _mul(uint8 src) { |