flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Fasm 1.73 I propose status flag for value.

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 1766
Roman 11 Dec 2019, 03:47
Macro Mm chVal {

If %status chVal = 0
Jmp @f
ChVal dd 22
@@:
End if

If %status chVal = 1
Inc [chVal]
End if

If %status chVal = 2
Mov [chVal], 5
End if
}

In code:
Mm zval
Mm zval ;this do Inc [Zval]
Mm zval ;this do Mov [Zval], 5
%status Zval get last command ;do Mov [Zval], 5

If we want set status Zval write %status Zval =1
Post 11 Dec 2019, 03:47
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20299
Location: In your JS exploiting you and your system
revolution 11 Dec 2019, 04:24
You can make a variable named chVal.status to hold any value you want.
Post 11 Dec 2019, 04:24
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1766
Roman 11 Dec 2019, 06:01
You mean EQU?
Post 11 Dec 2019, 06:01
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20299
Location: In your JS exploiting you and your system
revolution 11 Dec 2019, 06:09
Code:
chVal.status = 1

;...

if chVal.status = 0
  display "We should not be here"
else if chVal.status = 1
  display "Everything is okay"
else
  display "Something is very wrong with this world"
end if    
It is just an ordinary variable. You can name it anything you want, and you can give it any value you want.
Post 11 Dec 2019, 06:09
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1766
Roman 11 Dec 2019, 09:05
It's not handful!
Always write this big code in some places of code?
Macro more be nice!
Post 11 Dec 2019, 09:05
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20299
Location: In your JS exploiting you and your system
revolution 11 Dec 2019, 11:24
Just place the code within your macro.
Post 11 Dec 2019, 11:24
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1766
Roman 11 Dec 2019, 17:59
This code not see diferents EQUs.

Mm zval
Zval. Status EQU 1
Mm zval ;see as EQU = 2 but not EQU = 1! That is problem

I need change dynamicly work mm macro!
Post 11 Dec 2019, 17:59
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20299
Location: In your JS exploiting you and your system
revolution 11 Dec 2019, 18:35
In that case you are mixing EQU with IF, so there is a problem with the different assembly stages seeing different values. Change your EQUs to = and now see if it works for you.
Post 11 Dec 2019, 18:35
View user's profile Send private message Visit poster's website 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.