FIX: MASM Allows Alignments > Segment AlignmentLast reviewed: September 16, 1997Article ID: Q81894 |
5.10 5.10a | 5.10 5.10a
MS-DOS | OS/2kbtool kbfixlist kbbuglist The information in this article applies to:
SYMPTOMSThe Microsoft Macro Assembler (MASM) versions 5.1 and 5.1a incorrectly allow ALIGN directives that are greater than the alignment of the segment they appear within. MASM 5.1 does not generate errors for these statements; however, it cannot guarantee that the item following these ALIGN directives will be aligned on the given boundary.
RESOLUTIONMicrosoft 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 INFORMATIONThe maximum ALIGN value for data or code is the alignment used when defining the segment. When a segment is declared, it is guaranteed to start only at its specified alignment. Since the assembler can align items relative only to the start of a segment, any ALIGN statement greater than the segment's alignment should generate an error. If the following sample code is assembled with MASM 5.1 or MASM 5.1a, no error is generated. Padding is inserted after the ALIGN 4 directive, but it will not align the next statement on the indicated boundary. MASM 6.0 correctly generates the following error:
A2189: invalid combination with segment alignment : 4Valid segment alignments include: BYTE, WORD, DWORD, PARA, or PAGE. PARA is the default.
Sample Code; Assemble options needed: none STACK SEGMENT PARA STACK 'STACK' DB 100h DUP('x')STACK ENDS _DATA SEGMENT WORD PUBLIC 'DATA' msg DB "Hello World!", 13, 10, '$'_DATA ENDS _TEXT1 SEGMENT WORD PUBLIC 'CODE' ASSUME CS:_TEXT1retrn: ret _TEXT1 ENDS _TEXT2 SEGMENT WORD PUBLIC 'CODE' ASSUME CS:_TEXT2, DS:_DATA start: mov ax, SEG msg mov ds, ax ALIGN 4 mov dx, OFFSET msg mov ah, 09h int 21h mov ax, 4C00h int 21h_TEXT2 ENDS END start
|
Additional reference words: 5.10 5.10a 6.00 buglist5.10 buglist5.10a
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |