Error A2057 with Include File DOS.INC and .386 Directive

ID Number: Q60267

5.10 5.10a | 5.10 5.10a

MS-DOS | OS/2

buglist5.10 buglist5.10a fixlist6.00

Summary:

The Microsoft Macro Assembler (MASM) versions 5.1 and 5.1a generate

the following error when the DOS.INC include file is used in

conjunction with the .386 or .386P directive.

error A2057: Illegal size of operand

The DOS.INC files are provided on disk 2 of the MASM version 5.1

disks, for simplified use of the DOS calls.

Microsoft has confirmed this to be a problem in MASM versions 5.1 and

5.1a. This problem was corrected in MASM version 6.0.

More Information:

The following assembly listing produces the error mentioned above:

DOSSEG

title test1

.386P

include dos.inc

_datas segment word 'data'

mess db 'Hi,there'

messlen equ $-mess

_datas ends

assume cs:_codes

_codes segment word 'code'

start: mov ax,_datas

mov ds,ax ;set data segment to point

;to message

@write mess,messlen ; here is where the

; offset error is

@exit

_codes ends

end start

No errors occur if the use16 use type is used in the segment

statement. This generates a 16-bit offset for the DOS.INC macros

(where a 32-bit offset is generated without the USE 16, and produces

an error).

The following code demonstrates the segment use type to overcome the

error:

DOSSEG

title test1

.386P

include dos.inc

_datas segment use16 word 'data'

mess db 'Hi,there'

messlen equ $-mess

_datas ends

assume cs:_codes

_codes segment word 'code'

start: mov ax,_datas

mov ds,ax ; set data segment to point

; to message

@write mess,messlen ; here is where the

; offset error is

@exit

_codes ends

end start

Additional reference words: 5.10 5.10a