flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > [fasmg, CALM] case insensitive instruction with dot in name

Author
Thread Post new topic Reply to topic
zhak



Joined: 12 Apr 2005
Posts: 501
Location: Belarus
zhak 29 Apr 2021, 12:31
How to correctly define a case insensitive instruction which contains a dot in the middle, like A64 "B.<cond> <label>"?
Code:
calminstruction B?.EQ? operands*&
    

gives "Error: illegal instruction" when assembled
Post 29 Apr 2021, 12:31
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 29 Apr 2021, 12:46
Dot is the namespace separator, so it is not a definition of instruction called "B.EQ", but a definition of instruction called "EQ" in the "B" namespace. For "B" namespace to be case-insensitive, it needs such symbol to be defined to anchor it:
Code:
define B? ; prepare namespace

calminstruction B.EQ? operands&
end calminstruction    
Note that you also need to avoid having a case-sensitive symbol with the same name, as it would then take precedence:
Code:
B? = 1
B = 2

macro b.EQ?  ; same as: macro B?.EQ?
        display 'I'
end macro

macro B.EQ?  ; this selects the second namespace, because case-sensitive takes precedence
        display 'S'
end macro

B.EQ    ; S
b.eq    ; I
B?.EQ   ; I    
I do not recommend ever having both case-insensitive and case-sensitive variants of the same symbol, but it is worth keeping in mind how it behaves then.
Post 29 Apr 2021, 12:46
View user's profile Send private message Visit poster's website Reply with quote
zhak



Joined: 12 Apr 2005
Posts: 501
Location: Belarus
zhak 29 Apr 2021, 13:34
Ah, I see. I tried wrapping all in "namespace", obviously without success. Thanks a lot!
Post 29 Apr 2021, 13:34
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.