flat assembler
Message board for the users of flat assembler.

Index > Windows > Comparing FASM to TASM

Goto page 1, 2  Next
Author
Thread Post new topic Reply to topic
Alexander



Joined: 22 Dec 2008
Posts: 40
Alexander 19 Jan 2009, 16:32
If I compare fasm to tasm I miss something.

For example, in tasm I was able to set the target processor like

Code:
         .8086
         .186
         .286P
         .486P
         .586P
         .587 
         ...
    


It was also possible to set the model.


Code:
         small, flat, tiny, ...
    


I know we are in P-Mode or Long Mode now, but is there a possibility in fasm too?

Is it possible to set up a stack like it was in tasm?

In tasm I had a few segments like cs, ds, fs, ...
but in fasm, which do I have here?

data
code
idata
edata

and more?

And how can segments in fasm be valid combined with permissions like
readable, writeable, ...

In fasm manual there are a few sentences about this but how do I combine segements with permissions.

What means fixups?

An other question not related with tasm: How do I get my code ready of 64-Bit processors? I now a 64-Bit System like Vista64 is able of running a 32-Bit app on the top of Vista64. But when I call a 32-Bit Win32 dll like a dll created with fasm from .NET an error is thrown by .NET, so the .NET app has to be set manually to 32-Bit. Is fasm supported on both IA64 and x86_64 (AMD64)?

Is there any good documentation out there for "upgrading" from tasm, or is there any good tutorial for fasm, please?

I'm looking forward to your answers
Alexander Very Happy
Post 19 Jan 2009, 16:32
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20355
Location: In your JS exploiting you and your system
revolution 19 Jan 2009, 18:26
Alexander wrote:

For example, in tasm I was able to set the target processor like

Code:
         .8086
         .186
         .286P
         .486P
         .586P
         .587 
         ...
    
Have a look at "Macros to choose target CPU"
Alexander wrote:
It was also possible to set the model.


Code:
         small, flat, tiny, ...
    


I know we are in P-Mode or Long Mode now, but is there a possibility in fasm too?

Is it possible to set up a stack like it was in tasm?

In tasm I had a few segments like cs, ds, fs, ...
but in fasm, which do I have here?

data
code
idata
edata

and more?
include 'win32[a|u]x.inc' gives you this kind of thing. For DOS models check out the exe and com examples in the download.
Alexander wrote:
And how can segments in fasm be valid combined with permissions like
readable, writeable, ...

In fasm manual there are a few sentences about this but how do I combine segements with permissions.
This is a job for the linker. If you use fasm to directly create an exe file (something which tasm cannot do) then you need to place the code/data in whatever segment is appropriate.
Alexander wrote:
What means fixups?
A method of embedding relocation information into an exe file to allow the OS to reposition the code from its compiled base if needed.
Alexander wrote:
An other question not related with tasm: How do I get my code ready of 64-Bit processors? I now a 64-Bit System like Vista64 is able of running a 32-Bit app on the top of Vista64. But when I call a 32-Bit Win32 dll like a dll created with fasm from .NET an error is thrown by .NET, so the .NET app has to be set manually to 32-Bit. Is fasm supported on both IA64 and x86_64 (AMD64)?
Sure, use64 gives you the 64bit code generation mode.
Post 19 Jan 2009, 18:26
View user's profile Send private message Visit poster's website Reply with quote
Alexander



Joined: 22 Dec 2008
Posts: 40
Alexander 19 Jan 2009, 18:54
revolution,

thank you for your answer.

Is it possible to choose the target cpu without macros?

Another, question: Do you know which segements are allowed and which permissions I can give them?

Would you please be so kind to give me a detailed list?
Post 19 Jan 2009, 18:54
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20355
Location: In your JS exploiting you and your system
revolution 19 Jan 2009, 19:01
Alexander wrote:
Is it possible to choose the target cpu without macros?
No. Not unless you edit the fasm source code and make your own special version.
Alexander wrote:
Another, question: Do you know which segements are allowed and which permissions I can give them?

Would you please be so kind to give me a detailed list?
All segments are allowed, And you can give them any permissions you require. Perhaps I don't understand your question properly?
Post 19 Jan 2009, 19:01
View user's profile Send private message Visit poster's website Reply with quote
Alexander



Joined: 22 Dec 2008
Posts: 40
Alexander 19 Jan 2009, 19:13
Quote:
All segments are allowed, And you can give them any permissions you require. Perhaps I don't understand your question properly?


So, is it possible to give a relocation information a readable and writeable
or to give a data segment an executable attribute?

What combinations are commonly used in fasm on windows (and linux) and which of them make sense?

Thank you.
Post 19 Jan 2009, 19:13
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20355
Location: In your JS exploiting you and your system
revolution 19 Jan 2009, 19:23
Alexander wrote:
So, is it possible to give a relocation information a readable and writeable
or to give a data segment an executable attribute?
Yes, I suggest you try various things out. Experience is the best teacher.
Alexander wrote:
What combinations are commonly used in fasm on windows (and linux) and which of them make sense?
Have a look at win32[a|x](p).inc' to see which sections are defined by .data and .code. Play with it and try it for yourself.
Post 19 Jan 2009, 19:23
View user's profile Send private message Visit poster's website Reply with quote
Alexander



