I know, I know... This is discussed in another tread, but anyway...

Isn't it possible to add an instruction that includes a COFF file? It would be very nice... I hate to use linkers and all that. Fasm IS flexible, but it had been excellent if it supported this!

BUT! Remember, you are the master, and you decide what to do... This is only a little wish from a newbie that loves fasm but want to only use fasm and not to use the linker too... :)

Thanks again!
Posted on 2002-08-23 07:17:33 by NewToAssembly
I didn't play with resource section yet.
What is the best way to put resource in PE format, except typing them?
Can I just include .res file produced by resource compiler in resource section?
Or maybe there are some tools that produce text descrpition using FASM macros?
Posted on 2002-08-23 16:15:47 by Sergo
Privalov,
Sorry for bothering you again,
is it possible to answer the rest of my question from August 22nd, 2002 11:12,
and maybe you can reconsider you decision about section splitting/merging
in PE format, i.e so the sections with the same name name and attribute goes
declared in different parts of source script go to the same physical section in PE file.
It would allow to declare variables when you need them and not to jump back and forth from data to code section. Also enabling macros return values would be useful for printing short messages (like SADD macro from MASM32, or any string in
in GoASM ) .
I think allowing to define a section attribute as a number only make the job of PE formatter easier and code more clear, and also gives a lot of reservered words back to the FASM users like "readable, writable, code data"
Posted on 2002-09-04 15:12:46 by Sergo
Hi Serge,
I've been following your interesting conversation with Privalov, and as I think he's on holyday now, I'm going to try to answer some of them.

About splitting/merging sections:
I fnd it great to get an image of what you code. If you need splitting/merging, use MASM.

About defining sections as numbers:
It makes more sense to me to have them like that, the same that makes more sense instead of 0110010011000001 knowing: Parity Even, Carry Flag on, Direction up, etc.
See, I have an electrical eng. background, so I'm used to numbers, but when I program I prefer to have the idea.
Of course, this is a matter of taste, I like the readable, writeable, exportable format.

Your question from August 22nd, 2002 11:12:

2) /nologo... that reminds me of a canadian girl ;) (anti-globalization stuff)
You can get a /quiet very quiet output using pipes, and redirecting your output to a file, like fasm cool.exe > cool.out

3)A default alignment? But why make it default? Just use align macro whenever you need it. (Btw check a new align macro by Maverick that let's you define an offset, find it in his profiler thingy)

5)Create your own macro for that, easy exercise.

10)You can use local structs that don?t consume space.
A lot have been explained about using struct, look for E?in's example POINT struct

11) I don?t know it either, if you find out, please tell me.

12) Okay, how about using a hex-editor and changing it directly?

16) They are a lot, and also you have here many new examples, and of course, the macros in the import, stdcall... sections

17) well, I don?t know about this, are you sure there's no need to have 10h directories?



Questions 1, 4, 7, 8, 9, 13, 14 and 15 have been already answered by Privalov.

Hope it helps.
Posted on 2002-09-05 08:47:47 by slop
Hi, Sloppy!

My suggestion about section attributes as numbers doesn't have to be take literally, of course, most people just use predefined constants in header files
(the symbolic names for them are defined in PE specs)
and OR ( logicalliy) them in the section declaration.

header.inc
IMAGE_SCN_CNT_INITIALIZED_DATA = ???
IMAGE_SCN_CNT_ALIGN4 = ???

code.asm

section 'data' IMAGE_SCN_CNT_INITIALIZED_DATA or IMAGE_SCN_CNT_ALIGN4

If you still think that each image needs 10h dirs you can check the build the binary example given by Privalov ( 2 dirs exp/imp) and run it.
DLL perfectly work even with one directory (export)

2) /nologo - I had to modyify a source code, I even made to output errors in MASM
format so Visual Studio can understand it.
What canadian girl did you mean? I don't watch TV now. :(

3) A default alignment - in data section when you have dword structure declarartion interleaved by text string it's tiresome to type align 4 everytime.

5) Could you give your example of 'comment' implementation in FASM macro?


11) I just like to include standard headers and don't have to define each new Win
structure I want to use.
The way structures come in the headers is wasting space and non-initializable.


The idea I try to convey to Privalov is that good assembler/compiler in general should give
1) as much freedom as possible so people don't have to use hex editors to set individual bytes

2) If the job could be done by the compiler it shouldn't burden the programmer.
The purpose of compiler to help a programmer not to create extra problem.
( For example 'on the fly data declarations (compiler can add it to data section without my help, forward references, etc )
Multipassing - that's why I like FASM, saving half second on compilation and making users to spend miniutes ( at least) to rearrange the code is the biggest problem of single pass assemblers as a redundant reminder of slow CPUs.

But it's only the first step. I hope.
Posted on 2002-09-06 15:08:58 by Sergo
Hi Serge.
I prefer to address your las two ideas:

1)Yes, I also love freedom, but there has to be some sort of 'compromise' between freedom and bloatedness, because when an assembler starts being too fancy... well, I think it loses its original freedom.
I tould you las time, for high level assembly I use masm; while for things that can't be done any other way fasm is the best.

2) You are right.
Posted on 2002-09-10 07:20:01 by slop
Hi Sergo

I just found somewhere inside winnt.h the following:

#define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16


So I guess Privalov was right, and also Borland.


And for my comment macro, it's probably the simplest macro I can think of, it?s like a meta-macro, maybe the smallest reduction of a macro:
macro comment [args] { }

Like here:


macro comment [args] { }
comment This is just a comment
comment This is another
movsx eax,ax
bsf eax,[edi]
comment Move extending sign, then bit scan forward instructionss
comment The end


Hope this helps
Posted on 2002-09-23 12:27:39 by slop
Hi, Sloppy
1
But the PE/COFF standard on MS website doesn't specify the specific number of directories, and what's most important Windows PE loader procedures, don't care either, as long as Export dir with kernel32.dll is present it's ok. If you don't need to create a new process you don't need directories at all.

2.
Does it work?
Maybe it needs '\' at the end of line? Can't check now.

comment This is another
movsx eax,ax
bsf eax,
Posted on 2002-09-23 14:07:15 by Sergo
Good to see you are back,

1)
But the PE/COFF standard on MS website doesn't specify the specific number of directories, and what's most important Windows PE loader procedures, don't care
Another example of M$ setting an standard, and they saying 'did we?'

2)Yes, it works, great, that?s a snippet from my code.

Sergo, go on and ask all your questions, I find some of them rather interesting.

Regards,
Posted on 2002-09-25 12:40:15 by slop
To Sergo:

I made a mistake, the standard is still there:
Quote from MSDN Journal, last February issue:
At the end of the IMAGE_NT_HEADERS structure is an array of IMAGE_DATA_DIRECTORY structures. This field contains the number of entries in the array. This field has been 16 since the earliest releases of Windows NT.


So, where did you get your references from?
Posted on 2002-09-30 03:50:46 by slop