Inverted syntax: Difference between revisions
→{{header|ARM Assembly}}: Original text had nothing to do with the task. Rewrote with a better example.
Puppydrum64 (talk | contribs) |
Puppydrum64 (talk | contribs) (→{{header|ARM Assembly}}: Original text had nothing to do with the task. Rewrote with a better example.) |
||
Line 104:
</pre>
=={{header|ARM Assembly}}==
Typically, instructions with a destination register and a source register will have the leftmost register be the destination and the registers to the right be the source.
<lang ARM Assembly>MOV R0,R3 ;copy R3 to R0
ADD R2,R1,R5 ;add R1 to R5 and store the result in R2.</lang>
However there is one exception: the <code>STR</code> command. Its source is on the left and its destination is on the right. This inverted syntax is not optional.
<lang ARM Assembly>STR r0,[r4] ;store the contents of R0 into the memory location specified by R4.</lang>
This was most likely done for symmetry with the "push/pop" commands:
<lang ARM Assembly>STMFD sp!,{r0-r12,lr} ;push r0 thru r12 and the link register
LDMFD sp!,{r0-r12,pc} ;pop r0 thru r12, and the value that was in the link register is popped into the program counter.</lang>
=={{header|Bracmat}}==
|