Assembly is just like any other computer language; you must first know the basics: the syntaxof the language. After you know how to speak assembly, then comes the interesting part — vocabulary.
Thumb指令集具有高密度的优势,其在硬件层最终也被映射到ARM指令集,所以效率也相当。
Thumb is designed as a target for C compilers, it is not designed to be used directly; rather,developers should use a higher language such as C.You must understand the principles behind the instruction set to write optimized code, but unlike the ARM ISA(Instruction Set Architecture), almost all optimization should bedone directly in C.
由于当前绝大多数的ARM核都同时支持ARM和Thumb两种指令集,ARM开发了Unified Assembler Language (UAL)同时支持这两个指令集。
MOVEMENT OpcodeDescriptionMOV (Move) copies data into a register
MVN (Move Negated) copies a negated value into a register
MOVW (Move Wide) copies a 16-bit constant into a register while zeroing the top 16 bits of the target register
MOVT (Move Top) copies a 16-bit constant into the top part of a register, leaving the bottom half untouched
NEG (Negate) takes the value in Rs and performs a multiplication by –1 before placing the result into Rd
ARITHMETIC OpcodeDescription
ADD adds together two registers and places the result into a register
ADC (Add with carry) adds two numbers together and also uses the carry flag
SUB subtracts one number from another
SBC (Subtract with carry) is like the SUB instruction
RSB (Reverse subtract) is like SUB; RSB subtracts the value of two registers but reverses the order of the operation
RSC (Reverse subtract with carry) is like RSB
SATURATING ARITHMETIC