Hi, I try to execute the following code:
LDR R1,=0X40000000 LDR R2,=0X11223344 STR R2,[R1] ADD R1,R1,#3 LDR R2,=0X55667788 STR R2,[R1] ADD R1,R1,#3 LDR R2,=0X99AABBCC STR R2,[R1] ADD R1,R1,#3 LDR R2,=0XDDEEFF11 STR R2,[R1]S B S After execution data in memory is as follows:
0x40000000: 88 77 66 55 CC BB AA 99 11 FF EE DD
Why and how?
Thanks in advance.
This how assembly implements things like if statements. You jump to specific code if the statement is true, and somewhere else (or not jump) if not. For example, if(a == b) when EAX is holding the value of a and EBX is holding the value of b, the assembly code will subtract the values (cmp subtract the registers and save the result in the flag registers), and if it zero, it jumps to the code inside the if, and if not, continue or jump to the else statement.
if(a == b)