flat assembler
Message board for the users of flat assembler.
Index
> Main > fasm newbie questions Goto page 1, 2 Next |
Author |
|
fasmnewbie 27 Jun 2015, 06:35
Master, you are actually here to bash FASM, not as an honest user of FASM posting honest questions. That kind of attitude will take you nowhere. I learned this from my Guru in Tibet
You told us that you been struggling to understand FASM for quite some time but your post number is barely 7 posts in total? That shows your true color and intention. Clearly you are extremely mad about the other thread bashing NASM. I knew it!! I am reporting you to Frank Kotler now. Maybe you could use some good advise from him for your bad attitude. Are we still friends or what? |
|||
27 Jun 2015, 06:35 |
|
PeExecutable 27 Jun 2015, 06:39
These are real questions that I wonder about. If you don't want to answer, leave it to someone else.
|
|||
27 Jun 2015, 06:39 |
|
fasmnewbie 27 Jun 2015, 06:47
PeExecutable wrote: These are real questions that I wonder about. If you don't want to answer, leave it to someone else. |
|||
27 Jun 2015, 06:47 |
|
fasmnewbie 27 Jun 2015, 06:55
I am through with this dude / girl. That hatred.....
I am back to bed now. |
|||
27 Jun 2015, 06:55 |
|
revolution 27 Jun 2015, 07:18
PeExecutable wrote: Question 2: Another minor issue for me is when I am coding in MS COFF mode and I want to compile COFF objects. I want to be able to use the extended features of fasm (.if, .then) and all the layers that it offers, but it seems to be including all the API functions too when I include the win32ax include file, is this too much to include for a simple coff project? Should I include that file for simple coff projects? PeExecutable wrote: Question 3: Can I reference structures with pointer to structures in the procedure argument? How? Code: struc xyz ... {<stuff>} the_struc xyz ... stdcall function, the_struc, ... PeExecutable wrote: Question 4 (A very bothersome issue for me): In NASM, I can simply switch to the data segment by issuing a macro [SECTION] to switch to the data section and I can declare data anywhere in source code and it will be put into the active section. How can I declare data in the data section without adding it directly to the data section manually? This problem is one of the problems that caused me to abandon fasm, I couldn't find an easy way to live with this. PeExecutable wrote: Question 5: The fixup section, should I include it in every new project? What exactly should I put in it? This bothers me quite a bit, an explanation would be appreciated. PeExecutable wrote: Question 6: In NASM I provide the -e command line option to see the output from macros, how can I do that in fasm to see what my macros produce? PeExecutable wrote: Question 7: How can I make a section shared, using fasm? The fasm manual does not specify or support all the flags that I need to use. fasm manual wrote: section directive defines a new section, it should be followed by quoted string defining the name of section, then one or more section flags can follow. Available flags are: code, data, readable, writeable, executable, shareable, discardable, notpageable. PeExecutable wrote: Question 8: How does fasm treat data declared as .bss and .data, are there any merging going on? PeExecutable wrote: Question 9: I have some fasm source files made by someone else and they use 'on nul' on top of the source file, what does this do? PeExecutable wrote: Question 10: How can I customize the prologue and epilogue of my proc without interfering with the rest of the proc endp structure? PeExecutable wrote: Question 12: Does fasm have mechanisms for using SEH or do I have to create a macro myself? PeExecutable wrote: Question 13: How can I detect the target architecture, in other assemblers you can restrict it by issuing a .386 directive, and so on, but in fasm I don't know how to detect the final architecture without going through all the instructions manually. PeExecutable wrote: Question 14: How can i temporarily disable fasm's optimization? PeExecutable wrote: Question 15: How can I align the stack when I use proc and endp? PeExecutable wrote: Question 16: (Not very relevant): How can I customize the dos stub from fasm? PeExecutable wrote: Question 17: How can I specify the executable base address or use the fixed base address option? PeExecutable wrote: Question 18: The include files in fasm has removed the conditional testing for different versions of windows, are there any flags I can set so the include files works for a specific windows version? PeExecutable wrote: Question 19: Fasm ships with wsock32 which is deprecated and is a stub for ws32, are there plans to include the most up to date winsock include file? |
|||
27 Jun 2015, 07:18 |
|
revolution 27 Jun 2015, 07:32
With regard to section merging there are macros that can merge different parts of the source together. This would allow the generation of EXEs directly with everything merged accordingly.
See: http://board.flatassembler.net/topic.php?t=12012 |
|||
27 Jun 2015, 07:32 |
|
PeExecutable 27 Jun 2015, 08:12
Wow, that was fast. Thanks for the speedy replies. About question 4 (changing sections): I assume if I put an align directive/macroinstruction right after the section directive, the alignment will be applied to that section which is active. I hope.
Code: mov eax, 10 section .data align 16 _tea db 'A cup of tea',0 section .code mov ecx, 20 Btw. You have no idea how eager I am to go back to fasm, after using nasm with my own custom macros, with a big lack of ability for using .if .then and so forth. If I just can manage to MASTER fasm this time, and fully. So that I don't have to go back again to another assembler, because fasm is outstanding, it's just that I need to get the things working, so I don't get stuck again. The thing about changing sections in fasm, I had no idea that it was just like nasm. I'm the kind of guy who likes to have huge projects manageable with master include files, then minor include files, perhaps with make files and the ability to build huge libraries with one command. That's how I like to do things. Last edited by PeExecutable on 27 Jun 2015, 08:23; edited 1 time in total |
|||
27 Jun 2015, 08:12 |
|
revolution 27 Jun 2015, 08:21
Yes, the alignment is active only where you place it. So it would place anywhere from zero to fifteen NOP instructions. But each new section will get a 'natural' alignment so putting align at the beginning of a section does nothing.
BTW your example of usage of 'section' is not correct for fasm, unless you are using a macro named 'section'. |
|||
27 Jun 2015, 08:21 |
|
PeExecutable 27 Jun 2015, 08:24
Ok, quotes missing, I see that now
|
|||
27 Jun 2015, 08:24 |
|
PeExecutable 27 Jun 2015, 09:01
You mentioned to include 'if.inc' in my ms coff project source files to replace win32ax.inc
But if I also want to be able to nest my procedure calls, are there other include files other than if.inc I should put into my ms coff source files? |
|||
27 Jun 2015, 09:01 |
|
revolution 27 Jun 2015, 09:16
You can still include 'win32ax.inc' in MS COFF sources. No harm will come. It implicitly includes 'if.inc' as part of it. It is really up to you what you want to include. Anything you don't use would make outputs from things like 'PREPSRC.INC' too verbose, but otherwise nothing will break.
|
|||
27 Jun 2015, 09:16 |
|
PeExecutable 27 Jun 2015, 09:22
I tried to change to the data section and back to code again as shown in this sample. It did work but with one minor issue, the debug window shows that fasm has put 2 int3 instructions right where I change to the data section. What have I done wrong?
Code: ; example of making Win32 COFF object file format MS COFF extrn '__imp__MessageBoxA@16' as MessageBox:dword section '.text' code readable executable public _demo _demo: push 0 section '.data' data readable writeable _tea db 'A cup of tea',0 section '.text' code readable executable push _caption push _message push 0 call [MessageBox] ret section '.data' data readable writeable _caption db 'Win32 assembly',0 _message db 'Coffee time!',0 The two int3 instructions align it by 4, it seems to. But thats not what I expected it to do. It shouldn't align the code section by 4. I expected it to put the _tea string below the _message string in the data section and continue code flow normally. One another question: EQU's in my previous assemblers have always been absolutely constant, unchangeable. In fasm you can change them and (pop them) but if there is a way to define non-changeable constants let me know. I highly appreciate and respect the traditional purpose of EQU where it can't change, and if it can change the compiler ought to at least tell about it in a warning (which it does not do). EQU's are one of my beloved children in asm, i'd like some input on this. Last edited by PeExecutable on 14 Jul 2015, 16:38; edited 2 times in total |
|||
27 Jun 2015, 09:22 |
|
revolution 27 Jun 2015, 12:28
The manual specifies this in 2.4.3 Common Object File Format
Quote: By default section is aligned to double word (four bytes), in case of Microsoft COFF variant other alignment can be specified by providing the align operator followed by alignment value (any power of two up to 8192) among the section flags. |
|||
27 Jun 2015, 12:28 |
|
revolution 27 Jun 2015, 12:55
The only way that I am aware of generating an error (not a warning) when a variable is redefined would be with the assembler equals (=) assignment.
Code: assert x or 1 ;check if x is defined only once x=1 Quote: flat assembler version 1.71.39 (3145344 kilobytes memory) Code: assert x or 1 ;check if x is defined only once x=1 x=2 ;redefine x Quote: flat assembler version 1.71.39 (3145344 kilobytes memory) |
|||
27 Jun 2015, 12:55 |
|
Tomasz Grysztar 27 Jun 2015, 13:28
revolution wrote: The only way that I am aware of generating an error (not a warning) when a variable is redefined would be with the assembler equals (=) assignment. In fasm g there is a ":=" construct that allows a short form definition of numeric (or linear polynomial) constant, but it does in fact have the same effect as "LABEL ... AT ...", it is just shorter and simpler. With fasm g it is also possible to have a forward-referenced symbolic constant, though I did not invent any syntax analogous to ":=" that would apply to symbolic values. |
|||
27 Jun 2015, 13:28 |
|
PeExecutable 27 Jun 2015, 16:24
To rephrase the question, what methods do you guys use to place data in the data section when you need to do it from anywhere. What method should I use to get the _tea string placed exactly below the _message string? (without the int3 instructions preferably)
|
|||
27 Jun 2015, 16:24 |
|
revolution 27 Jun 2015, 16:29
Did you read the link to the list building macros?
Did you read the quote from the manual about using align with the section directive? You appear to be asking the same questions again so I am unsure where you are currently at. |
|||
27 Jun 2015, 16:29 |
|
PeExecutable 27 Jun 2015, 16:37
I am lazy at times, will check it out
|
|||
27 Jun 2015, 16:37 |
|
PeExecutable 27 Jun 2015, 18:08
I read through the list builder, I understand the concept. You basically take over the charge of defining the sections from inside your own macros, and thereby you can also control the order of defined data. It's smart and I like it.
But apart from that, if we go back to a fasm-point of view, the goal of a macro engine of an assembler (in my opinion), is to make it powerful and flexible, but once you need a macro to strongly override the default behavior of an assembler, time has come for standardization. A macro system is designed to help you use the assembler, but when a macro system moves into the domain of overriding the entire assembler, time has come to standardize things. It's misuse of the macro system. A good principle is: 1. If something is frequently needed, standardize it and put it in code instead of having people do it in macros. Thanks, that doesn't mean I hate it (When power become necessary, it becomes weakness) I mean, just think about it, we're actually talking about removing white lines in .fas files only to implement a feature to define data elements in the data section. We've moved into a crazy thing here only to get one feature (that most people expect already to be implemented in any language). Standardize it, just do it. Every indication points toward doing that. Standardize it if it becomes a big problem. There is a fine line between logic and madness. This thing we're talking about, is madness. The macro system is designed to help the assembly programmer, but when macros goes into the act of replacing what the assembler can't already do, it's bad philosophy. Other than that, thanks for the list builder. But listen carefully to what I have to say about this, take it seriously. "If you let the macro system take over everything with the assembler, people will stop appreciating macros and they will lose respect of it". People will get respect for the macro system, when they can use it in small things. A powerful macro assembler, and a loveable macro assembler is one the user can use without the actual need to use macros, in that way, macros become a luxury. Last edited by PeExecutable on 27 Jun 2015, 18:27; edited 4 times in total |
|||
27 Jun 2015, 18:08 |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.