It's possible to compil with MASM without the PE ?
Example: just compil xor eax, eax

FASM compil xor eax, eax in a file .bin...
Posted on 2007-04-12 07:31:08 by kaos

It's possible to compil with MASM without the PE ?
Example: just compil xor eax, eax

FASM compil xor eax, eax in a file .bin...


As per MSDN...

/c - compiles only, does not link.

I think you can get the same info from invoking command-line help from masm/ml.exe itself.
Posted on 2007-04-12 10:41:51 by SpooK
Thx ! but it dont work :S
i try to assemble just xor eax, eax with /c
Posted on 2007-04-12 11:40:07 by kaos

Thx ! but it dont work :S
i try to assemble just xor eax, eax with /c


There is some overhead by MASM requires. I think the ".model" type is generally required. The biggest one is the fact that you need to identify what type of section you are in. Try this...


;MASM Overhead
.386
.MODEL FLAT

;Actual Code
.CODE
xor eax,eax


Let us know how it works :)
Posted on 2007-04-12 14:09:25 by SpooK
Hum i try to compil ur sample with this cmd line \masm32\bin\ml /c /coff cr.asm
ml.exe create cr.obj with no errors...
I use link for cr.obj ?
Posted on 2007-04-12 14:49:20 by kaos

Hum i try to compil ur sample with this cmd line \masm32\bin\ml /c /coff cr.asm
ml.exe create cr.obj with no errors...
I use link for cr.obj ?


Ideally, yes.
Posted on 2007-04-12 15:50:13 by SpooK
Yes but its the linker who add the PE... :S
Perhaps i can use another linker ?
Posted on 2007-04-12 15:51:29 by kaos

Yes but its the linker who add the PE... :S
Perhaps i can use another linker ?


Too late, MASM has already assembled your code into the Microsoft COFF object format... which is only a tiny step away (that the linker performs) from being a PE file. This happens automatically because MASM was written by Microsoft and they only expect it to be used with their linkers and in their operating systems (e.g. Windows) which are all based around the PE file format.

If you don't know this concept, I highly recommend you read up on the purpose of software development tools such as assemblers, compilers and linkers.

However, if you are trying to create a Flat Binary file, which you are seemingly trying to do, then I suggest downloading an assembler that was designed to do so... such as NASM ;)
Posted on 2007-04-12 16:48:22 by SpooK
Yeah, if you want to do flat binary files, masm isn't really the best choice - one of {fasm, yasm, nasm} would be a better choice.
Posted on 2007-04-12 20:22:37 by f0dder
Thx ! :)
Yes it's sure but Masm have debug.lib (PrintHex, PrintDec, DmpMem, PrintString, PrintStringByAddr...) and it's very useful..
Fasm don't have that.. I don't know for the rest..
Posted on 2007-04-13 09:22:53 by kaos
Some of those will most likely end up calling API functions, and then binary output won't work anyway...
Posted on 2007-04-13 09:30:13 by f0dder
debug.lib is a library file, which is linked by link.exe to executable. You can produce .obj file in {fasm, yasm, nasm} and link it with debug.lib, just like you do in MASM.

If you want flat binary, you need to rewrite sources of debug.lib
Posted on 2007-04-15 16:14:22 by vid