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
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.
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
Don't get confused between the C programming language and the C calling convention. Most C functions nowadays use stdcall.