Subj : Short executables
To : Eddy Thilleman
From : David Noon
Date : Wed Jan 31 2001 10:54 am
Hi Eddy,
Replying to a message of Eddy Thilleman to David Noon:
DN>> Try this [I first posted this code in this echo back in 1998]:
DN>> HWORLD.ASM OS/2 32-bit command line program.
ET> Hmm, maybe I'll try to assemble this, does TASM do the job?
Try this one, if your TASM does only 16-bit code. Just remember to link it with
OS/2's LINK.EXE and use OS2.LIB from the OS/2 Developer's Toolkit 1.3 [although
OS2386.LIB in the later DTK's also contains the 16-bit imports, I think].
========================== HWORLD16.ASM ============================
; OS/2 16-bit command line program. Sample of assembler code.
; Copyright: Public domain
.286
.MODEL SMALL,PASCAL
.CONST
MsgText DB "Hello, Eddy!"
MsgLen EQU $-MsgText
EXTERN VioWrtTTY: FAR
.CODE
HelloWorld PROC NEAR
PUSH BP
MOV BP,SP
; Call VioWrtTTY to display our message
PUSH SEG MsgText
PUSH OFFSET MsgText
PUSH MsgLen
PUSH 0
CALL VioWrtTTY
; Clean stack area and return
MOV SP,BP
POP BP
RET
HelloWorld ENDP
.STACK
END HelloWorld
====================================================================
It works out a couple of bytes smaller than the 32-bit program I posted before
[44 bytes, compared to 53 bytes]. This is like counting archangels on the head
of a pin.
Regards
Dave
<Team PL/I>
--- FleetStreet 1.25.1
* Origin: My other computer is an IBM S/390 (2:257/609.5)