flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > variable virtual base (fasm)

Author
Thread Post new topic Reply to topic
ProMiNick



Joined: 24 Mar 2012
Posts: 597
Location: Russian Federation, Sochi
ProMiNick
Is it possible to make variable virtual base

for example
Code:
virtual at esp+espFix ; like define analog vs equ
        ofn OPENFILENAME
end virtual

...
espFix=0
...

espFix=espFix+4
mov     [ofn.hInstance],eax
    

it is not problem to add adder manualy.
Even more that could be achieved via macro
but may be there a way to got variable base to virtual in "out-of-the-box" way?
Code:
macro varvirtual definition& {
        match =at addr, definition \{
                macro @virtual@ name,def,val& \\{
                        local ..var
                        ..var def val
                        define name ..var+addr \\}

                macro endv \\{
                        purge label,@virtual@,endv
                        restruc db,du,dw,dp,dd,dt,dq
                        restruc rb,rw,rp,rd,rt,rq
                        end virtual \\}

                macro label def \\{ match . type,def> \\\{ @virtual@ .,label,<type \\\} \\}
                struc db [val] \\{ \common @virtual@ .,db,val \\}
                struc du [val] \\{ \common @virtual@ .,du,val \\}
                struc dw [val] \\{ \common @virtual@ .,dw,val \\}
                struc dp [val] \\{ \common @virtual@ .,dp,val \\}
                struc dd [val] \\{ \common @virtual@ .,dd,val \\}
                struc dt [val] \\{ \common @virtual@ .,dt,val \\}
                struc dq [val] \\{ \common @virtual@ .,dq,val \\}
                struc rb cnt \\{ @virtual@ .,rb cnt, \\}
                struc rw cnt \\{ @virtual@ .,rw cnt, \\}
                struc rp cnt \\{ @virtual@ .,rp cnt, \\}
                struc rd cnt \\{ @virtual@ .,rd cnt, \\}
                struc rt cnt \\{ @virtual@ .,rt cnt, \\}
                struc rq cnt \\{ @virtual@ .,rq cnt, \\}

                virtual at 0 \} }    

test:
Code:
varvirtual at var
        A dd ?
endv


var = 0
db A dup 0 ; produce 0 bytes
var = var+3
db A dup 0 ; produce 3 bytes    

_________________
I don`t like to refer by "you" to one person.
My soul requires acronim "thou" instead.
Post 28 Oct 2019, 10:09
View user's profile Send private message Send e-mail Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7802
Location: Kraków, Poland
Tomasz Grysztar
The linear polynomial handler in fasm 1 is very limited compared to the one in fasmg (even though the latter was heavily inspired by the former), so I don't think there is a nice and simple solution. But perhaps adding some artificial pseudo-register for addressing into symbol tables could help.
Post 28 Oct 2019, 10:58
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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.