Microsoft KB Archive/34985

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 17:55, 18 July 2020 by 3155ffGd (talk | contribs) (importing KB archive)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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