The MASM Forum Archive 2004 to 2012

Miscellaneous Forums => 16 bit DOS Programming => Topic started by: zhoujian on March 11, 2009, 02:33:26 AM

Title: help with "no stack segment" warning
Post by: zhoujian on March 11, 2009, 02:33:26 AM
i have a "HOW ARE YOU !" program:

.386
DATA    SEGMENT USE16
BUF     DB "HOW ARE YOU !$"
DATA    ENDS

STACK   SEGMENT USE16
        DB 200 DUP(0)
STACK   ENDS

CODE    SEGMENT USE16
        ASSUME CS:CODE,DS:DATA,SS:STACK
START:  MOV AX,DATA
        MOV DS,AX
        LEA DX,BUF
        MOV AH,9
        INT 21H
        MOV AH,4CH
        INT 21H
CODE    ENDS
        END START

i cmd like this:

C:\masm32\bin>ml /c howareyou.asm
Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997.  All rights reserved.

Assembling: howareyou.asm

C:\masm32\bin>link16 howareyou.obj;

Microsoft (R) Segmented Executable Linker  Version 5.60.339 Dec  5 1994
Copyright (C) Microsoft Corp 1984-1993.  All rights reserved.

LINK : warning L4021: no stack segment

C:\masm32\bin>howareyou
HOW ARE YOU !
C:\masm32\bin>

i have already assumed "SS:STACK"
but i get a  "no stack segment" warning when i link it
can anyone tell me why?
thank you!
Title: Re: help with "no stack segment" warning
Post by: MichaelW on March 11, 2009, 04:11:53 AM
The linker is apparently looking for the combine type STACK. The syntax is:

name SEGMENT [align] [READONLY] [combine] [use] ['class']

So this should work:

STACK SEGMENT STACK USE16

Also, for ML 6.0 and later it's not necessary to specify ASSUME CS:CODE.
Title: Re: help with "no stack segment" warning
Post by: dedndave on March 20, 2009, 02:14:10 PM
before we had USE16, we declared the stack segment as follows:

STACK   SEGMENT PARA STACK 'STACK'
            dw          256 dup(?)
STACK   ENDS

there is no reason for it to be paragraph aligned, however
i always used WORD align type
notice that the combine type is unique to stack segments
i.e. the segment will not be combined with other segment types