flat assembler
Message board for the users of flat assembler.

flat assembler > Main > How difficult was it to create FASM?

Author
Thread Post new topic Reply to topic
Mino



Joined: 14 Jan 2018
Posts: 160
Hello,
I am a little interested in the realization of the assembler FASM. Indeed, it is there, ready to be used, ready to compile, but I imagine that there have been some difficulties or trials to overcome before being what it is, no?
I would like to know if it is complicated to create an assembler, not that I want to do it, but just out of curiosity and admiration:)
It is often said that creating an assembler is simple: the instructions correspond to an opcode instruction of the machine code, but I imagine that it is much more complex than that.
So I would like to have a little more on that.
Thank you Smile

_________________
The best way to predict the future is to invent it.
Post 17 Jul 2018, 13:25
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6996
Location: Kraków, Poland
There were many incremental steps on the way to where it is today, some of them easier, some of them harder.

fasm was actually my second assembler, my first one (made around 1997) was called ASM32 and had a very straightforward (one could say naive) architecture. Some portions of it survived in the MDAT tool, the others were lost. The lessons I learned helped me a lot when designing the architecture for fasm in 1999.

Even then, the first version of fasm that was already capable of assembling itself (my private version 0.90) was also very simple compared to its later incarnations. The self-assembly required a lot of passes and it was very slow, so later I rewrote the assembly module to have a separate parsing stage and then perform all the passes by interpreting an internal byte-code created by the parser. This already increased the complexity noticeably, while this still was only a beginning. After I released this improved version publicly in 2000 I started getting feedback, and the assembler kept growing. During the next few years it has increased in complexity tremendously, as I kept adding new output formats, instructions and directives.

And all this experience has then led me to start designing my third assembler, what has later become fasmg. This project was very complex from the very beginning, as it had to consider all the things that fasm accumulated over the years. Perhaps that is why it took me so many years before I managed to take it out of design phase. And all this complexity is not even related to assembling instructions into the machine code, as fasmg does not even do that! You can look at my design notes for fasmg to see what kind of problems I needed to tackle. These notes had been written before I even started working on implementation, I needed to first make sure that the language can be defined in a way that would at least be self-consistent, while fulfilling all the expectations imposed by the legacy of fasm. And even then, some things from the initial design had to change after I started using fasmg in actual projects and noticed some not foreseen problems.
Post 17 Jul 2018, 17:31
View user's profile Send private message Visit poster's website Reply with quote
Mino



Joined: 14 Jan 2018
Posts: 160
Thank you very much for your answer Smile This is all remarkable.
Post 18 Jul 2018, 20:50
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< 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-2018, Tomasz Grysztar.

Powered by rwasa.