flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Macro redefine Val ?

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 1701
Roman 10 Dec 2023, 12:28
Fasmw 1.73
I want do this:
Code:
macro af val,mem {
if val eqtype []
mov eax,val
val equ eax
end if
mov [mem],val
}
hero1Life dd 0
vv  dd 11.0
;in code
af 20.0,hero1Life ;as mov [hero1Life],20.0

af [vv],hero1Life ;as mov eax,[vv] and mov [hero1Life],eax


    
Post 10 Dec 2023, 12:28
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1701
Roman 10 Dec 2023, 12:42
I try this:
Code:
macro af val,mem {
define val2 val
if val eqtype  [0]
mov eax,val
define val2 eax
end if
mov [mem],val2
} 
;in code
hero dd 0
af 20.0,hero  ;i get: mov [hero],eax but must be mov [hero],20.0
af [hero],hero ;this ok. mov eax,[hero] mov [hero],eax
    
Post 10 Dec 2023, 12:42
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1701
Roman 10 Dec 2023, 13:02
This work fine
Code:
macro af val,mem {
if val eqtype  [0]
mov eax,val
mov [mem]  ,eax
end if

if val eqtype 0.0
mov [mem],val
end if
} 
    
Post 10 Dec 2023, 13:02
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.