flat assembler
Message board for the users of flat assembler.
Index
> Main > section problem |
Author |
|
Overclick 16 Feb 2022, 07:35
Seems like you need my multisections macro:
https://board.flatassembler.net/topic.php?t=21545 Switch between sections anytime anywhere even in proc and macros. Example: Code: .data ... .code ... .data ... .code ... |
|||
16 Feb 2022, 07:35 |
|
revolution 16 Feb 2022, 09:19
The reason is because fasm is not a linker. So the sections are not merged. They are output as-is, in the same order specified in the source code.
To solve this, you can use a linkable output format and it will all be merged by the linker. This is what the other assemblers do. But fasm has extra functionality, that other assemblers don't have, to output an executable file directly, without a linker. This is where you can fall into trouble with multiple sections. As Overclick says above, you can use macros to do the merging within the source code. |
|||
16 Feb 2022, 09:19 |
|
Tomasz Grysztar 16 Feb 2022, 09:34
You you could say that this property is what makes flat assembler "flat", although that would be a tongue-in-cheek explanation.
I designed fasmg to provide a set of primitives that could be combined to implement various kinds of assembler syntax and behaviors, including but not limited to ones compatible with fasm 1. The re-enterable virtual blocks you mentioned, or commands like RESTARTOUT, are among such basic components - to be used to construct various higher level features. As intended by this design, not only instruction sets but also output formats are implemented through add-ons. The standard ones are compatible with fasm 1 and thus similarly "flat", however this does not always need to be the case, as demonstrated by successful attempts to assemble source texts written for some old assemblers. It is up to the designer of a specific header set to choose what features to provide and how to lay out everything. For example, filling several sections in parallel would make it harder to provide features like $%, although with help of multi-pass predictions you could probably make it work if you really wanted - but these are the kinds of decisions that belong in the higher layer, allowing the actual primitives to be simpler and more reliable. The design of fasmg was my answer to all the mutually exclusive requests that I kept receiving during the decades of fasm's development. This is why it is so unrestrained in its flexibility, offering all the possibilities while giving very little to begin with. You can have all the features you wanted in fasm 1, but the caveat is that might need to write a new set of headers to implement the specific syntax and features almost from scratch. Perhaps making fasmg was my ultimate way of saying "give me a rest" - another toungue-in-cheek explanation that nonetheless has some grain of truth in it. |
|||
16 Feb 2022, 09:34 |
|
FlierMate 16 Feb 2022, 10:00
Tomasz Grysztar wrote: Perhaps making fasmg was my ultimate way of saying "give me a rest".... fasm 1 is more than enough for me, because I try to use raw CPU instructions whenever possible, not relying on macros. A huge "thank you" to you and revolution for always be there on this message board. As what revolution says, fasm 1 can generate output binary executable directly, which is normally what I need, except in OS development where mixing with HLL is only possible with a linker script. I fully understand the responsibility of author in maintaining a software project and am amazed this flat assembler has continually serve the asm community for the past two decades. |
|||
16 Feb 2022, 10:00 |
|
rostok 17 Feb 2022, 07:37
Overclick wrote: Seems like you need my multisections macro: Ok. I will investigate it. Thanks |
|||
17 Feb 2022, 07:37 |
|
rostok 17 Feb 2022, 09:09
Tomasz Grysztar wrote: You you could say that this property is what makes flat assembler "flat", although that would be a tongue-in-cheek explanation. In my opinion, able to mix/expand sections is a very basic feaure of an x86 assembler. I.e. every assembler has a machine instruction set, macros, directives, data store and allocation features etc. and every x86 assembler has section mix/expand features. I think you also have seen this otherwise you would not add extra features to flatg to be able to do this even indirectly. So you have already implemented it somehow and what I asked actually is why don't you add it as a basic feature even by some macros? Now what I understand from your answer is that this is a choice. Then ok. I have no objection and will continue to use fasm as it is because it is still the best and the most flexible one among the others. |
|||
17 Feb 2022, 09:09 |
|
revolution 17 Feb 2022, 10:08
The section "problem" is an extra.
You can choose to use it if you wish. Then you get all the extra power that comes with it. But with extra power comes extra responsibility. Use it with care. OR: You can choose to use fasm in a way similar to all the other assemblers and just use linkable output formats only, and avoid the direct executables. Then you lose the power. But you also have less responsibility. |
|||
17 Feb 2022, 10:08 |
|
Tomasz Grysztar 17 Feb 2022, 10:13
rostok wrote: In my opinion, able to mix/expand sections is a very basic feaure of an x86 assembler. I.e. every assembler has a machine instruction set, macros, directives, data store and allocation features etc. and every x86 assembler has section mix/expand features. rostok wrote: (...) and what I asked actually is why don't you add it as a basic feature even by some macros? |
|||
17 Feb 2022, 10:13 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.