Stack Segment Warning in MASM

I start in assembly. I am trying to print a letter on the screen using MASM. I defined a stack segment, but when I try to link the program, I received this warning:

Ref: L4021 Warning: Stack Segment

However, the program works great! How can i fix this? Please explain in simple words. Thanks.

printa.asm:

stk segment
    DW 32 dup(?)
stk ends
cds     segment
    assume cs:cds,ss:stk
    main proc far
        mov ah,02
        mov dl, 'A'
        int 21h

        mov ah,01
        int 21h

        mov ah,4ch
        int 21h
    main endp
cds ends
END main

printa.lst:

Microsoft (R) Macro Assembler Version 6.00              11/06/15 09:38:16
printa.asm                           Page 1 - 1


 0000               stk segment
 0000  0020 [               DW 32 dup(?)
        0000
       ]
 0040               stk ends
 0000               cds     segment
                    assume cs:cds,ss:stk
 0000                   main proc far
 0000  B4 02                    mov ah,02
 0002  B2 41                    mov dl, 'A'
 0004  CD 21                    int 21h

 0006  B4 01                    mov ah,01
 0008  CD 21                    int 21h

 000A  B4 4C                    mov ah,4ch
 000C  CD 21                    int 21h
 000E                   main endp
 000E               cds ends
                END main
Microsoft (R) Macro Assembler Version 6.00              11/06/15 09:38:16
printa.asm                           Symbols 2 - 1




Segments and Groups:

                N a m e                 Size     Length   Align   Combine Class

cds  . . . . . . . . . . . . . .    16 Bit   000E     Para    Private 
stk  . . . . . . . . . . . . . .    16 Bit   0040     Para    Private 


Procedures,  parameters and locals:

                N a m e                 Type     Value    Attr

main . . . . . . . . . . . . . .    P Far    0000     cds   Length= 000E Private

       0 Warnings
       0 Errors
+4
source share
1 answer

I have found a solution. We need to define a “join type” for the stack segment.

stk segment

Must be:

stk segment stack

The only type of compiler that works for the stack segment is the stack.

+3
source

Source: https://habr.com/ru/post/1614686/


All Articles