about summary refs log tree commit diff stats
path: root/example
diff options
context:
space:
mode:
authorFabrice Desclaux <fabrice.desclaux@cea.fr>2015-04-01 15:58:29 +0200
committerFabrice Desclaux <fabrice.desclaux@cea.fr>2015-04-01 23:47:37 +0200
commit53d82c13f7da6851196e69c67841af24bcf218b2 (patch)
tree36a74eb31953b449544dfc6eedd8e61a1be7a5eb /example
parent5a6145c5ea3a1df1e666224962dc3ba685327a12 (diff)
downloadmiasm-53d82c13f7da6851196e69c67841af24bcf218b2.tar.gz
miasm-53d82c13f7da6851196e69c67841af24bcf218b2.zip
Cpu: modify instructions' offset relative encoding
The assembler will automatically use instruction len in offset computation

In the following instruction:
0x10: EB 02   JMP 0x14

If we assemble this instruction, the requested instruction send to the assembler
engine will be:
JMP +0x4

And will be encoded to:
EB 02

Previously, the assembly of:
JMP +0x4
was:
EB 04
Diffstat (limited to 'example')
-rw-r--r--example/samples/msp430.S5
1 files changed, 5 insertions, 0 deletions
diff --git a/example/samples/msp430.S b/example/samples/msp430.S
index 77f4b448..5f4beb91 100644
--- a/example/samples/msp430.S
+++ b/example/samples/msp430.S
@@ -1,8 +1,13 @@
 main:
     mov.w      0x10, R10
     mov.w      0x0, R11
+    call       func
 loop:
     add.w      1, R11
     sub.w      1, R10
     jnz        loop
     mov.w      @SP+, PC
+
+func:
+    add.w      1, R9
+    mov.w      @SP+, PC