What is the easiest way com port a Win32 MASM program to Linux ?

Is there a way convert OBJ files generated by MASM to Linux's format and link it ?
Or will I have to rewrite my entire program inNASM or FASM syntax ?

Thanks in advance
Waka
Posted on 2004-02-16 16:45:08 by Waka
Build a version of binutils for linux supporting COFF object files - if binutils doesn't support mscoff, you'll have to write a tool to convert the parts of the object files containing relocations to the gnu coff thingy.

Probably easier to just port to fasm syntax - you're not going to get any API code stuff running under linux anyway, and when dealing with algorithmic stuff the difference between fasm and masm syntax shouldn't be any big deal.
Posted on 2004-02-16 16:51:27 by f0dder
The problem is I use *a lot* of macros !
Every instruction of my Gameboy Z80 core is implemented with a macro...

I don't know FASM macro syntax, and even if I did, it would be too much trouble translating everything.

Could you please tell me more about using binutils to convert MSCOFF to linux COFF ?

Thx
Posted on 2004-02-16 17:43:48 by Waka
Waka,

Agner Fog posted a method of converting object modules written in MASM to linux.

Have a look here as it may save you some work.

http://www.masmforum.com/viewtopic.php?t=1985

Regards,
http://www.asmcommunity.net/board/cryptmail.php?tauntspiders=in.your.face@nomail.for.you&id=2f46ed9f24413347f14439b64bdc03fd
Posted on 2004-02-16 18:23:12 by hutch--
So there is a version of binutils supporting ms-coff after all ^_^ - and do remember what Jibz said about license if you, like most people, got ml.exe from the Windows DDK (which you did, if you go it from the masm32 package).

Btw, I think ID Software made a masm -> gas syntax converter thingy for use with either the doom or (more probably) quake 1 source. I doubt it supports all the macro stuff etc, but it might be worth investigating - this would also free you from the legal trouble with masm.
Posted on 2004-02-17 00:27:12 by f0dder
The syntax is not the unique problem to port a MASM project
to Linux. If you have used the win32 api your proyect will
be incompatible. You can write some libraries (I've used some
routines from MASM32.LIB) or use other libraries like the
gnome-gtk that is ported to windows (if you want some GUI).
Is not much what you have to change to tranlate to NASM or
FASM syntax here.

Btw, in the low level assembler language I prefer use NASM or
FASM.

The Agner Fog method looks fine, but for me is always best
to use GAS or NASM. I've never used FASM, but I suppose that
it works fine. Is not only a problem of high level syntax
nor open source philosophy.
Posted on 2004-02-17 07:05:31 by n u M I T_o r

The problem is I use *a lot* of macros !
Every instruction of my Gameboy Z80 core is implemented with a macro...

I don't know FASM macro syntax, and even if I did, it would be too much trouble translating everything.

Could you please tell me more about using binutils to convert MSCOFF to linux COFF ?

Thx


You wrote a GB Z80 CPU emulator? I'm writing a Z80 emu for my SMS emulator, despite the fact that it failed many tests in ZEXALL, many games are running, the list includes Space Harrier, Sonic 2, Sonic Chaos, Phantasy Star, Outrun etc., I may need help, since the GBZ80 and regular Z80 are essentially the same microprocessors with only minor differences, if possible please keep in contact with me: my email ishttp://www.asmcommunity.net/board/cryptmail.php?tauntspiders=in.your.face@nomail.for.you&id=25f9dd3d9da26cdb509447fe980984d0 it is also my MSN account.
Posted on 2004-02-17 16:01:07 by x86asm
Hi, x86asm

I've actually written 2 Z80 CPU cores !

One was used in my SMS emulator (Written mostly in C) which can be downloaded here:

http://wakateam.emubr.net/downloads.html

Warning: It needs DirectX 7 and 32BPP to work in windowed mode !. It passes all ZexAll tests and runs most SMS and GG games.

The other one was written for my new Gameboy Emulator (written in 100% Win32 ASM), which already runs quite a few comercial games (the list is growing up every day !).

If you have any questions or need help with Z80 emulation just ask !
http://www.asmcommunity.net/board/cryptmail.php?tauntspiders=in.your.face@nomail.for.you&id=c4920dfcbabd0e8a38672efba2ad3ccf
Posted on 2004-02-17 19:06:22 by Waka
Thanks for the answers !

When time comes, I'll port the emulator to linux, using either way.

n u M I T_o r , I'm aware that all Windows stuff would have to be reprogrammed. I would be really cool to have everything translated to NASM or FASM, as I really like them (despite the fact I've never used them).
I guess the GUI stuff would not be so time consuming once I get to know GTK or other API. If I ever write a Linux version, I'll probably use C for GUI suff.

Translating the Z80 core to NASM or whatever would imply rewriting everything. Too much work for someone who only wishes to write a Linux version for the sake of learning. It would be only a secondary version. The win32 version would be my main focus.

Please don't ask me why I didn't write everything in NASM or FASM from the beginning ! :)
A Linux version was not intended back then.
Posted on 2004-02-17 19:18:42 by Waka

Hi, x86asm

I've actually written 2 Z80 CPU cores !

One was used in my SMS emulator (Written mostly in C) which can be downloaded here:

http://wakateam.emubr.net/downloads.html

Warning: It needs DirectX 7 and 32BPP to work in windowed mode !. It passes all ZexAll tests and runs most SMS and GG games.

The other one was written for my new Gameboy Emulator (written in 100% Win32 ASM), which already runs quite a few comercial games (the list is growing up every day !).

If you have any questions or need help with Z80 emulation just ask !

http://www.asmcommunity.net/board/cryptmail.php?tauntspiders=in.your.face@nomail.for.you&id=c4920dfcbabd0e8a38672efba2ad3ccf


The Shifts and Rotates are splitting my brain, I'll ask you some questions later on I'll keep your email and contacnt you later. Thanks! Also some pointers on the noise channel, the periodic noise sounds pretty much perfect on your emu.
Posted on 2004-02-17 21:12:02 by x86asm