about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorserpilliere <serpilliere@users.noreply.github.com>2015-02-27 22:26:59 +0100
committerserpilliere <serpilliere@users.noreply.github.com>2015-02-27 22:26:59 +0100
commit6660f21d40914a168e1533b9c7832cd0ac616343 (patch)
tree1d64181a457212e4aabb0adc05b9470b75fd3b34
parente1ba1dc1c56ed317c47042502a6556fd4c81ce51 (diff)
parentfc4c63c8287604bf4f626e1a4d63ea23d6972a19 (diff)
downloadmiasm-6660f21d40914a168e1533b9c7832cd0ac616343.tar.gz
miasm-6660f21d40914a168e1533b9c7832cd0ac616343.zip
Merge pull request #93 from p-l-/fix-msp430-sem
msp430 semantic: fix carry and overflow flags for cmp.* mnemonics
-rw-r--r--miasm2/arch/msp430/sem.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/miasm2/arch/msp430/sem.py b/miasm2/arch/msp430/sem.py
index cec8f36f..a6563ad5 100644
--- a/miasm2/arch/msp430/sem.py
+++ b/miasm2/arch/msp430/sem.py
@@ -244,8 +244,8 @@ def cmp_w(ir, instr, a, b):
     e, a, b = mng_autoinc(a, b, 16)
     c = b - a
     e += update_flag_zn_r(c)
-    e += update_flag_sub_cf(a, b, c)
-    e += update_flag_sub_of(a, b, c)
+    e += update_flag_sub_cf(b, a, c)
+    e += update_flag_sub_of(b, a, c)
     return e, []
 
 
@@ -253,8 +253,8 @@ def cmp_b(ir, instr, a, b):
     e, a, b = mng_autoinc(a, b, 8)
     c = b[:8] - a[:8]
     e += update_flag_zn_r(c)
-    e += update_flag_sub_cf(a[:8], b[:8], c)
-    e += update_flag_sub_of(a[:8], b[:8], c)
+    e += update_flag_sub_cf(b[:8], a[:8], c)
+    e += update_flag_sub_of(b[:8], a[:8], c)
     return e, []