flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > why ?

Author
Thread Post new topic Reply to topic
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji

Why ??? I become crazy ! Sad
Code:
A)
---
symbol_ equ ab
match c, '"'#`symbol_#'"' { toto equ c }

DISPLAY toto : match c, toto { irps s, c \{ display \`s \} } 
RESULT : <"ab">

mov eax,toto  ;toto == 22626122h ;<---- it's correct ! (with debugger)

B)
---
symbol_ equ a*
match c, '"'#`symbol_#'"' { toto equ c }

DISPLAY toto : match c, toto { irps s, c \{ display \`s \} } 
RESULT : <"a*">

BUT,

mov eax,toto  ;toto == 000CE684h ;and not 222A6122h !?!?! <<---------- WHY ?


    


_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 08 Mar 2010, 09:29
View user's profile Send private message Send e-mail Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7725
Location: Kraków, Poland
Tomasz Grysztar
"ab" is a single token, "a*" are two separate tokens. The ` symbol works on a single token. Thus in first case you get '"'#'ab'#'"' => '"ab"', and in second case you get '"'#'a'*#'"' => '"a'*'"' (because # cannot concatenate name token with a quoted token), which is a multiplication of two quoted values.

Read more about tokenization here: http://flatassembler.net/docs.php?article=ufasm (in section "Tokenization of source and line makers").
Post 08 Mar 2010, 10:21
View user's profile Send private message Visit poster's website Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji

thank you for your reply. I begin to understand !

but,

why "ab" is a single token, and "a*" are two separate tokens ?
Why this difference of interpretation between <ab> and <a*> ?

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 08 Mar 2010, 10:59
View user's profile Send private message Send e-mail Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7725
Location: Kraków, Poland
Tomasz Grysztar
ouadji wrote:
why "ab" is a single token, and "a*" are two separate tokens ?
Why this difference of interpretation between <ab> and <a*> ?
Because fasm's syntax highlighter shows "*" in blue. Wink

"Jokes" aside, please read the section 1.2.1 of fasm's manual; second paragraph, to be precise.
Post 08 Mar 2010, 11:04
View user's profile Send private message Visit poster's website Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji

Quote:

Because fasm's syntax highlighter shows "*" in blue. Very Happy Rolling Eyes Wink
ok, I read, I understood. thank you boss.

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 08 Mar 2010, 11:23
View user's profile Send private message Send e-mail 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-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.