home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.os2.programmer
- Path: sparky!uunet!think.com!enterpoop.mit.edu!bloom-picayune.mit.edu!jawetzel
- From: jawetzel@athena.mit.edu (The Rottweiler)
- Subject: Re: 32-bit programming using MASM 6.00b
- Message-ID: <1992Dec21.173914.8767@athena.mit.edu>
- Sender: news@athena.mit.edu (News system)
- Nntp-Posting-Host: indra.mit.edu
- Organization: Massachusetts Institute of Technology
- References: <1992Dec14.131817.14808@athena.mit.edu>
- Date: Mon, 21 Dec 1992 17:39:14 GMT
- Lines: 99
-
- I'd like to thank everyone for the input - it works. And now for some
- observations. Use ml with the /c flag unless who have renamed link386 to link
- and its first in your path. Link produces "Relative frame fix-up" errors.
- I assume that link is a 16-bit linker and therefore complains about the flat
- model. Use the 32-bit calls (Dos32Write and Dos32Exit). When using 32-bit
- calls, push the arguments on the stack in the opposite order as with 16-bit
- OS/2. Make sure that there is a DGROUP or link386 complains.
-
- One pain is that I have to go thru basedef.h and bsedos.h to find the correct
- parameters for the system calls. I guess I'll have to eventually go thru these
- headers and convert them all to PROTO statements. Next I'll start using the
- PROTO/INVOKE combination to clean things up.
-
- 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.
-
- Jake
-
- -------------------- hello.asm -------------------------
-
- title hello.asm
-
- .386
- .387
-
- INCLUDE filecomp.inc
-
- cr equ 0dh
- lf equ 0ah
-
- stdin equ 0
- stdout equ 1
- stderr equ 2
-
- DGROUP group _DATA,CONST
-
- _DATA segment dword public flat 'DATA'
-
- wlen dword ?
-
- _DATA ends
-
- CONST segment dword public flat 'CONST'
-
- testmess byte cr,lf,'Hello World.',cr,lf
- testmess_len equ $-testmess
-
- CONST ends
-
- _TEXT segment dword public flat 'CODE'
-
- assume ds:FLAT,ss:FLAT,es:FLAT
-
- main proc near
-
- push offset wlen
- push testmess_len
- push offset testmess
- push stdout
- call Dos32Write
-
- or eax,eax
- jnz error
-
- push eax
- pushd 1
- call Dos32Exit
-
- error: push eax
- pushd 1
- call Dos32Exit
-
- main endp
-
- _TEXT ends
-
- end main
-
-
- -------------------- hello.inc -------------------------
-
- externdef Dos32Write:near
- externdef Dos32Exit:near
-
-
- -------------------- hello.def -------------------------
-
- NAME Hello WINDOWCOMPAT
- DESCRIPTION "OS/2 2.0 Test Program"
- PROTMODE
- STACKSIZE 4096
-
- -------------------- assemble commands ----------------
-
- ml /c /Zi /W3 hello.asm
- link386 /NOE /NOD /ALIGN:16 /M /DE
- hello,,,d:\os2\doscalls,hello;
-
-
-