flat assembler
Message board for the users of flat assembler.
Index
> Programming Language Design > CALM extension of fasmg Goto page Previous 1, 2 |
Author |
|
Tomasz Grysztar 15 Jan 2020, 12:43
One more little feature added: TRANSFORM can now take a second argument to identify and replace symbols from a specific namespace. This simplifies a trick I've been using to recognize size operators in x86 instructions (although performance gain there is negligible), but I believe it can be even more useful in other places, while it required almost no effort to implement (because it uses an option that fasmg engine had anyway). Note that the namespace base is resolved at compilation time.
I think the language of CALM is mostly complete, though. One thing that I considered but did not make it into language is a way to call another CALM instruction directly (without having to pass through ASSEMBLE). I may revisit the idea further in the future, but so far I did not see enough advantage in having it. |
|||
15 Jan 2020, 12:43 |
|
MaoKo 16 Jan 2020, 06:51
Hello. After some time, I've just encounter a problem in my project.
It's just a little question . In this code: Code: calminstruction calminstruction?.initsym? destination?*, value?& publish destination, value end calminstruction calminstruction calminstruction?.nested? local buffer arrange buffer, initsym A, $00 assemble buffer end calminstruction calminstruction test? nested assemble A end calminstruction A it's expanded to $00. So everything work fine but with the initsym in place of arrange the result is different. Code: calminstruction calminstruction?.initsym? destination?*, value?& publish destination, value end calminstruction calminstruction calminstruction?.nested? local buffer initsym buffer, initsym A, $00 assemble buffer end calminstruction calminstruction test? nested assemble A end calminstruction I don't understand why the symbolic variable "A" is defined in the scope of "nested" CALM and not in the "test" CALM. I really sorry if this was answered somewhere. PS: I don't known if it's a normal behavior but you can define stuff like that: Code: calminstruction place?.:?.holder?* end calminstruction space can be replaced by dot? Thx in advance. |
|||
16 Jan 2020, 06:51 |
|
Tomasz Grysztar 16 Jan 2020, 07:43
MaoKo wrote: I don't understand why the symbolic variable "A" is defined in the scope of "nested" CALM and not in the "test" CALM. Tomasz Grysztar wrote: (...) INITSYM allows to prepare a text equipped with recognition context of CALM instruction, which in turn allows ASM to assemble instructions referring to local symbols. When you instead use INITSYM, it gets called like a macro, so the values of arguments carry their original context - in this case the context of "nested" instruction, because that's where the INITSYM has been called. This text of argument is then assigned as-is to the variable, and the command you get in "buffer" ends up having a different context for "A". Also, in both cases the command you execute from buffer is another INITSYM, which then again adds context to the text that did not have one already. So in the first case, when "A" in "buffer" had no context associated yet, in becomes equipped with the context of "test", while in the second case it already had the context of "nested" and packing it into another one changes nothing. In practice, in many cases this carrying of recognition context works so naturally that you don't really notice it. But with ARRANGE you should remember that the context is stripped from the symbols in the pattern. Although I could make it so that when name is not preceded by "=" but no value is found for that symbol, it could be copied as a name with additional context, but this would not be reliable. I'm still considering adding an error message, though. MaoKo wrote: PS: I don't known if it's a normal behavior but you can define stuff like that: Code: calminstruction place?.:?.holder?* assemble ?.holder? end calminstruction place?. display 'OK!' |
|||
16 Jan 2020, 07:43 |
|
MaoKo 16 Jan 2020, 07:54
Ok thx you Thomasz.
Quote:
Yes, I'm sorry. At the time of reading, I didn't understand the original "meaning". Quote:
In fact, I said this because with macro in place calminstruction, this not work. I didn't know that a dot can follow a question mark. |
|||
16 Jan 2020, 07:54 |
|
Tomasz Grysztar 16 Jan 2020, 08:09
MaoKo wrote: In fact, I said this because with macro in place calminstruction, this not work. I didn't know that a dot can follow a question mark. BTW, if I add an error message for ARRANGE when it does not find a defined symbol, would it break much for you? I tried it and I see that it helps to catch bugs in instructions. In fact, it showed me several mistakes in x86 headers, and now I'm convinced I should make it more strict this way. |
|||
16 Jan 2020, 08:09 |
|
MaoKo 16 Jan 2020, 08:21
Yes, why not. This might be more "user-friendly", I guess .
|
|||
16 Jan 2020, 08:21 |
|
Tomasz Grysztar 16 Jan 2020, 10:26
Initially I thought it could be nice to release CALM officially once the version string reaches "it...", to have a clear-cut boundary. Then I changed my mind and released it early (encouraged by all of you that started using it immediately!). But perhaps a final, stable release is going to be "it..." after all.
|
|||
16 Jan 2020, 10:26 |
|
nasm 02 Nov 2021, 16:36
It is all about having flexibul soolutions. When you construct something, it's about reusing what you already have and add to it, if you imagine a christmas tree and as you put up the tree and add gadgets to it, it should come to a point where the whole tree becomes flexibul enough to be used even if nothing on the tree is really constant and hardwired, everything is built on layers, and that is what flexibul soolutions is all about. It's a little bit like Microsoft C#, everything is built in layers and inside boxes, in a flexibul way.
The oven is the baker's best tool. It makes the pastry firm and unchanging. What is unchangeable becomes sacred over time. What is sacred becomes loved. What is loved becomes a super effective tool. If you use the christmas tree construction model, nothing becomes sacred, nothing becomes loved, and everybody hates it. When you need to explain something to people, the art of communication begins at the shortest possible description. If you can't describe your idea in 10 words, you should not be describing it at all. In there lays the art. The first line should be a 10 word description of your idea that describes your idea, the second line and after that is the full description. A good assembler respects the time frame that the programmer has at his disposal. He does not have time to play around with a decade long experiment. Microsoft only seems to be playing around with layers upon layers, they really toss the whole code in the garbage every time and they start over, it's just that it happens so fast you barely notice that. A good assembler must not build on layers, it should be rewritten, toss parts you don't need, toss parts that needs to change. Put the project in a loop, it needs to go back to the thinking bench again, rethink, change it, toss parts, rebuild it, until it becomes perfected. Sometimes you need to toss the whole code. People wants an assembler that has been as many times as possible inside the oven. The assembler needs to be baked in the oven, often, many times, the more often the better. Forget the christmas tree design where everything is in layers hanging loosely on the tree. If you learn from this then the assembler will succeed, if you continue with the christmas tree design, it will die. Assembly must not be overcomplicated more than it already is, we have C# for that complexity, asm should not go there. Asm is an art, it's not a "save humanity" project. fasm needs more non-macro keywords. You need to bake the assembler in the oven and create something unchanging. Macros change, we need more keywords that are not macros, but built into the assembler, like the keywords you find in nasm. DO THAT, and you will succeed! How do you do that you may ask, you look for common functionality that all coders need and use on a daily basis, and then you take that away from macros and build it into the assembler. Repeat until all basic needs are hardened inside the assembler. When the coder has to use macros to function at all, then they will hate the macros. When you build the basic needs into the assembler itself and people don't really need the macros, it's exactly at that point the macros will be loved and become useful. Success in the horizon, I believe in you. |
|||
02 Nov 2021, 16:36 |
|
macomics 02 Nov 2021, 18:04
nasm wrote: The oven is the baker's best tool. It makes the pastry firm and unchanging. What is unchangeable becomes sacred over time. What is sacred becomes loved. What is loved becomes a super effective tool. nasm wrote: The first line should be a 10 word description of your idea that describes your idea, the second line and after that is the full description. topic wrote: CALM extension of fasmg nasm wrote: A good assembler respects the time frame that the programmer has at his disposal. He does not have time to play around with a decade long experiment. nasm wrote: A good assembler must not build on layers, it should be rewritten, toss parts you don't need, toss parts that needs to change. |
|||
02 Nov 2021, 18:04 |
|
Goto page Previous 1, 2 < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.