News:

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

Main Menu

fasm -> masm

Started by Doug Herr, June 22, 2013, 01:27:52 AM

Previous topic - Next topic

Doug Herr

Hi, new member here.  I have a project that was written initially in fasm and the higher-ups now want me to translate to MASM.  I'm a dinosaur, I used MASM many years ago starting with 5.0 so not a total newbie.

The current project is a 32-bit DLL.  I don't need to change the function of the DLL, just tweak the source code into MASM.  Any pointers (pun intended) will be appreciated, thanks!

jj2007

Doug

Welcome in dinosaur land :icon14:

There is AFAIK no automatic translation around; inter alia because the FASM crew believe they are better than we are, and we do the same, so no need for translation :icon_mrgreen:

However, if you post a significant excerpt of your code, we'll be able to judge how much effort it needs. Masm32 has powerful library functions, and so does MasmBasic.

How many lines in total?

Doug Herr

This project has thousands of lines of code  :icon_eek:

Most of what I need help with is DLL startup code; how do I make the functions in the DLL visible to a calling program, are there any tricks to linking, also how do I call functions in another DLL.  I know how to do this with the other assembler (is speaking its name allowed?), but so far the syntax for MASM code has eluded me.

Doug Herr

Sooo.... I've found a simpledll4.zip pointed to by Vortex in http://masm32.com/board/index.php?topic=156.msg567#msg567

... I'll play with that for a while and see what mess I can make  :biggrin:

It looks like in x64code's sample code (first post in the thread) imported functions are pulled in & linked from a .lib, correct?  I want to import functions in other DLLs.

dedndave

for a project that large, i might consider writing a program to convert the source   :P

the differences between fasm and masm aren't that hard to overcome

jj2007

Quote from: dedndave on June 22, 2013, 12:04:35 PM
for a project that large, i might consider writing a program to convert the source   :P

Yes indeed, that's why I pointed a Replace$() ;-)

I am on a sloooow line and on holidays, too, so currently I can't be helpful. When do you need it?

Force

#6


MyDll.DEF

LIBRARY mydll
EXPORTS AddProc



Vortex

Hi Doug Herr,

Here is a Fasm example for you.

Gunther

Hi Doug,

welcome to the forum.

I think that the syntax differences between MASM and FASM aren't so hard. A few changes here and there seems possible. The main difference is: FASM hasn't command line switches. One has to write every switch into the source file.

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

jj2007

Quote from: Vortex on June 23, 2013, 06:18:48 PM
Hi Doug Herr,

Here is a Fasm example for you.

Thanks, Erol.

Main differences are:
- headers, sections etc: should be done by hand
- procs:
proc DlgProc,hWnd,uMsg,wParam,lParam
....
endp

DlgProc proc hWnd,uMsg,wParam,lParam
....
DlgProc endp

- mov [hDC], eax is mov hDC, eax in Masm, but ML reads also the [clumsy] [version]
- if a,e,b: that seems to be if a==b, right? No big deal for a parser, but check carefully if there is any ambiguity.

Doug Herr

My first project is almost complete (a utility DLL that is used by most of my other programs) except for one thing: ML is setting my external references to all caps, so polink can't find the references in case-sensitive libraries.  I'm using ML's /Cx switch which is supposed to preserve the case of externals, but when I examine the .obj file the external references have been changed to all caps.  What am I doing wrong?

dedndave

    OPTION  CaseMap:None

Doug Herr


Vortex

At the top of the source file :

.386
.model flat,stdcall
option casemap:none

Doug Herr

#14
Quote from: Vortex on June 27, 2013, 02:02:52 AM
At the top of the source file :

.386
.model flat,stdcall
option casemap:none


No joy  :(

EDIT: problem solved, thanks