LEA
Load the address (not the value) of a Label
LEA R0,Label1 ; Load the address of Label1
Label:
When you put a label, the label point to a memory address, The Label is pc offset, you can treat it a as memory address.
LD
Load the value from a label (addres)
LD R1, Label1 ; Load the value stored in Label1 address to R1
ST R2, Label1 ; Store the value of R1 into the address Label1
LDR
Load the value from a address, and the address is from a Register
LDR R1,R2,#0, Load the value from the memory where the R2's value pointing to
LD can be rewrite with LDR
For example
LD R1, Label1
=
LEA R2, Label1 ;store Label1's address to R2
LDR R1, R2, #0 ; Load Label1's value
ST and STR is similar to LD, and LDR
JSR is use to call function
Need to save and restore R7 to a label, then RET can work.
BRnzp ; Branch if last accessed register is negative, zero or positive (uncondition)
BRz ; Branch if last accessed register is zero.
BRzp ; Branch if last accessed register is zero or positive
for example
BRp Label2
.FILL
Assign a address to Label, reverse the address to this label, and initial the value
NINE .FILL #57
Allocate a memory address to NINE, and fill that address with the value 57
ZERO. FILL x0000
NAME .STRINGZ "hello"
Allocate a address to NAME, and fill the memory with h e l l o , chars.
ARR .BLKW 20 ; assign a address to ARR, and reserve the following 20 address for it.