Conditional Assembling

Conditional assembling provides the possibility of bypassing specific program fragments when assembling. There are the following types of conditional assembling:

  1.  IF  expression  ... ENDIF 
  2.  IF  expression  ... ELSE ... ENDIF 
  3.  IF  expression 1  ... ELSEIF  expression 2  ... ELSEIF  expression 3  ... ELSE ... ENDIF 

The expression is considered to be satisfied if the expression takes a nonzero value; otherwise , the condition is not satisfied.

MASM and TASM support several special-purpose directives for conditional assembling.

  1.  IFE expression ... ELSEIFE ... ENDIFE 
  2. The IF1 and IF2 operators check the first and the second pass of assembling.

  3. The IFDEF operator checks whether a symbolic name is defined in the program; IFDEFN is an inverse operator.

    There are other types of IF operators. The required information can be found in any reference on Assembly language.

  4. There is the large set of directives starting with .ERR . For example, .ERRE will cause the assembling process stop and will display an error message if the condition takes the value 0.

Conditional assembling will be used in the end of this chapter to write the example program that can be translated using both MASM and TASM.



The Assembly Programming Master Book
The Assembly Programming Master Book
ISBN: 8170088178
EAN: 2147483647
Year: 2004
Pages: 140
Authors: Vlad Pirogov

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net