STM32汇编指令笔记

  目录

A

B

C

D

E

F

G

H

I

IT

条件执行体,指令包含有IT、ITT、 ITTT、 ITTTT、ITE、 ITEE、ITEEE, 该指令包括的意义为IF-THEN-ELSE
IT{x{y{z}}}<q> <firstcond>
<x> Specifies the condition for the second instruction in the IT block.
<y> Specifies the condition for the third instruction in the IT block.
<z> Specifies the condition for the fourth instruction in the IT block.
<q> See Standard assembler syntax fields on page A7-177.
<firstcond> Specifies the condition for the first instruction in the IT block.
Each of <x>, <y>, and <z> can be either:
T Then. The condition attached to the instruction is <firstcond>.
E Else. The condition attached to the instruction is the inverse of <firstcond>. The condition code is the same as <firstcond>, except that the least significant bit is inverted. E must not be specified if <firstcond> is AL.
程序范例

            PRESERVE8
            THUMB
;           /* reset Vector Mapped to at Address 0 */
            AREA    RESET, DATA, READONLY
            DCD  0X20001000
__Vectors   DCD  main


            AREA    |.text|, CODE, READONLY
main
            MOVS    R0, #0
            MOVS    R5, #0X22
            CMP     R1, #0
            ITTT    EQ 
            MOVEQ   R1, #1 
            MOVEQ   R1, #0x41 
            CMPEQ   R1, #0x41 
            ITTTE   EQ 
            CMPEQ   R5, 0X22 
            MOVEQ   R2, R1 
            MOVEQ   R1, #0 
            MOVNE   R1, #1 
            B       .

如果条件成立则执行,否则不执行。指令占用执行周期
IT块的长度与后面影响指令行等长
T标记表示条件成立执行,E标记表不条件不成立时将得到执行,E或T标记在有执行条件时影响标志位的而后续程序有根据标志位跳转的根据新条件执行

J

K

L

M

MOV

数据赋值
| MOV instruction | Canonical form |
| :— | :— |
| MOV{S} ,,ASR # | ASR{S} ,,# |
| MOV{S} ,,LSL # | LSL{S} ,,# |
| MOV{S} ,,LSR # | LSR{S} ,,# |
| MOV{S} ,,ROR # | ROR{S} ,,# |
| MOV{S} ,,ASR | ASR{S} ,, |
| MOV{S} ,,LSL | LSL{S} ,, |
| MOV{S} ,,LSR | LSR{S} ,, |
| MOV{S} ,,ROR | ROR{S} ,, |
| MOV{S} ,,RRX | RRX{S} , |

{S}包含时,将影响Z标志位

N

O

P

Q

R

S

T

TST

Test (register) performs a logical AND operation on a register value and an optionally-shifted register value. It updates the condition flags based on the result, and discards the result.
TST<c><q> <Rn>, <Rm> {,<shift>}
<c><q> See Standard assembler syntax fields on page A7-177.
<Rn> Specifies the register that contains the first operand.
<Rm> Specifies the register that is optionally shifted and used as the second operand.
<shift> Specifies the shift to apply to the value read from <Rm>. If <shift> is omitted, no shift is applied and both encodings are permitted. If <shift> is specified, only encoding T2 is permitted. The possible shifts and how they are encoded are described in Shifts applied to a register on page A7-182.

程序范例
if(0&0xFE) goto loc_1FFFD18E

MOV     R0, #0
MOVS    R2, #0x7F 
TST     R0, R2
BNE     loc_1FFFD18E

U

UXTH

将寄存器的16位数据扩展成32位的数据,高位补0
UXTH<c><q> <Rd>, <Rm> {, <rotation>}
<c><q> See Standard assembler syntax fields on page A7-177.
<Rd> Specifies the destination register.
<Rm> Specifies the register that contains the second operand.
<rotation> This can be any one of:

  • ROR #8 Encoded as rotate = ’01’.
  • ROR #16 Encoded as rotate = ’10’.
  • ROR #24 Encoded as rotate = ’11’.
  • omitted Encoded as rotate = ’00’.

V

W

X

Y

Z


文章作者: 改变世界
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 改变世界 !
评论