flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Help me understand locals please

Author
Thread Post new topic Reply to topic
KronosRJ



Joined: 03 Jul 2005
Posts: 15
KronosRJ
Hi,

I have finally understood and realized how the locals ... endl macros work for primitive (db , dw & dd) types...

I have been able to re-create these forms inside my macros - I am trying to create an OO library (inheritance, polymorphism and COM), with err treatment (for Win32) - but I still have the problem of working with structures...

I tried using the macro label . definition, but everytime I use an structure it places a global label (without the '.' ) .

Code:
                        \macro locals
                        \\{
                                match t_strStack , STACKFRAMETYPE
                                \\\{
                                        StartLocalData a_strClass , a_strProc , t_strStack
                                        macro label . \\\\{ deflocal a_strClass , a_strProc, t_strStack ,  . , : , \\\\}
                                        struc dd [val] \\\\{ \\\\common deflocal a_strClass , a_strProc , t_strStack , . , dd , val \\\\}                               
                                        struc dw [val] \\\\{ \\\\common deflocal a_strClass , a_strProc , t_strStack , . , dw , val \\\\}                               
                                        struc db [val] \\\\{ \\\\common deflocal a_strClass , a_strProc , t_strStack , . , db , val \\\\}                               
                                \\\}
                        \\}
                        \macro endl
                        \\{
                                purge label
                                restruc dd
                                restruc dw
                                restruc db
                                match t_strStack , STACKFRAMETYPE \\\{ EndLocalData a_strClass , a_strProc , t_strStack \\\}
                        \\}
    

Code:
macro deflocal a_strClass , a_strProc , a_strStack , a_strAddress , a_strSize , [a_astrData]
{

common
        match x , LocalDataList \{ LocalDataList equ LocalDataList, \}
        LocalDataList equ LocalDataList a_strAddress
        
        local ..var
        ..var a_strSize a_astrData

        match =EBP x , a_strStack ..var \{ a_strAddress equ [ebp - LOCALSIZE + x] \}

        match =ESP x , a_strStack ..var \{ a_strAddress equ [esp + x] \}
}
    


The main thing is that I am trying not only to put it working, but I am also trying to understand all the mechanics involved. That is why I am re-writing the macros.

I appreciate any help.

If there is someone interested in those libraries after I finish them, I might publish it here. In order to do that, I would like to know how interesting people think this would be.
Post 11 Nov 2005, 16:03
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 YouTube, Twitter.

Website powered by rwasa.