flat assembler
Message board for the users of flat assembler.

Index > Main > Are you using CALM (fasmg)?

Author
Thread Post new topic Reply to topic
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8356
Location: Kraków, Poland
Tomasz Grysztar 21 May 2020, 12:04
Have any of you been using CALM in your projects? In my own uses I consider it very successful, as it not only allowed me to bring assembly times to acceptable even on larger projects (like HeavyThing, which I've been using as a kind of benchmark, as it is not only large, but requires many passes to assemble), but also allowed me to implement various extensions in a much cleaner way than it could ever be possible with classic macros.

However it would be helpful to know if anyone else attempts to use it and whether currently available documentation is adequate for that. It would tell me if there is something I should focus on in the area. I'm aware that CALM adds another layer of complexity on top of fasmg's language that is already a bit convoluted with many non-standard design choices (partly because of its legacy). Even though CALM actually makes many tasks easier, it probably requires first a good understanding of how it all works, and therefore I think that making a good guides might the most important here.

In addition to the new chapter in the main manual I have also added some CALM-specific notes near the end of the introductory guide, but they are almost exclusively about converting existing macroinstructions. I might consider adding more CALM-specific sections there, with things like examples of applying global preprocessing with CALM interceptors and some general hints how to approach design of new instruction sets.

Another option I'm considering is to make another live stream of me working with CALM - I could, for example, convert the "fastcall" macro (one of the few remaining in the compatibility header set that has not been converted but highly needs it, for performance reasons) and answer questions. If you would be interested in such CALM-focused content, please let me know.
Post 21 May 2020, 12:04
View user's profile Send private message Visit poster's website Reply with quote
ProMiNick



Joined: 24 Mar 2012
Posts: 802
Location: Russian Federation, Sochi
ProMiNick 21 May 2020, 14:52
videos about CALM would be usefull.
CALM is completely different language,
so fasmg is mix of data directive definition syntax, native fasmg syntax, and CALM one.

Could be CALM presented like x86 instructions presented in fasm manuals?
instructions translated to x86 machine opcodes directly and CALM instructions translated to preprocessor constructions directly.
needed same level of understanding: what does each CALM instruction, what restrictions, what it behavior on different syntax errors, what syntaxes it accept.

Well I can`t explain...
Needed something that helps to feel CALM, like I feel x86 instructions (even not all, some of them I have to test in small code pieces to ensure they act the way I assumed & not differently).
In case of CALM I have no idea how to test their behavior, or understand why error happened, I even can`t catch where error. So I cant even test assumption and if it isnt work - so all is bad in that case.
Post 21 May 2020, 14:52
View user's profile Send private message Send e-mail Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8356
Location: Kraków, Poland
Tomasz Grysztar 21 May 2020, 15:14
ProMiNick wrote:
Could be CALM presented like x86 instructions presented in fasm manuals?
I think that the chapter in the main manual presents all the available commands in a manner quite similar to how fasm's manual presents x86 instructions - with description of syntax and examples. However, in some areas it requires a good understanding of concepts from other parts of manual. Perhaps it is not clear enough in some places?

ProMiNick wrote:
instructions translated to x86 machine opcodes directly and CALM instructions translated to preprocessor constructions directly.
I admit I'm not sure what you mean here. But perhaps this might help: the "How to convert a macroinstruction to CALM?" section of the introduction to fasmg shows an example of a macro and its fully equivalent conversion to CALM. Actually, as explained there, with an exception of LOCAL directive everything that macros do can be simulated with just two CALM commands: ARRANGE and ASSEMBLE. All other CALM commands are there to allow more sophisticated preprocessing, which is beyond what the basic preprocessor is able to do.

A live session might be a good idea then, if you'd be able to join and ask questions live, I could perhaps explain some concepts better, having an instant feedback about what is unclear.
Post 21 May 2020, 15:14
View user's profile Send private message Visit poster's website Reply with quote
MaoKo



Joined: 07 May 2019
Posts: 100
Location: Paris/French
MaoKo 25 May 2020, 03:42
I'm trying to recreate the RGBDS assembler for assembling game boy/color game.
Maybe a good tutorial on "How to create efficient relocation table with fasmg" will be useful.
I known there is something like that in the intro but imo it's don't fit well in real code.
Quote:

In case of CALM I have no idea how to test their behavior, or understand why error happened, I even can`t catch where error. So I cant even test assumption and if it isnt work - so all is bad in that case.

I'm pretty agree with that (but for me it's fasmg in general) and if you play with context too much it's pretty easy to "shoot yourself in the foot".
And also something useful to change, perhaps, is the fact that when the calm script don't generate any code, no empty file will be created. Nobody care when it's about one test file, but if you have many of these it's not really pratical.
Most of the time, my test code is just the check that some macro/calm work well.
But fasm1 have also this behavior so I don't know.
regard.
Post 25 May 2020, 03:42
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8356
Location: Kraków, Poland
Tomasz Grysztar 25 May 2020, 10:10
MaoKo wrote:
Maybe a good tutorial on "How to create efficient relocation table with fasmg" will be useful.
I known there is something like that in the intro but imo it's don't fit well in real code.
Yes, that part of the guide is pre-CALM and now I would have done it differently. Still, I think that it at least shows the general principle, so I think I would rather supplement it with additional CALM-based examples instead of rewriting it completely.
MaoKo wrote:
I'm pretty agree with that (but for me it's fasmg in general) and if you play with context too much it's pretty easy to "shoot yourself in the foot".
That's an important hint, since dealing with this kind of problems likely means that what you are doing is not basic. I was afraid that by presenting more advanced topics I would probably lose most of potential audience right at the start. But if I'm going to do a live stream with Q&A, I can adapt and switch to topics appropriate to the people that come to watch.

Still, as I have no idea how many people are out there that actually tried to something more complex with fasmg/CALM (and my guess is not that many - but I started this topic to find out), I would gravitate towards making more basic guides, a "gentle introduction" one might say. But even then I may be able to present some basic troubleshooting tricks that could perhaps turn out helpful even to advanced users.

MaoKo wrote:
And also something useful to change, perhaps, is the fact that when the calm script don't generate any code, no empty file will be created. Nobody care when it's about one test file, but if you have many of these it's not really pratical.
Most of the time, my test code is just the check that some macro/calm work well.
But fasm1 have also this behavior so I don't know.
With test files like that the usual method (also with fasm 1) has been to do something like "fasm test.asm nul" or "fasm test.asm /dev/null", depending on system. Combined with -i switch it even allows to test simple things without touching any source/output files at all.
Post 25 May 2020, 10:10
View user's profile Send private message Visit poster's website 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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.