Example in C a b c 0 11 01 1 Example AND r0r1r2 in ARM Equivalent to r0 r1 r2 in C Bitwise OR in Assembly r1 11000111 The result of ANDing these 0000 0000 ID: 936399
Download Pdf The PPT/PDF document "Subtraction in Assembly Example SUB r3 r..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Subtraction in Assembly !!Example: S
UB r3, r4, r5 (in ARM) Equivalent t
o: d = e - f (in C) !Example: !!in
C: a = b * c; !0! 1!!1 0!!1 1!
Example: AND r0,r1,r2 (in ARM) Equi
valent to: r0 = r1 & r2 (in C) "!Bi
twise OR in Assembly r1: 11000111
The result of ANDing these: 0000
0000 0000 0000 0000 1101 1001 1010
Uses for Logical Operators MOV r0
,r1 (in ARM) Equivalent to: a = b
(in ARM) Equivalent to: MVN r0
,#0 (in ARM) Equivalent to: a = -
1 Ð logical shift by n bits Ð mul
tiplication by 2n "!LSR Ð logical sh
ift by n bits Ð unsigned division by
2n "!ASR Ð arithmetic shift by n bi
ts Ð signed division by 2 !Register
Direct: ADD r0, r1, r2; "!With shi
ft/rotate: 1) 0-0xFF Right, 30
bits 0000000000000000000000xxxxxxxx0
0 4-1020 0x4-0x3FC Right, 28 bits 0x
10-0xFF0 Right, 26 bits 0x40-0x3FC0
É É É É Right, 8 bits 1. Register,
optionally with shift operation "!S
hift value can either be: "!Shiftin
g in Assembly Examples: MOV r4, r6,
LSL #4 ; r4 = r6 MOV 4 T;j
ET; Q q; 1 0; 0 1; 64.;
ᦠ36;.4 ;m B;T 24;&
#x 0 0; 24 ;Ԣ.;٨ ;-2
9.;ç Tm; /TT;.0 ; T
f; 000; 4 T;j ET; Q q;
x 1 0; 0 1; 64.;ᦠ36;
8.4 ;m B;T 24; 0 0; 24
;Ԣ.;٨ ;-29.;ç Tm;
/TT;.0 ; Tf; 000;r4,
r6, LSR #8 ; r4 = r6 8 "!Rotating i
n Assembly Examples: MOV r4, r6, ROR
#12 ; r4 = r6 rotated right 12 bit
s " RSB AND, ORR, EOR, BIC MOV, MV
N LSL, LSR, ASR, ROR "!Shifting can
only be done on the second source op
erand "!Constant multiplications pos
sible using shifts and addition/subt
ractions Semicolon (;) is used for
ARM comments !!Registers replace C
variables !!One Instruction (simple
operation) per line !!Simpler is Bet