One of the ARM assembly control pseudo instructions

Publisher:salahc1983Latest update time:2016-07-11 Source: eefocusKeywords:ARM Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
    Assembly control pseudo instructions are used to control the execution flow of the assembly program. Commonly used assembly control pseudo instructions include the following:    
    — IF, ELSE, ENDIF    
    — WHILE, WEND    
    — MACRO, MEND    
    — MEXIT 
 
    1. IF, ELSE, ENDIF   
    Syntax format:   
     IF logical expression   
     Instruction sequence 1   
     ELSE   
     Instruction sequence 2   
     ENDIF   
    The IF, ELSE, and ENDIF pseudo-instructions can determine whether to execute a certain instruction sequence based on whether a condition is met.
If the expression is true, execute instruction sequence 1, otherwise execute instruction sequence 2. Among them, ELSE and instruction sequence 2 can be absent. In this case, when
If the logical expression following IF is true, instruction sequence 1 is executed, otherwise the following instructions are continued to be executed.   
    IF, ELSE, and ENDIF directives can be nested.   
    Example of use:   
    GBLL Test; declare a global logic variable named Test...   
    IF Test = TRUE   
    Instruction sequence 1   
    ELSE   
    Instruction sequence 2   
    ENDIF
 
    2. WHILE, WEND   
    Syntax format:   
     WHILE logical expression   
     Instruction sequence   
     WEND   
    The WHILE and WEND pseudo-instructions can determine whether to loop and execute a certain instruction sequence based on whether a condition is met.
If the expression is true, the instruction sequence is executed. After the instruction sequence is executed, the value of the logical expression is judged. If it is true, the execution continues.
The logical expression evaluates to false.   
    WHILE and WEND directives can be nested.   
    Example of use:   
    GBLA Counter; declare a global math variable named Counter   
    Counter SETA 3; The number of loops is controlled by the variable Counter   
    …   
    WHILE Counter < 10   
    Instruction sequence   
    WEND 
 
    3. MACRO, MEND   
    Syntax format:   
     $label macro name$parameter 1, $parameter 2, ...   
     Instruction sequence   
     MEND   
    MACRO and MEND pseudo instructions can define a section of code as a whole, called a macro instruction, and then you can use macro instructions in the program.
Call this code multiple times. The $ symbol will be replaced by a user-defined symbol when the macro is expanded. The macro can be used
One or more parameters that are replaced by their values ​​when the macro is expanded.   
    The usage and function of macro instructions are similar to those of subroutines. Subroutines can provide modular programming, save storage space and improve
However, when using the subroutine structure, the scene needs to be protected, which increases the system overhead. Therefore, when the code is short and needs to be passed
When there are many parameters, macro instructions can be used instead of subroutines.   
    The instruction sequence between MACRO and MEND is called the macro definition body. The first line of the macro definition body should declare the prototype of the macro (including the macro
The instruction sequence can then be called in the assembler by the macro name. When the source program is compiled, the assembler will
Call expansion replaces the macro call in the program with the instruction sequence in the macro definition and passes the value of the actual parameter to the formal parameter in the macro definition.  
 
    MACRO and MEND directives can be nested.
 
    4. MEXIT   
    Syntax format:   
     MEXIT   
    MEXIT is used to jump out of a macro definition. 

Keywords:ARM Reference address:One of the ARM assembly control pseudo instructions

Previous article:Introduction to ARM assembly pseudo-instructions Part 2
Next article:SDRAM driver for S3C2440

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号