about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorserpilliere <serpilliere@users.noreply.github.com>2015-03-12 11:09:53 +0100
committerserpilliere <serpilliere@users.noreply.github.com>2015-03-12 11:09:53 +0100
commitebc16824f28464419d76f82636e5534ebf7df55f (patch)
tree094355e035d87813bcf57cb0b84d1234ba1e14ed
parentc35d215a2d8470eee23bba4523dbb51457baf21b (diff)
parent1a3cce71bf6d131003752ff070a5c3a594516636 (diff)
downloadmiasm-ebc16824f28464419d76f82636e5534ebf7df55f.tar.gz
miasm-ebc16824f28464419d76f82636e5534ebf7df55f.zip
Merge pull request #109 from p-l-/feature-add.b-sem
MSP430: add semantic for `add.b`
-rw-r--r--miasm2/arch/msp430/sem.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/miasm2/arch/msp430/sem.py b/miasm2/arch/msp430/sem.py
index eb3a8282..7f753381 100644
--- a/miasm2/arch/msp430/sem.py
+++ b/miasm2/arch/msp430/sem.py
@@ -176,6 +176,21 @@ def sub_w(ir, instr, a, b):
     return e, []
 
 
+def add_b(ir, instr, a, b):
+    e, a, b = mng_autoinc(a, b, 8)
+    if isinstance(b, ExprMem):
+        b = ExprMem(b.arg, 8)
+    else:
+        b = b[:8]
+    a = a[:8]
+    c = b + a
+    e.append(ExprAff(b, c))
+    e += update_flag_zn_r(c)
+    e += update_flag_add_cf(a, b, c)
+    e += update_flag_add_of(a, b, c)
+    return e, []
+
+
 def add_w(ir, instr, a, b):
     e, a, b = mng_autoinc(a, b, 16)
     c = b + a
@@ -369,6 +384,7 @@ mnemo_func = {
     "bis.w": bis_w,
     "bit.w": bit_w,
     "sub.w": sub_w,
+    "add.b": add_b,
     "add.w": add_w,
     "push.w": push_w,
     "dadd.w": dadd_w,