flat assembler
Message board for the users of flat assembler.
![]() Goto page Previous 1, 2 |
Author |
|
Tomasz Grysztar
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. |
|||
![]() |
|
MaoKo
Hello. After some time, I've just encounter a problem in my project.
It's just a little question ![]() 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. |
|||
![]() |
|
Tomasz Grysztar
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!' |
|||
![]() |
|
MaoKo
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. |
|||
![]() |
|
Tomasz Grysztar
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. |
|||
![]() |
|
MaoKo
Yes, why not. This might be more "user-friendly", I guess
![]() |
|||
![]() |
|
Tomasz Grysztar
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.
![]() |
|||
![]() |
|
Goto page Previous 1, 2 < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.