Two different syntaxes are used for ARM assembly. The first one is the GNU Assembler (GAS) syntax. It is also supported by the official ARM toolchain based on Clang called armclang
.
The other one is the legacy ARMASM syntax. Most likely, you will not need to deal with it, but I include a small Rosetta Stone–style (side-by-side) comparison cheat sheet for completeness.
/* Hello-world program.
Prints "Hello, assembly!" and exits with code 42. */
.data
:
hello.string "Hello, assembly!"
.text
.global main
:
main, lr}
push {ip
, =hello
ldr r0
bl printf
, #41
mov r0, r0, #1 // Increment 41 by one.
add r0
, lr}
pop {ip bx lr
; Hello-world program.
; Prints "Hello, assembly!" and exits with code 42.
AREA ||.data||, DATA
hello
DCB "Hello, assembly!",0
AREA ||.text||, CODE
main PROC
push {ip, lr}
ldr r0, =hello
bl printf
mov r0, #41
add r0, r0, #1 ; Increment 41 by one.
pop {ip, lr}
bx lr