MASM 6.0 May Create Invalid Object Module with Large Structure

ID Number: Q72895

6.00 | 6.00

MS-DOS | OS/2

buglist6.00

Summary:

The Microsoft Macro Assembler (MASM) version 6.0 may produce an object

file (.OBJ) for code with large structure declarations that LINK

considers to be invalid. This results from the fact that MASM can

create an LIDATA record up to the Intel limit of 1K, while LINK will

not accept an LIDATA record over 512 bytes.

More Information:

The sample program below may be used to illustrate this problem. MASM

6.0 is designed to create multiple LIDATA records for data that

exceeds 512 bytes; however, with this code, MASM attempts to create a

single LIDATA record for the entire structure. Thus, the code

assembles successfully but trying to link the resulting .OBJ file

causes LINK to generate the following error:

fatal error L1101: invalid object module

The best workaround is to organize the initialization of structures

into DUPS as shown below. MASM will then correctly break up the

structure into several LIDATA records if necessary.

msg_str STRUCT

msg BYTE 44 DUP(120), 10, 13

BYTE 44 DUP(111), 10, 13

BYTE 44 DUP(120), 10, 13

BYTE 44 DUP(111), 10, 13

BYTE 44 DUP(120), 10, 13

BYTE 44 DUP(111), 10, 13

BYTE 44 DUP(120), 10, 13

BYTE 44 DUP(111), 10, 13

BYTE 44 DUP(120), 10, 13

BYTE '$'

msg_str ENDS

Microsoft has confirmed this to be a problem in MASM version 6.0. We

are researching this problem and will post new information here as it

becomes available.

See "The MS-DOS Encyclopedia" for more information on the LIDATA

record or other aspects of the object module format.

Sample Code

-----------

; Assemble options needed: none

.MODEL small

DOSSEG

.STACK 100h

.DATA

msg_str STRUCT

msg BYTE "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", 10, 13

BYTE "oooooooooooooooooooooooooooooooooooooooooooo", 10, 13

BYTE "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", 10, 13

BYTE "oooooooooooooooooooooooooooooooooooooooooooo", 10, 13

BYTE "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", 10, 13

BYTE "oooooooooooooooooooooooooooooooooooooooooooo", 10, 13

BYTE "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", 10, 13

BYTE "oooooooooooooooooooooooooooooooooooooooooooo", 10, 13

BYTE "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", 10, 13

BYTE '$'

msg_str ENDS

struct_str msg_str 2 DUP (<>)

.CODE

main PROC

mov ax, @DATA

mov ds, ax

mov ah, 9h ; Request DOS Function 9.

mov dx, OFFSET struct_str.msg ; Load DX with offset

; (segment already in DS).

int 21h ; Display String.

mov ax, 4c00h

int 21h

main ENDP

end main