Registrations are now open. Join us today!
There is still a lot of work to do on the wiki yet! More information about editing can be found here.
Already have an account?

Microsoft KB Archive/34985

From BetaArchive Wiki
Knowledge Base


Article ID: 34985

Article Last Modified on 10/16/2003



APPLIES TO

  • Microsoft Macro Assembler 5.1 Standard Edition



This article was previously published under Q34985

SYMPTOMS

The Microsoft Macro Assembler (MASM) versions 5.1 and 5.1a will generate a warning for the following sample code, while MASM version 6.0, 6.0a, and 6.0b will assemble it without error. The warning generated by 5.1 and 5.1a is as follows

A4102: segment near (or at) 64K limit

The linkers that shipped with both products (versions 3.64 and 5.13, respectively) will report the following error at link time

L4020: code-segment size exceeds 64K-36

CAUSE

Warnings are generated because code segments in the range of 65,501 - 65,536 bytes may be unreliable on certain 80286 processors.

MORE INFORMATION

The size of a 16-bit segment is limited to 64K. The recommendation of having segments no larger than 65,500 (64K-36) is to avoid problems with certain 80286 processors.

When the segment really does exceed 64K, MASM 5.1 and 5.1a generate an error rather than a warning

A2102: segment near (or at) 64K limit

and MASM 6.0, 6.0a, 6.0b generates an error as well

A2103: segment exceeds 64K limit

The following sample code will cause MASM to generate warnings, since the segment size is between 65,501 and 65,536 bytes. Increasing the size of 'value' to 65,550 will result in errors rather than warnings.

Sample Code

; Assemble options needed: none

.model small,c
.286

.stack
.code

start:

    MOV ax, @data
    MOV ds, ax

    value db 65500 dup ( ? )

    MOV ah, 4ch
    INT 21h

    END start
                


Additional query words: 5.10

Keywords: KB34985