flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > about if eq

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 1952
Roman 07 Jun 2025, 05:54
fasmw 1.73
Code:
macro up n,e='0' { if e eq '0'
n
end if
 if e ~ eq '0'
n,e
end if  }

;in code
up add eax,ebx ;empty. thi is problem
up inc eax ;get asm command inc eax
    
Post 07 Jun 2025, 05:54
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20657
Location: In your JS exploiting you and your system
revolution 07 Jun 2025, 06:02
Code:
if 1 ~ eq 2
 display 'Use 1 ~ eq 2'
end if
if ~ 1 eq 2
 display 'Use ~ 1 eq 2'
end if    
Code:
flat assembler  version 1.73.31  (16384 kilobytes memory)
Use ~ 1 eq 2
1 passes, 0 bytes.    
Post 07 Jun 2025, 06:02
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1952
Roman 07 Jun 2025, 07:32
Quote:
if ~ e eq '0'

Weird.
But thanks.

How I understood symbol ~ mean not.
On logic must be
Quote:
if e ~ eq '0'
e not equivalent '0'
Post 07 Jun 2025, 07:32
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20657
Location: In your JS exploiting you and your system
revolution 07 Jun 2025, 07:42
eq compares tokens.

"1 ~ eq 2" means: "1" "~" == "2". Two tokens "1" and "~" compares to one token "2"

"~ 1 eq 2" means: not "1" == "2". Not one token "1" compares to one token "2"
Post 07 Jun 2025, 07:42
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1952
Roman 07 Jun 2025, 09:03
Quote:
"1 ~ eq 2" means: "1" "~" == "2". Two tokens "1" and "~" compares to one token "2"

not work.
Code:
ee1 = 'do '
         ee2 = 'some'
         if ee1 ee2 eq 'do some'
         display 'yes!' ;I not get yes!
         end if

define ee1 'do '
         define ee2 'some'
         if ee1 ee2 eq 'do some' ;I not get yes!
         display 'yes!'
         end if

 if ee1  eq 'do ' ;I  get yes!
         display 'yes!'
         end if

if ee1  eq 'do ' & ee2 eq 'some'
         display 'yes!' ;I get yes!
         end if 

if ee1 ~ eq 'do ~'
         display 'yes!' ;I not get yes!
         end if  
if ee1 ~ eq '~'
         display 'yes!' ;I not get yes!
         end if  
     


Last edited by Roman on 07 Jun 2025, 10:21; edited 1 time in total
Post 07 Jun 2025, 09:03
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20657
Location: In your JS exploiting you and your system
revolution 07 Jun 2025, 09:43
Appears to be working fine.

What makes you think it isn't working?

Note that it doesn't compare strings, it compares tokens.
Post 07 Jun 2025, 09:43
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1952
Roman 07 Jun 2025, 10:23
Its work.
Code:
define ee1 'do '
define ee2 'some'

if ee1 ee2 eq 'do ' 'some'
         display 'yes!' ;I get yes!
         end if   

tokens equ 'do ' 'some'
if ee1 ee2 eq tokens
         display 'yes!' ;I get yes!
         end if   
    
Post 07 Jun 2025, 10:23
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.