News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

MASM 8.2 and DOS TCP/IP Stack from WATTCP

Started by RKeller, June 23, 2005, 10:10:17 PM

Previous topic - Next topic

RKeller

Am writing a 32-bit DOS application using the University of Waterloo's DOS TCP/IP stack WATTCP.  We just bought the US$55 manual, which uses C Language libraries.  It shows no assembler examples.  Any suggestions or code samples to call WATTCP's C libraries using MASM 8.2?

I think you PUSH appropriate values/pointers onto the stack, then CALL or JMP to the function name.

RK

hutch--

RK,

I don't know if MASM will run under 32 bit DOS as the 32 bit version produces Windows spec PE files. If they do, check the register preservation conventions used with 32 bit DOS as it may not be the same as win32.

If MASM will not run correctly, you could try NASM as it is designed to run on many platforms where MASM is dos/widows specific.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Tedd

The usual convention for C is to push the parameters onto the stack (in reverse order)..
Then call the function..
And then clean up the stack afterwards i.e. add esp,(4*number_of_arguments_pushed)

masm's invoke will work fine with this as long as you declare protos for the functions and make the C type
eg. someFunc proto C arg1:DWORD,arg2:DWORD

So then "invoke someFunc,eax,3" will create the following code:

push 3
push eax
call someFunc
add esp,8
No snowflake in an avalanche feels responsible.

AeroASM

Don't get confused between the C programming language and the C calling convention. Most C functions nowadays use stdcall.