وو

وحید آنلاین . آرشیو وبلاگ وحیدمی دات آی آر . شرکت بیان. vahidmy.blog.ir

وو

وحید آنلاین . آرشیو وبلاگ وحیدمی دات آی آر . شرکت بیان. vahidmy.blog.ir

Compile-Time Functionalities


Compile-Time Functionalities .



Equates


Macros_Keys

Macros_Basics

Inside_Macros

Internal_Strings

Internal_Counters

Conditional_Macros

Macros_Examples


ParaMacros



The Compile-Time Engines are the set of implementations that enables the programmer with defining his own source substitutions. In other words, how to redefine the Assembly language defaults.


As well as for Data, these Declarations are to be given inside Square Brackets.



Equates


The Equates engine is the simpler one: It just replaces the defined words by something else, typically on a one-to-one basis:


[TRUE 1]


This Equate declaration means: 'Replace all intances of 'TRUE' by '1'.



Macros


The Macros engine also offers a replacement functionality, like the Equates Engine, but, whereas the Equates can be applied to any member of an Instruction, the Macros apply only on the first element of a Statement, and, whereas, the Equates are 'one word only'  Macros can have Parameters, and can produce complex multi-Statements outputs. Also, a Macro can be applied to the first component of a Statement Typically:


[push | push #1 | #+1]


push eax, ebx, ecx


will be interpreted as:


push eax | push ebx | push ecx


Macros are usually very rarely used by Asm programmers because, in other Assemblers, they are difficult to learn and to use . As RosAsm tends to be as low level as possible, I have taken particular care to develop powerful, easy to learn and easy to use Macros. So, RosAsm can be considered both as low level in its internals and as a high level Assembler by user defined Macros.


Not considering the error check (which has been really a never ending work in RosAsm development), this Macros system is the feature in which I have spent the most of my working time. To get some idea of the power of this system, just take a look at  the ''EndP'' Macro in Beginners' Tut5 and what it does.



Paramacros


The ParaMacros Engine does about the same things as the Macros Engine, but applies to a Parameter of a Statement:


[RGB | (#1 or (#2 shl 8) or (#3 shl 16))]


mov eax {RGB 011, (011*2), {ReverseByte 0}}


Same as:


mov eax 0_FF_22_11



Note:


The Declared Equates, Macros and ParaMacros apply to the whole Source, whatever positions of the Declarations and of the Evocations. You may, as well, have the Declarations at the very end of a Source making use of these substitutions functionalities.


~~~~~~~