14.1.1 Specifying a Memory Model

The Cmacro memory-model options specify the memory model that the application will use. The memory model defines how many code and data segments are in the application. Following is a list of the possible memory models:

Model Description

Small One code segment and one data segment
Medium Multiple code segments and one data segment
Compact One code segment and multiple data segments
Large Multiple code and data segments
Huge Multiple code segments and multiple data segments, with one or more data items larger than 64K

Select a memory model by defining the option name at the beginning of the assembly-language source file. These option names are available:

Option name Memory model Code size Data size

memS Small Small Small
memM Medium Large Small
memC Compact Small Large
memL Large Large Large
memH Huge Large Large

You can define a name by using the EQU directive. The definition has the following form:

memM     EQU     1

If no option is selected, the default model is small.

When you select a memory-model option, two symbols are defined: SizeC and SizeD. These two symbols can be used for code that is dependent on the memory model. They can have the following values:

Symbol Value Meaning

SizeC 0 Small code
  1 Large code
SizeD 0 Small data
  1 Large data
  2 Huge data