flat assembler
Message board for the users of flat assembler.

Index > Main > How redefine value name ?

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 1082
Roman
I use fasm 1.73

My problem not defined name.
For example i have two variants one proc Draw3D.
Some time in my program i use first or second variant proc Draw3D.

In first variant proc Draw3D not have posA dd 0,0,0,0
Second variant proc Draw3D have posA dd 0,0,0,0

In main code i do:
mov [posA],10.0

How fix automaticly this and not rewrite hands my code ?
My idea macro check if not defined posA then posA equ Val1 else not redefine.

One or two names not hard, but check many names(i have 400 names) its problem.
If write in code for all names this:
Code:
if defined posA
mov [posA],10.0
end if
    
Post 14 Apr 2021, 14:58
View user's profile Send private message Reply with quote
ProMiNick



Joined: 24 Mar 2012
Posts: 642
Location: Russian Federation, Sochi
ProMiNick
If to be to lazy to check each:
Code:
macro ifcompilablevar statement& {
        local a
        match instr size_spec[var]=, value,statement \{
                a = $-1
                if defined var
                        statement
                end if \}
        match instr reg =,size_spec[var],statement \{
                a = $-1
                if defined var
                        statement
                end if \}
                if ~defined a
                        statement
                end if }
                       hello: ; comment hello or world and see difference
ifcompilablevar mov dword [ hello+world ] , 1
                       world:     


size specifiers could be skipped if all vars would be defined as vars not as unsized labels.
Post 14 Apr 2021, 16:06
View user's profile Send private message Send e-mail Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1082
Roman
Thanks.
Post 14 Apr 2021, 16:17
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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.