ZHCUAV7Z september 1995 – march 2023 66AK2E05 , 66AK2H06 , 66AK2H12 , 66AK2H14 , AM1705 , AM1707 , AM1802 , AM1806 , AM1808 , AM1810 , AM5K2E04 , OMAP-L132 , OMAP-L137 , OMAP-L138 , SM470R1B1M-HT , TMS470R1A288 , TMS470R1A384 , TMS470R1A64 , TMS470R1B1M , TMS470R1B512 , TMS470R1B768
汇编器支持将操作数用作地址、直接值、间接地址、寄存器、移位寄存器或寄存器列表。以下规则适用于指令的操作数。
Label: ADD R1, R1, #123
; Add 123 (decimal) to the value of R1 and place the result in R1.
偏移可以加到基址或从基址减去。以下是使用间接地址作为操作数的指令示例:
A: LDR R1, [R1]
; Load from address in R1 into R1.
LDR R7, [R1, #5]
; Form address by adding the value in R1 to 5.Load from address into R7.
STR R3, [R1, -R2]
; Form address by subtracting the value in R2 from the value in R1.Store from R3
; to memory at address.
STR R14, [R1, +R3, LSL #2]
; Form address by adding the value in R3 shifted left by 2 to the value in R1.
; Store from R14 to memory at address.
LDR R1, [R1], #5
; Load from address in R1 into R1, then add 5 to the address.
STR R2, [R1], R5
; Store value in R2 in the address in R1, then add the value in R5 to the address.
以下示例展示的指令使用了写回寄存器后缀:
LDR R1, [R4, #4]!
; Form address by adding the value in R4 to 4.Load from this address into R1,
; then replace the value in R4 with the address.
LDMIA SP, {R4-R11, R15}^
; Load registers R4 through R11 and R15 from memory at SP.Load CPSR with SPSR.
LSL LSR ASL ASR ROR RRX | 逻辑左移 逻辑右移 算术左移 算术右移 向右旋转 向右旋转扩展 |
移位类型可以后跟寄存器或直接值,其值定义了移位量。以下是使用移位寄存器作为操作数的指令示例:
B: ADD R1, R4, R5, LSR R2
; Logical shift right the value in R5 by the value in R2.Add the value in R5 to R4.
; Place result in R1.
LDR R1, [R5, R4, LSL #4]
; Form address by adding the value in R4 shifted left by 4 to the value in R5.
; Load from address into R1.
CMP R3, R4, RRX
; Compare the value in R3 with the value in R4 rotate right extend.
LDMEA R2, {R1, R3, R6}
; Pre-decrement stack load.Load registers R1, R3 and R6 from memory at the address in R2.
STMFD R12, {R1, R3-R5}
; Pre-increment stack store.Store from registers R1 and R3 through R5 to memory at the
; address in R12.