about summary refs log tree commit diff stats
path: root/miasm2/arch/msp430/sem.py
diff options
context:
space:
mode:
authorPierre LALET <pierre.lalet@cea.fr>2015-03-12 11:01:09 +0100
committerPierre LALET <pierre.lalet@cea.fr>2015-03-12 11:01:09 +0100
commit1a3cce71bf6d131003752ff070a5c3a594516636 (patch)
tree094355e035d87813bcf57cb0b84d1234ba1e14ed /miasm2/arch/msp430/sem.py
parentc35d215a2d8470eee23bba4523dbb51457baf21b (diff)
downloadmiasm-1a3cce71bf6d131003752ff070a5c3a594516636.tar.gz
miasm-1a3cce71bf6d131003752ff070a5c3a594516636.zip
MSP430: add semantic for `add.b`
Diffstat (limited to 'miasm2/arch/msp430/sem.py')
-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,