Very few programs actually execute all lines sequentially from .STARTUP to .EXIT. Rather, complex program logic and efficiency dictate that you control the flow of your program—jumping from one point to another, repeating an action until a condition is reached, and passing control to procedures. This chapter describes various means for controlling program flow and several features that simplify coding program-control constructs.
The first section covers jumps from one point in the program to another. It explains how MASM 6.0 optimizes both unconditional and conditional jumps under certain circumstances, so that you do not have to specify every attribute. The section also describes instructions you can use to test conditional jumps.
The next section describes loop and decision structures that repeat actions or evaluate conditions. They discuss some new MASM directives, such as .WHILE and .REPEAT, that generate appropriate compare, loop, and jump instructions for you, and the new .IF, .ELSE, and .ELSEIF directives that generate jump instructions.
A number of improvements to procedure automation are covered in Section 7.3. These include extended functionality for PROC, a PROTO directive that lets you write procedure prototypes similar to those used in C, an INVOKE directive that automates parameter passing, and new options for the stack-frame setup inside procedures.
Finally, the last section explains how to pass control to an interrupt routine.