Article View: comp.os.os2.programmer
Article #2668Re: 32-bit programming using MASM 6.00b
From: Kai Uwe Rommel
Date: Tue, 22 Dec 1992 21:06
Date: Tue, 22 Dec 1992 21:06
95 lines
2275 bytes
2275 bytes
In article <1992Dec21.173914.8767@athena.mit.edu> jawetzel@athena.mit.edu (The Rottweiler) writes:
>Just in case anyone is interested, the final version of the hello program with
>full segment definitions is included below. Thanks again for all your help.
For *full* segment definitions, you need CODE, DATA, CONST, BSS and
STACK definitions. Example:
.386
INCLUDELIB DOSCALLS.LIB
CODE SEGMENT PUBLIC FLAT 'CODE'
CODE ENDS
DATA SEGMENT PUBLIC FLAT 'DATA'
DATA ENDS
CONST SEGMENT PUBLIC FLAT 'CONST'
CONST ENDS
BSS SEGMENT PUBLIC FLAT 'BSS'
BSS ENDS
STACK SEGMENT STACK FLAT 'STACK'
STACK ENDS
DGROUP GROUP DATA,CONST,BSS,STACK
ASSUME CS:FLAT,DS:FLAT,ES:FLAT,SS:FLAT
STACK SEGMENT
BYTE 4000H DUP (?)
STACK ENDS
CONST SEGMENT
message BYTE 13, 10, "Hello, world.", 13, 10
CONST ENDS
BSS SEGMENT
count DWORD ?
BSS ENDS
CODE SEGMENT
EXTERN DOS32WRITE:PROC
EXTERN DOS32EXIT:PROC
main PROC
push OFFSET count
push LENGTHOF message
push OFFSET message
push 1
call DOS32WRITE
push 0
push 1
call DOS32EXIT
main ENDP
CODE ENDS
END main
Build with the commands
ml -c hello32.asm
link386 /noi /pm:vio hello32;
No module definition file needed because the stack is already defined
in the source code.
Kai Uwe Rommel
--
/* Kai Uwe Rommel Muenchen, Germany *
* rommel@jonas.gold.sub.org Phone +49 89 723 4101 *
* rommel@informatik.tu-muenchen.de Fax +49 89 723 7889 */
DOS ... is still a real mode only non-reentrant interrupt
handler, and always will be. -Russell Williams
Technical Details
Message-ID:
<725058405rommel.root@jonas.gold.sub.org>Path:
arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!asuvax!chnews!hfglobe!imutm1.de.intel.com!gold.sub.org!jonas.gold.sub.org!rommelReferences:
<1992Dec14.131817.14808@athena.mit.edu> <1992Dec21.173914.8767@athena.mit.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!asuvax!chnews!hfglobe!imutm1.de.intel.com!gold.sub.org!jonas.gold.sub.org!rommel From: rommel@jonas.gold.sub.org (Kai Uwe Rommel) Newsgroups: comp.os.os2.programmer Subject: Re: 32-bit programming using MASM 6.00b Distribution: world Message-ID: <725058405rommel.root@jonas.gold.sub.org> Sender: root@jonas.gold.sub.org Date: Tue, 22 Dec 92 22:06:45 MET References: <1992Dec14.131817.14808@athena.mit.edu> <1992Dec21.173914.8767@athena.mit.edu> Organization: Private Lines: 95