diff options
-rw-r--r-- | devtools/tasmrecover/tasm/cpp.py | 4 | ||||
-rw-r--r-- | engines/dreamweb/dreamgen.cpp | 6 | ||||
-rw-r--r-- | engines/dreamweb/runtime.h | 22 |
3 files changed, 15 insertions, 17 deletions
diff --git a/devtools/tasmrecover/tasm/cpp.py b/devtools/tasmrecover/tasm/cpp.py index 0e87656bcc..20af0ea632 100644 --- a/devtools/tasmrecover/tasm/cpp.py +++ b/devtools/tasmrecover/tasm/cpp.py @@ -353,13 +353,13 @@ namespace %s { self.body += "\tif (context.flags.l()) %s;\n" %(self.jump_to_label(label)) def _jg(self, label): - self.body += "\tif (!context.flags.g()) %s;\n" %(self.jump_to_label(label)) + self.body += "\tif (!context.flags.le()) %s;\n" %(self.jump_to_label(label)) def _jle(self, label): self.body += "\tif (context.flags.le()) %s;\n" %(self.jump_to_label(label)) def _jge(self, label): - self.body += "\tif (!context.flags.ge()) %s;\n" %(self.jump_to_label(label)) + self.body += "\tif (!context.flags.l()) %s;\n" %(self.jump_to_label(label)) def _jc(self, label): self.body += "\tif (context.flags.c()) %s;\n" %(self.jump_to_label(label)) diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 56d57bee71..16e4958c89 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -17818,13 +17818,13 @@ loop048: if (context.flags.l()) goto over045; context.ax = context.cs.word(context.bx+2); context._cmp(context.data.word(kMousex), context.ax); - if (!context.flags.ge()) goto over045; + if (!context.flags.l()) goto over045; context.ax = context.cs.word(context.bx+4); context._cmp(context.data.word(kMousey), context.ax); if (context.flags.l()) goto over045; context.ax = context.cs.word(context.bx+6); context._cmp(context.data.word(kMousey), context.ax); - if (!context.flags.ge()) goto over045; + if (!context.flags.l()) goto over045; context.ax = context.cs.word(context.bx+8); __dispatch_call(context, context.ax); finished: @@ -18859,7 +18859,7 @@ vertline: context.bx = context.data.word(kLineendy); context.cx = context.bx; context._sub(context.cx, context.ax); - if (!context.flags.ge()) goto line31; + if (!context.flags.l()) goto line31; context._neg(context.cx); context.ax = context.bx; context.data.byte(kLinedirection) = 1; diff --git a/engines/dreamweb/runtime.h b/engines/dreamweb/runtime.h index 9890f950b6..d92a8d6a2b 100644 --- a/engines/dreamweb/runtime.h +++ b/engines/dreamweb/runtime.h @@ -166,11 +166,9 @@ struct Flags { inline bool z() const { return _z; } inline bool c() const { return _c; } inline bool s() const { return _s; } - //complex flags: - inline bool g() const { return !_z && _o; } - inline bool ge() const { return _o; } - inline bool l() const { return !_o; } - inline bool le() const { return _z || !_o; } + + inline bool l() const { return _o; } + inline bool le() const { return _o || _z; } inline void update(uint8 v) { _s = v & 0x80; @@ -270,7 +268,7 @@ public: inline void _add(uint8 &dst, uint8 src) { unsigned r = (unsigned)dst + src; - flags.update_o(r, dst); + flags.update_o((uint8)r, dst); flags._c = r >= 0x100; dst = r; flags.update(dst); @@ -278,21 +276,21 @@ public: inline void _add(uint16 &dst, uint16 src) { unsigned r = (unsigned)dst + src; - flags.update_o(r, dst); + flags.update_o((uint16)r, dst); flags._c = r >= 0x10000; dst = r; flags.update(dst); } inline void _sub(uint8 &dst, uint8 src) { - flags.update_o(dst - src, dst); + flags.update_o(uint8(dst - src), dst); flags._c = dst < src; dst -= src; flags.update(dst); } inline void _sub(uint16 &dst, uint16 src) { - flags.update_o(dst - src, dst); + flags.update_o(uint16(dst - src), dst); flags._c = dst < src; dst -= src; flags.update(dst); @@ -383,21 +381,21 @@ public: inline void _mul(uint8 src) { unsigned r = unsigned(al) * src; - flags.update_o(r, al); ax = (uint16)r; flags._c = r >= 0x10000; flags._z = r == 0; flags._s = r & 0x8000; + flags._o = ah != 0; } inline void _mul(uint16 src) { unsigned r = unsigned(ax) * src; //assuming here that we have at least 32 bits - flags.update_o(r, ax); dx = (r >> 16) & 0xffff; ax = r & 0xffff; - flags._c = false;//fixme + flags._c = false; flags._z = r == 0; flags._s = r & 0x80000000; + flags._o = dx != 0; } inline void _neg(uint8 &src) { |