MASM Cannot Create Single 64K Segment

ID Number: Q11204

4.00

MS-DOS

Problem:

The MASM source code shown below produces a 0-length segment with no

warning to that effect:

DATA SEGMENT

FOO dw 32768 dup (?)

DATA ENDS

Response:

MASM cannot create a single segment exactly 64K bytes in length.

However, it is a problem that no warning is issued.

To obtain a 64K byte segment in the current version, define two parts

of the segment in two different modules as in the following example:

MODULE A:

DATA SEGMENT PUBLIC

PUBLIC FOO

FOO dw 16384 dup (?)

DATA ENDS

--------------------

MODULE B:

DATA SEGMENT PUBLIC

dw 16384 dup (?)

DATA ENDS

--------------------

Assembling these two modules separately and linking them will produce

a 64K byte segment in the final program. Be sure to link A before B in

this case to ensure that the symbol FOO addresses the base of the

segment.