flat assembler
Message board for the users of flat assembler.
Index
> Main > Formatter directives |
Author |
|
decard 03 Oct 2004, 20:35
hi,
It is difficult to say whick directives are optional and which are not. First of all, you have the "format" directive, this one determines set of other directives that you an use. So, with "format PE", output will be generated in windows-exe format, and you will have PE-specific directives available: section, rva, etc. But don't think about these directives in "mandatory or optional" category, rather browse available examples and see how they are used. This is the best way to learn them. |
|||
03 Oct 2004, 20:35 |
|
negativeIQ 03 Oct 2004, 21:16
Hi, tanks for answering.
I had a look into the examples and I'm even more puzzled than before. I mean the use of these directives (format specific ones) seems to be arbitrary. For example if I write this: format PE x db 0 It would compile despite the fact I haven't included the data definition into a data section... Further help will be appreciated. Thanks. Bye. P.S. another question: does the fasm documentation really cover anything one should know about fasm or is it far from complete? |
|||
03 Oct 2004, 21:16 |
|
vid 04 Oct 2004, 10:35
Quote:
there is no difference between data and code in compiled program, both are "data", only things that matters is if processor tries to execute "data" (instructions in machine language). And later when you learn self-modifying code you'll find out that something like "x db 0", doesn't have to be nescessary data definition, for example in old DOS viruses you often see things like (something db 90h), which is hardcoded "nop" instruction (does nothing) which has opcode 90h in machine language, and can be replaced by another one-byte opcode. PS2: it covers most one should know about FASM. But about FASM, not about assembly. And also there are some "extreme" cases that are not covered into detail because it will make documentation hardly readable. Also try to look at my tutorial somewhere in section main (i don't have link now, sorry, sitting behind friend's computer...). |
|||
04 Oct 2004, 10:35 |
|
negativeIQ 04 Oct 2004, 10:43
Ok, but I'd like to know if (in the case of PE for example) I'm "forced" to use:
section '.code' code readable executable section '.data' data readable writeable or other directives. Is there a pattern to follow? Thanks, bye. |
|||
04 Oct 2004, 10:43 |
|
wanderer 04 Oct 2004, 11:49
negativeIQ wrote: Ok, but I'd like to know if (in the case of PE for example) I'm "forced" to use: Look at the beer example from fasm package. _________________ Best regards, Antoch Victor |
|||
04 Oct 2004, 11:49 |
|
negativeIQ 04 Oct 2004, 12:02
Thanks for the hint.
; no section defined - fasm will automatically create .flat section for both ; code and data, and set entry point at the beginning of this section But is this also true for other file formats (different than PE)? I mean: can I write code only specifying the format without using any other directive? Thanks, bye. |
|||
04 Oct 2004, 12:02 |
|
pelaillo 04 Oct 2004, 13:25
negativeIQ wrote: P.S. another question: does the fasm documentation really cover anything one should know about fasm or is it far from complete? Fasm documentation covers near everything Fasm related. The full x86 instruction set is far beyond the scope of Fasm documentation. The same is true for the platform specific topics such as DOS interrupts, Windows API's or Linux syscalls. Regarding formatter, take into account this: Fasm will stick to your orders. It will not take any decision for you. For example, you can put code in your data section or viceversa and fasm does not complain at all. You can call sections as you wish and have any number of sections and Fasm will not issue neither a warning about it. This is an advantage, but comes at the expense of having to know how the format should be, how the thing works. If you don't specify any Format directive, the default is a plain binary file. Mnemonics will be translated into opcodes, data will go as it is and in the place you define it. Each format comes with certain directives depending on its nature. Everything's optional and there is a default if you don't specify a directive. Hope it helps |
|||
04 Oct 2004, 13:25 |
|
negativeIQ 04 Oct 2004, 15:46
Thanks for answering. I'm running some experiment to better understand this topic.
In particular I'm trying to write a simple asm function that I call from a C program. After exploring cdecl.inc I discovered cproc (that is not documented into fasm manual). I compile the asm file specifying COFF format with no additional directives. I compile and link (using LCC compiler): lc project.c function.obj And LC warns me like this: File function.obj contains unknown section .flat. .text section assumed So I guess these specific directives have some importance... Bye. P.S. maybe this is a subject for anothe topic, however: what does actually cproc and endp do? The macro language they're written in is hard to read for me. |
|||
04 Oct 2004, 15:46 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.