Category:ARM Assembly: Difference between revisions

m
→‎Setting Flags: Formatting fix
m (→‎Setting Flags: Formatting fix)
Line 57:
The flags, or condition codes, are only set by instructions that end in an "s," or by compare commands such as <code>CMP</code>. This lets you "preserve" the processor's state after an important calculation, but do some other things before execution branches depending on the result of that calculation. On any other processor, the calculation that determines whether a branch occurs MUST happen JUST before that branch statement or the branch will be taken based on the wrong data.
 
<lang ARM Assembly>cmp r0,r1 ;compare r0 to r1
ldr r2,[r3] ;load r2 from the address stored in r3
ldr r3,[r4] ;load r3 from the address stored in r4
Line 63:
 
Most processors would have to push and pop the condition code register between the compare and the branch. Otherwise, the act of loading <code>r2</code> and <code>r3</code> would affect the outcome of the branch. Not so on the ARM!
 
 
===Limitations of the ARM===
1,489

edits