Joined: 22 Dec 2008
Posts: 40
Alexander 19 Jan 2009, 19:27
Ok, I'll do so.
Post 19 Jan 2009, 19:27
View user's profile Send private message Reply with quote
Alexander



Joined: 22 Dec 2008
Posts: 40
Alexander 20 Jan 2009, 12:38
revolution,

I haven't found anything in Win32WX or Win32AX. I've just found .text, .data, .idata.
Question
But what is about edata or relocation information?

Is there anywhere on the web a complete list on how to combine segments with permissions?

I found the following in the manual: http://flatassembler.net/docs.php?article=manual#2.4.2)

But thats a little bit weak, could anyone please give me some more information about which segments are allowed and how to combine attribute or permissions with segments?

Another question: Is it possible to create a stack with "enter", or how can I create one as I could in tasm?

Thanks
Alexander
Post 20 Jan 2009, 12:38
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20355
Location: In your JS exploiting you and your system
revolution 20 Jan 2009, 12:41
Code:
macro .data { section '.data' data readable writeable }

macro .code { section '.text' code readable executable }

...

section '.idata' import data readable writeable    
Those are the flags used; readable, executable, etc. See the fasm manual about the section directive.

I think you expect that there is some "correct" way to select flags, but there is no such thing. You can set whatever flags you want that suit your purpose. There are some "standard" flags used and "standard" sections defined but these are by no means what you must do. You could if you wanted put all of your code+data+imports+fixups+exports+whatever in one section with all the flags set. some AVs might get upset about it but it would still be a valid exe.
Post 20 Jan 2009, 12:41
View user's profile Send private message Visit poster's website Reply with quote
Alexander



Joined: 22 Dec 2008
Posts: 40
Alexander 20 Jan 2009, 12:48
So, a stupid question, but is it really possible to share my code segment, as I could do with a data segment?
Post 20 Jan 2009, 12:48
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20355
Location: In your JS exploiting you and your system
revolution 20 Jan 2009, 12:50
Alexander wrote:
So, a stupid question, but is it really possible to share my code segment, as I could do with a data segment?
Try it. I see no reason why you couldn't do it.
Post 20 Jan 2009, 12:50
View user's profile Send private message Visit poster's website Reply with quote
Alexander



Joined: 22 Dec 2008
Posts: 40
Alexander 20 Jan 2009, 12:52
Ok, so it would be possible. But isn't that a little bit unsecure or are there any needs to do such things?
Post 20 Jan 2009, 12:52
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20355
Location: In your JS exploiting you and your system
revolution 20 Jan 2009, 12:57
Alexander wrote:
Ok, so it would be possible. But isn't that a little bit unsecure or are there any needs to do such things?
Perhaps, who knows what is insecure these days. With virus writers getting smarter every day anything is possible. Personally I wouldn't worry about it too much.
Post 20 Jan 2009, 12:57
View user's profile Send private message Visit poster's website Reply with quote
Alexander



Joined: 22 Dec 2008
Posts: 40
Alexander 20 Jan 2009, 12:59
A last question about the PE-Format is it possible to set another Version than "format PE GUI 4.0"? Supports fasm any older PE-Formats?
Post 20 Jan 2009, 12:59
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20355
Location: In your JS exploiting you and your system
revolution 20 Jan 2009, 13:03
Alexander wrote:
A last question about the PE-Format is it possible to set another Version than "format PE GUI 4.0"? Supports fasm any older PE-Formats?
Try it. yes it is possible, but you really should try it for yourself to by sure that I am not lying.
Post 20 Jan 2009, 13:03
View user's profile Send private message Visit poster's website Reply with quote
Alexander



Joined: 22 Dec 2008
Posts: 40
Alexander 20 Jan 2009, 13:05
revolution,

thank you for your patience regarding my questions.

Alexander
Post 20 Jan 2009, 13:05
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 20 Jan 2009, 13:07
IMO it is always wise to stick to standard section settings. I'd say FASM is one of very few compilers (if not only one) capable of producing non-standard PEs, and there are LOT of tools which have troubles with them. Not just antiviruses, you can have trouble with debuggers, disassemblers, protectors, or even some windows loaders. Especially if you combine flags to some complete nonsense.

If you want to use FASM like other assemblers (with linker), you must set "format MS COFF" instead of "format PE" (eg. use FASM just to produce .obj files, not .exe files directly), and then use linker on these object files same way you are used to from TASM.
Post 20 Jan 2009, 13:07
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Alexander



Joined: 22 Dec 2008
Posts: 40
Alexander 20 Jan 2009, 13:13
vid,

where can I find the standard sections settings? I've looked nearly everywhere, but I haven't found anything. Embarassed
Post 20 Jan 2009, 13:13
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20355
Location: In your JS exploiting you and your system
revolution 20 Jan 2009, 13:25
Alexander wrote:
where can I find the standard sections settings? I've looked nearly everywhere, but I haven't found anything. Embarassed
It is already answered in this thread. See here, just 10 posts above this one.


Last edited by revolution on 20 Jan 2009, 13:27; edited 1 time in total
Post 20 Jan 2009, 13:25
View user's profile Send private message Visit poster's website Reply with quote
Alexander



Joined: 22 Dec 2008
Posts: 40
Alexander 20 Jan 2009, 13:27
Ok, revolution.
I'm sorry.
Post 20 Jan 2009, 13:27
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.