TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: David Van Hoose
from: David Noon
date: 1999-01-19 20:48:08
subject: OS/2 ASM Application

In a message dated 01-17-99, David Van Hoose said to All about "OS/2 ASM
Application"

Hi David,

DH>I want to write the character 'Z' to STDOUT.

How about "Hello, World!" instead?

============================= HWORLD.ASM ===================================
; OS/2 32-bit command line program. Sample of assembler code.
; Copyright: Public domain
           .486
           .MODEL FLAT,PASCAL

           .CONST
MsgText    DB     "Hello, World!"
MsgLen     EQU    $-MsgText

           EXTERN DosPutMessage: NEAR
STDOUT     EQU    1                    ; File handle for STDOUT: device

           .CODE
HelloWorld PROC   NEAR
           PUSH   EBP
           MOV    EBP,ESP

; Call DosPutMessage to display our message
           PUSH   OFFSET MsgText
           PUSH   MsgLen
           PUSH   STDOUT
           CALL   DosPutMessage
           ADD    ESP,12

; Clean stack area and return
           MOV    ESP,EBP
           POP    EBP
           RET
HelloWorld ENDP

           .STACK

           END    HelloWorld
============================= HWORLD.DEF ===================================
NAME HWORLD WINDOWCOMPAT
DESCRIPTION 'Sample text-mode program in assembler'
STACKSIZE 16384
IMPORTS
   DOSPUTMESSAGE=MSG.5
============================================================================

This even includes the import, so you don't need OS2386.LIB. Note also that
I assembled it with WASM and/or ALP, not TASM.

Regards

Dave

___
 * MR/2 2.25 #353 * TONYA HARDING DOLL: Assault and Battery Sold Separately

--- Maximus/2 3.01
* Origin: DoNoR/2,Woking UK (44-1483-717904) (2:440/4)
SEEN-BY: 396/1 632/0 371 633/260 262 267 270 371 635/444 506 728 639/252
SEEN-BY: 670/218
@PATH: 440/4 255/1 251/25 396/1 633/260 635/506 728 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.