Chapter 2 Organizing MASM Segments

A segment is a collection of instructions or data whose addresses are all relative to the same segment register. The code in your assembly-language program defines and organizes them.

Segments can be defined by using simplified segment directives or full segment definitions. Section 2.2, “Using Simplified Segment Directives,” covers the directives you can use to begin, end, and organize segment program modules. It also discusses how to access far data and code with simplified segment directives.

Section 2.3, “Using Full Segment Definitions,” describes how to order, combine, and divide segments, as well as how to use the SEGMENT directive to define full segments. It also tells you how to create a segment group so that you can use just one segment address to access all the data.

Most of the information in this chapter also applies to writing modules to be called from other programs. Exceptions are noted when they apply. See Chapter 8, “Sharing Data and Procedures among Modules and Libraries,” for more information about multiple-module programming.