Creating 32-Bit Flat Memory Model MASM Code for OS/2 2.0Last reviewed: July 31, 1997Article ID: Q94577  | 
	
| 
	
 
6.00 6.00A 6.00B
OS/2
kbprg
 The information in this article applies to: 
 
 SUMMARYVersions 6.0, 6.0a, and 6.0b of the Microsoft Macro Assembler (MASM) provide the .MODEL flat directive to support generating 32-bit flat memory model applications. When combined with the LINK386 utility and DOSCALLS.LIB library provided with OS/2 version 2.0, you can generate a 32-bit flat memory model application for the OS/2 version 2.0 environment. To build a 32-bit flat memory model application for OS/2 2.0, perform the following four steps: 
 MORE INFORMATIONThe LINK386 utility and DOSCALLS.LIB library are provided by IBM with OS/2 version 2.0. MASM versions 6.0, 6.0a, and 6.0b does not include either the required library support for OS/2 operating system calls or a linker capable of producing flat memory model applications. For more information on LINK386, DOSCALLS.LIB, or the functions of the OS/2 2.0 API, please contact IBM. LINK386 may generate two warnings that can be safely ignored: 
    LINK386: warning L4071: application type not specified:
      assuming WINDOWCOMPAT
   LINK386: warning L4071: no automatic data segment
MASM version 6.1 does not run with any version of OS/2 including a DOS
window under OS/2. Microsoft does not support using MASM 6.1 for OS/2. Even
though code generated by MASM 6.1 running with MS-DOS may link with
LINK386, Microsoft does not support generating code in this manner.
Some of the products included here are manufactured by vendors independent of Microsoft; we make no warranty, implied or otherwise, regarding these products' performance or reliability. 
 Sample Code; Assemble options needed: /c INCLUDELIB DOSCALLS.LIB .386 .MODEL flat, syscall Dos32Write PROTO NEAR32 syscall, hf:WORD, pvBuf:NEAR32, cbBuf:WORD, pcbBytesWritten:NEAR32Dos32Exit PROTO NEAR32 syscall, fTerminate:WORD, ulExitCode:WORD.STACK 4096 .DATA msg DB "Hello, world.", 13, 10 written DW 0 .CODE _start:     INVOKE  Dos32Write,        ; OS/2 system call
        1,                     ; File handle for screen
        NEAR32 PTR msg,        ; Address of string
        LENGTHOF msg,          ; Length of string
        NEAR32 PTR written     ; Bytes written
    INVOKE  Dos32Exit,         ; OS/2 system call
        0,                     ; Terminate all threads
        0                      ; Result code for parent process
END _start
  | 
	
	Additional reference words: kbinf 6.00 6.00a 6.00b 6.10 
 © 1998 Microsoft Corporation. All rights reserved. Terms of Use.  |