flat assembler
Message board for the users of flat assembler.

Index > Main > "CALM" Instructions - "Assembly-Like"?

Author
Thread Post new topic Reply to topic
Greg_M



Joined: 07 Jun 2025
Posts: 42
Greg_M 07 Jun 2025, 23:04
What does the term "Assembly-Like" refer to in "CALM"?

Does it refer to fasmg language as "assembly-like"?
Post 07 Jun 2025, 23:04
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4249
Location: vpcmpistri
bitRAKE 08 Jun 2025, 02:44
"Assembly-Like" in terms of the low-level granularity.
the manual wrote:
The calminstruction directive allows to define new instructions in form of compiled sequences of specialized commands. As opposed to regular macroinstructions, which operate on a straightforward principle of textual substitution, CALM (Compiled Assembly-Like Macro) instructions are able to perform many operations without passing any text through the standard preprocessing and assembly cycle. This allows for a finer control, better error handling and faster execution.

All references to symbols in the text defining a CALM instruction are fixed at the time of definition. As a consequence, any symbols local to the CALM instruction are shared among all its executed instances (for example consecutive instances may see the values of local symbols left by the previous ones). To aid in reusing these references, commands in CALM are generally operating on variables, routinely rewriting the symbols with new values.
CALM is a subset of the fasmg language. CALM is "Assembly-Like", but fasmg language is not, imho. An assembly language can be created with the fasmg language.

_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 08 Jun 2025, 02:44
View user's profile Send private message Visit poster's website Reply with quote
Greg_M



Joined: 07 Jun 2025
Posts: 42
Greg_M 08 Jun 2025, 03:42
OK, thanks much. I'm studying.
Post 08 Jun 2025, 03:42
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4249
Location: vpcmpistri
bitRAKE 08 Jun 2025, 05:17
I'm more of a hands on type of learner - I like to solve problems with the language to increase my understanding. Much of that discovery has made it on to this board since the very introduction of fasmg. It's my hope that those examples will spur some insight or inspiration in the learning of others. (Regardless of the ill-conceived notions or errors made along the way.)
Post 08 Jun 2025, 05:17
View user's profile Send private message Visit poster's website Reply with quote
Greg_M



Joined: 07 Jun 2025
Posts: 42
Greg_M 08 Jun 2025, 07:48
bitRAKE wrote:
I'm more of a hands on type of learner - I like to solve problems with the language to increase my understanding.

I understand and agree 100%. I had already installed fasm2/fasmg per the recommendation and was looking at calminstruction and then referred back to the document at that point. E.g. Just as I was referring to document to help understand calminstruction, from the syntax documentation, e.g. name, number, labels, namespaces, I could see that using them in code would clarify.

Programming languages are often influenced by other languages. Perhaps calminstruction has some commonality to F# "inline".
Post 08 Jun 2025, 07:48
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4249
Location: vpcmpistri
bitRAKE 08 Jun 2025, 08:46
Oddly enough, I was thinking about this a few days ago - wondering if fasm was influenced by Tcl - just a passing thought, really. There is just so much novelty in fasm[g]. How terse the match directive is - often seems magical. Sure, lots of languages have string matching, but it's often more work. The abstractions are well suited to assembly language construction and use. Complex/strict syntax can be created/enforced - allowing high-level language construction. Can always digress to processing the syntax bytes (a la virtual).
Post 08 Jun 2025, 08:46
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8434
Location: Kraków, Poland
Tomasz Grysztar 08 Jun 2025, 10:22
The main reason for calling them "assembly-like" was the way the control flow is structured in the CALM sub-language. While the classic language of fasmg's macros is structured with nestable control blocks like IF / END IF or REPEAT / END REPEAT, CALM is different. There are only jumps and conditional jumps, and implementing any algorithm this way is going to have a flow that is assembly-like. Also commands like COMPUTE or ARRANGE have syntax intentionally designed to resemble x86 instructions, with destination being the first argument.
Post 08 Jun 2025, 10:22
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8434
Location: Kraków, Poland
Tomasz Grysztar 08 Jun 2025, 12:47
bitRAKE wrote:
Oddly enough, I was thinking about this a few days ago - wondering if fasm was influenced by Tcl - just a passing thought, really.
It seems like a convergent evolution. I have not been directly influenced, but I see what could make one think that way. There are similarities that evolved quite naturally, needing to solve similar issues.
Post 08 Jun 2025, 12:47
View user's profile Send private message Visit poster's website Reply with quote
Greg_M



Joined: 07 Jun 2025
Posts: 42
Greg_M 08 Jun 2025, 15:30
Tomasz Grysztar wrote:
..."assembly-like" ... control flow ...

Thank you.

Tomasz Grysztar wrote:
... classic language of fasmg's macros...

Are classic macros considered deprecated?
Post 08 Jun 2025, 15:30
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8434
Location: Kraków, Poland
Tomasz Grysztar 08 Jun 2025, 16:03
Greg_M wrote:
Are classic macros considered deprecated?
No, and I addressed this exact question when I first announced the CALM extension.
Post 08 Jun 2025, 16:03
View user's profile Send private message Visit poster's website Reply with quote
Greg_M



Joined: 07 Jun 2025
Posts: 42
Greg_M 08 Jun 2025, 16:22
Thank you.
Post 08 Jun 2025, 16:22
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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.