More About Assembly-Language Programs

Now that we've looked at working examples of .COM and .EXE assembly-language programs, let's backtrack and discuss their elements a little more formally. The following discussion is based on the Microsoft Macro Assembler, hereafter referred to as MASM. If you are familiar with MASM and are an experienced assembly-language programmer, you may want to skip this section.

MASM programs can be thought of as having three structural levels:

The module level

The segment level

The procedure level

Modules are simply chunks of source code that can be independently maintained and assembled. Segments are physical groupings of like items (machine code or data) within a program and a corresponding segregation of dissimilar items. Procedures are functional subdivisions of an executable program——routines that carry out a particular task.