01指令集 1.1 在处理器内移动数据 MOV <Rd>, <Rm> ;Rm and Rn can be high or low registers.
MOVS <Rd>, <Rm>
MOVS <Rd>, #immed8 ;8位立即数值
MRS <Rd>, <SpecialReg>
MSR <SpecialReg>, <Rd>1.2 存储器访问确保访问的内存地址是对齐的,这一点很重要。在ARMv6-M架构(包括Cortex-M0和Cortex-M0处理器)上不支持非对齐传输。任何未对齐内存访问的尝试都会导致HardFault异常。LDR <Rt>,[<Rn>, <Rm>] ; Rt = memory[Rn + Rm]
STR <Rt>,[<Rn>, <Rm>] ; memory[Rn + Rm] = Rt
LDRH <Rt>,[<Rn>, <Rm>] ; Rt = memory[Rn + Rm]
STRH <Rt>,[<Rn>, <Rm>] ; memory[Rn + Rm] = Rt
LDRB <Rt>,[<Rn>, <Rm>] ; Rt = memory[Rn + Rm]
STRB <Rt>,[<Rn>, <Rm>] ; memory[Rn + Rm] = Rt
LDRSH <Rt>,[<Rn>, <Rm>] ; Rt = SignExtend(memory[Rn + Rm])
LDRSB <Rt>,[<Rn>, <Rm>] ; Rt = SignExtend(memory[Rn + Rm])
LDR <Rt>,[<Rn>, #immed5] ; Rt = memory[Rn + ZeroExtend (#immed5<<2)]
STR <Rt>,[<Rn>, #immed5] ; memory[Rn + ZeroExtend(#immed5<<2)] = Rt
LDRH <Rt>,[<Rn>, #immed5] ; Rt = memory[Rn + ZeroExtend (#immed5<<1)]
STRH <Rt>,[<Rn>, #immed5] ; memory[Rn + ZeroExtend(#immed5<<1)] = Rt
LDRB <Rt>,[<Rn>, #immed5] ; Rt = memory[Rn + ZeroExtend (#immed5)]
STRB <Rt>,[<Rn>, #immed5] ; memory[Rn + ZeroExtend(#immed5)] = Rt
LDR <Rt>,[SP, #immed8] ; Rt = memory[SP + ZeroExtend(#immed8<<2)]
STR <Rt>,[SP, #immed8] ; memory[SP + ZeroExtend(#immed8<<2)] = Rt
LDR <Rt>,[PC, #immed8] ; Rt =memory[WordAligned(PC+4)+ZeroExtend(#immed8<<2)]
LDR <Rd>, =immed32 ; pseudo instruction translated to LDR <Rt>,[PC, #immed8]
LDR <Rd>, label ; pseudo instruction translated to LDR <Rt>,[PC, #immed8]
LDM <Rn>,{<Ra>, <Rb>,..} ; Load Multiple
// Ra = memory[Rn]
// Rb = memory[Rn + 4],
// ...
LDMIA <Rn>!, {<Ra>, <Rb>,..} ; Load Multiple Increment After
LDMFD <Rn>!, {<Ra>, <Rb>,..}
// Ra = memory[Rn],
// Rb = memory[Rn + 4],
// ...
// and then update Rn to last read address plus 4.
STMIA <Rn>!, {<Ra>, <Rb>,..} ; Store Multiple Increment After
STMEA <Rn>!, {<Ra>, <Rb>,..}
// memory[Rn] = Ra,
// memory[Rn + 4] = Rb,
// ...
// and then update Rn to last store address plus 4.1.3 栈空间访问PUSH {<Ra>, <Rb>, ..}
PUSH {<Ra>, <Rb>, .., LR}
POP {<Ra>, <Rb>, ..}
POP {<Ra>, <Rb>, .., PC}1.4 算数运算ADD <Rd>, <Rm> ; Rd = Rd + Rm. Rd, Rm can be high or low registers.
ADDS <Rd>, <Rn>, <Rm> ; Rd = Rn + Rm
SUBS <Rd>, <Rn>, <Rm> ; Rd = Rn – Rm
ADDS <Rd>, <Rn>, #immed3 ; Rd = Rn + ZeroExtend(#immed3)
SUBS <Rd>, <Rn>, #immed3 ; Rd = Rn – ZeroExtend(#immed3)
ADDS <Rd>, #immed8 ; Rd = Rd + ZeroExtend(#immed8)
SUBS <Rd>, #immed8 ; Rd = Rd – ZeroExtend(#immed8)
ADCS <Rd>, <Rd>, <Rm> ; Rd = Rd + Rm + Carry
SBCS <Rd>, <Rd>, <Rm> ; Rd = Rd – Rm – Borrow
ADD SP, SP, #immed7 ; SP = SP + ZeroExtend(#immed7<<2)
SUB SP, SP, #immed7 ; SP = SP – ZeroExtend(#immed7<<2)
ADD SP, <Rm> ; SP = SP + Rm. Rm can be high or low register.
ADD <Rd>, SP, <Rd> ; Rd = Rd + SP. Rd can be high or low register.
ADD <Rd>, SP, #immed8 ; Rd = SP + ZeroExtend(#immed8<<2)
ADD <Rd>, PC, #immed8 ; Rd = (PC[31:2]<<2) + ZeroExtend(#immed8<<2)
ADR <Rd>, <label> ; pseudo instruction translated to ADD <Rd>, PC, #immed8
RSBS <Rd>, <Rn>,#0 ; Rd = 0 – Rm, Reverse Subtract (negative)
MULS <Rd>, <Rm>, <Rd> ; Rd = Rd * Rm
CMP <Rn>, #immed8 ; Rd – ZeroExtended(#immed8)
CMP <Rn>, <Rm> ; Rn – Rm
CMN <Rn>, <Rm> ; Rn – NEG(Rm)1.5 逻辑运算ANDS <Rd>, <Rd>, <Rm> ; Rd = AND(Rd, Rm)
ORRS <Rd>, <Rd>, <Rm> ; Rd = OR(Rd, Rm)
EORS <Rd>, <Rd>, <Rm> ; Rd = XOR(Rd, Rm)
BICS <Rd>, <Rd>, <Rm> ; Rd = AND(Rd, NOT(Rm))
MVNS <Rd>, <Rm> ; Rd = NOT(Rm)
TST <Rn>, <Rm> ; AND(Rn, Rm)1.6 移位和循环操作ASRS <Rd>, <Rm>, #immed5 ; Rd = Rm>>immed5
LSLS <Rd>, <Rm>, #immed5 ; Rd = Rm<<#immed5
LSRS <Rd>, <Rm>, #immed5 ; Rd = Rm>>#immed5
ASRS <Rd>, <Rd>, <Rm> ; Rd = Rd>>Rm
LSLS <Rd>, <Rd>, <Rm> ; Rd = Rd<<Rm
LSRS <Rd>, <Rd>, <Rm> ; Rd = Rd>>Rm
RORS <Rd>, <Rd>, <Rm> ; Rd = Rd rotate right by Rm bits
// Rotate_Left(Data, offset) = Rotate_Right(Data, (32-offset))1.7 展开和顺序反转操作这些反向指令通常用于在小端和之间转换数据大整数。REV <Rd>, <Rm> ; Byte-Reverse Word
// Rd = {Rm[7:0], Rm[15:8], Rm[23:16], Rm[31:24]}
REV16 <Rd>, <Rm> ; Byte-Reverse Packed Half Word
// Rd = {Rm[23:16], Rm[31:24], Rm[7:0] , Rm[15:8]}
REVSH <Rd>, <Rm> ; Byte-Reverse Signed Half Word
// Rd = SignExtend({Rm[7:0] , Rm[15:8]})1.8 扩展操作它们通常用于数据类型转换。SXTB <Rd>, <Rm> ; Signed Extended Byte
// Rd = SignExtend(Rm[7:0])
SXTH <Rd>, <Rm> ; Signed Extended Half Word
// Rd = SignExtend(Rm[15:0])
UXTB <Rd>, <Rm> ; Unsigned Extended Byte
// Rd = ZeroExtend(Rm[7:0])
UXTH <Rd>, <Rm> ; Unsigned Extended Half Word
// Rd = ZeroExtend(Rm[15:0])1.9 程序流控制B <label> ; Branch, Branch range is ±2046 bytes of current PC
B<cond> <label> ; Conditional Branch, Branch range is ±254 bytes of current PC
BL <label> ; Branch and Link, Branch range is ±16 MB of current PC
BX <Rm> ; Branch and Exchange
BLX <Rm> ; Branch and Link with Exchange
|