News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Simple example to link with DJGPP

Started by Gunther, March 06, 2021, 01:22:03 AM

Previous topic - Next topic

Gunther

Has anyone a simple example for linking a jwasm OBJ file in coff format into DJGPP?

Gunther
You have to know the facts before you can distort them.

Gunther

I had a problem the last days: How to include external routines written with JWASM for DOS into the DJGPP (GCC for DOS)? Apparently nobody is interested in this or
has experience with it. I could clarify this question and will show my solution here.

But first, a few thoughts on my part. The success or failure of a software does not depend on what the maintainers want as features. Much more important is what the users
need who use the software on a daily basis. As a maintainer you are well advised to listen to the masses of users and not only to exalted users from Portugal.

The success of JWASM has several sources. On the one hand, JWASM was 99% compatible with MASM. On the other hand JWASM ran on very different operating systems, even on
BSD, OS/2 and the good old DOS. Unfortunately this diversity does not exist anymore. Today you only have the choice between Windows, Linux and MacOS. (Does anyone really
think that the Apple famous for being famous uses UASM?)

How did it come about? Many will remember that years ago there was a difficult situation: New registers and instruction sets were introduced and the maintainer of JWASM was not
available. Therefore, according to my memory, Branislav took the initiative and dug into the sources of JWASM. The task was clearly outlined: The new instructions should be
implemented into JWASM - not more but also not less. I helped a little with the compilation of JWASM for DOS, but but not more.

Then I pulled out, because first the DOS version fell by the wayside and then some others. Instead more and more high level language constructs have been installed and JWASM
became UASM. I regret that direction very much, since one has robbed oneself of a source of success (variety of supported operating systems).

But there would have been enough work to do. Just look at the large amount of documentation that Hutch did for the MASM32 project! That is the standard that must be applied.
One could have begun also with the comments in the example programs; this has not been done until today.

I know very well that Hutch hesitated for a long time with MASM64, because he had the hope that UASM would mature. Very late he started with the new project and ML.
UASM had best chances for a long time, but did not take advantage of them.

Gunther
You have to know the facts before you can distort them.

Gunther

So now back to the described problem. Under DOS there is not so much choice of good assemblers that fit to DJGPP. There is mainly NASM.
For some time YASM was a good and lean alternative, but it seems to me that there is no further development.

But there is still the last DOS version of JWASM. In my opinion it should work, if you include modules assembled with JWASM into the DJGPP.
Indeed, that works quite well.

My starting point was a simple test program by Matt Mastracci, where he linked a NASM procedure into a C++ program, including the fancy name mangling
and name decoration. I did this in a C program. There we set an integer variable, which is passed to the assembler procedure. That adds 4 to the value and
returns it to the main program to be printed. Nothing more happens.

This works with both NASM (no surprise there) and JWASM. I have tested the resulting programs under various configurations (DOSBox, VirtualBox,
VMWare Player, native DOS) and they run stable.

In the archive DJGPPASM there is the following structure:

DJGAPPASM\BINARY:  Contains the programs and object files.
DJGPPASM\CSource:   Contains the C source.
DJGPPASM\JWASM:    Contains the assembler source for JWASM.
DJGPPASM\NASM:      Contains the assembler source for NASM.

In each of the assembler directories is a batch file for compiling.

Finally a word about the file size of the EXE. It is a 32-bit application in protected mode. Therefore the extender (CWSDPMI) must be linked into the
application; this leads to the relatively large EXE files.

Gunther
You have to know the facts before you can distort them.

TimoVJL

#3
msdos.exe with cwsdpmi.exe works badly, have to press enter before program shows result.

Open Watcom C supports 386 too.

Perhaps a useful link for people, who have to use MS DOS.
https://dosgames.com/utilities.php
May the source be with you

Gunther

Timo,

Quote from: TimoVJL on March 08, 2021, 05:50:35 AM
msdos.exe with cwsdpmi.exe works badly, have to press enter before program shows result.

what is msdos.exe? The archive contains 2 running EXEs.

Much depends on your DOS configuration. I tested it with FreeDOS and had no problems. Do you have EMM386 installed or just HIMEM.SYS or is it a plain DOS?
I don't know where your problems come from at the moment, as I don't know your configuration.

But the DJGPP together with CWSDPMI was used to develop the famous game QUAKE. The two are a pretty solid team.

Gunther
You have to know the facts before you can distort them.

Vortex

Hi Gunther,

I think msdos.exe must be the MS-DOS player :

QuoteThis is MS-DOS emulator running on Win32-x64 command prompt.
16bit MS-DOS compatible commands can be executed on Win32-x64 envrionment.
http://takeda-toshiya.my.coocan.jp/msdos/index.html

Gunther

Erol,

Quote from: Vortex on March 08, 2021, 04:10:14 PM
I think msdos.exe must be the MS-DOS player :

QuoteThis is MS-DOS emulator running on Win32-x64 command prompt.
16bit MS-DOS compatible commands can be executed on Win32-x64 envrionment.
http://takeda-toshiya.my.coocan.jp/msdos/index.html

probably. Thank you for the clarification. It's a similar concept as in DOSBox. But in DOSBox there are not such problems.

Gunther
You have to know the facts before you can distort them.

TimoVJL

Quote from: Gunther on March 08, 2021, 03:25:21 PM
Timo,

Quote from: TimoVJL on March 08, 2021, 05:50:35 AM
msdos.exe with cwsdpmi.exe works badly, have to press enter before program shows result.

what is msdos.exe? The archive contains 2 running EXEs.

Much depends on your DOS configuration. I tested it with FreeDOS and had no problems. Do you have EMM386 installed or just HIMEM.SYS or is it a plain DOS?
I don't know where your problems come from at the moment, as I don't know your configuration.

But the DJGPP together with CWSDPMI was used to develop the famous game QUAKE. The two are a pretty solid team.

Gunther
As Vortex mentioned, a MS-DOS Player for Win32-x64 was in my test.
DOSBox is good, it can control speed too.
May the source be with you

_japheth

Quote from: Gunther on March 08, 2021, 01:59:35 AM
But there is still the last DOS version of JWASM.

jwasm is still developed, and there's still a DOS version - btw, the win32 version runs in DOS as well, with the HX extender ( the newest version of HX even runs 32-bit Uasm, linked with VS 2019, without problem ).
However, I abandoned Windows (desktop) programming several years ago, so this forum is not THAT much on my radar anymore.

Here's the link for jwasm DOS: https://github.com/Baron-von-Riedesel/JWasm/releases/download/v2.14/JWasm_v214_dos.zip
Dummheit, gepaart mit Dreistigkeit - eine furchtbare Macht.

Gunther

You have to know the facts before you can distort them.