Changes

Jump to: navigation, search

AArch64 Register and Instruction Quick Start

540 bytes added, 09:28, 18 February 2022
Starter Kit
add r0,r1,99 // load r0 with r1+99
adr r0,''label'' // load r0 with the address ''label'' (this actually calculates an address from the [[Register#Program Counter|PC]] plus an offset)
adrp r0,''label'' // load r0 with the 4K page containing ''label'' (this calculates an address from the [[Register#Program Counter|PC]] plus an offset, and is often followed by an ADD instruction so that the register points exactly to the ''label'')
bl ''label'' // branch (with link) to label - this is a procedure / subroutine / function call
br ''label'' // branch to label - this is a goto
mov r0,r1 // move data from r1 to r0
mov r0,99 // load r0 with 99 (only certain immediate values are possible)
ret // return from subroutine (counterpart to bl)
str r0,[r1,0] // store register r0 to address pointed to by (r1 + (0 * ''size'')) where ''size'' is 8 bytes for 64-bit stores
strb w0,[r1,0] // like str but writes one byte only - note the use of w0 for the source register name
* Character values are indicated by quotation marks. Escapes (such as '\n') are permitted.
* Destinations are given as the first argument (mov r0, r1 moves INTO r0 FROM r1; you can think of this as r0=r1).
* For the LDR/STR instructions: you can append a character indicating the number of bits (lowest) to be loaded or stored:
** Q = Quadword = 64 bits
** D = Double word = 32 bits
** W = Word = 16 bits
** B = Byte = 8 bits
== Resources ==

Navigation menu