flat assembler
Message board for the users of flat assembler.

Index > Projects and Ideas > FASM OO library.

Goto page Previous  1, 2
Author
Thread Post new topic Reply to topic
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 27 Jan 2007, 21:34
KRA: actually, you seem to use "actually" as often as me.

Quote:
Actually it should be built in the same way your FASMLIB is. It actually uses it for memory, string and streaming.

wow, somebody actually uses FASMLIB? I didn't hope. Very Happy

Quote:
Must way I love your FASMLIB since it makes me able to test my code on both windows and linux.

wow, somebody actually uses FASMLIB for portable coding? I didn't hope either. Very Happy

Quote:
Have you considered porting FASMLIB to ARM4 as well

i was seriosly considering making similar library for ARM, but 32bit and 64bit versions comes first. Also, i must do more ARM coding before deciding on standards, i am not enough experienced yet.

btw, if you enforce macro usage with your library (which is pretty good idea for "making your own OO lanugage based on FASM"), then you could think about read structured exception handling. IMHO it would be little bit better than CF for OO library.

But, in my opinion making OO assembly extension is not useful at all... but don't let me discourage you. Many people say assembly library like FASMLIB isn't useful aswell. Wink
Post 27 Jan 2007, 21:34
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
afw2004



Joined: 16 Jun 2005
Posts: 49
Location: Kharkov, Ukraine
afw2004 29 Jan 2007, 09:20
I performed some updates to my lib. It now packed into dll, inheritance from classes implemented in the dll works.

Source code is in oolib.zip attached.

Exeexample folder contains example of static linking.

Dllexample folder contains similar example but linked with fcomclib.dll (my oo library).

dllbuild folder - source code for building oo library.


Description:
Download
Filename: oolib.zip
Filesize: 58.83 KB
Downloaded: 833 Time(s)

Post 29 Jan 2007, 09:20
View user's profile Send private message ICQ Number Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 29 Jan 2007, 10:36
afw2004: no error checking there? Wink
Post 29 Jan 2007, 10:36
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
jbojarczuk



Joined: 21 Jun 2006
Posts: 27
jbojarczuk 04 Feb 2007, 01:05
Hi tantrikwizard,

It is possible to do what you want with the preprocessor. I actually have been able to do it (I am doing a second library right now, because I want to do improvements on the first one, such as separating OS specific code from general code, so as to be able to port the whole thing to linux later on).

The first library, besides being VERY OS oriented (WIN32), it was kind of product oriented (Lotus Notes, using the C API), and so it will not be useful for you guys (unless we have a Lotus Notes C api developer in here, also?).

An example syntax (for an .inc file):
Code:
Class JRBBase
        ClassStartData
                .m_pvMain       dv ?
                .m_cRefs        dv ?
        ClassEndData
        ClassStartProc QueryInterface
                Proc Constructor
                Proc Destructor
                Proc QueryInterface
                Proc AddRef
                Proc Release
        ClassEndProc
ClassEnd
    

An example syntax (for an asm file):
Code:
ClassStartCode JRBBase
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
PROCOBJ Constructor
        PARAMLIST
                a_pvThis dv ?
                a_pvMain dv ?
        PARAMLISTEND
        mov R4 , a_pvMain
        mov [R3 + JRBBase.m_cRefs] , vword 1
        sub R4 , R3
        mov [R3 + JRBBase.m_pvMain], R4
PROCOBJEND
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
PROCOBJ Destructor
        PARAMLIST
                a_pvThis dv ?
        PARAMLISTEND
PROCOBJEND
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
PROCOBJ QueryInterface
        PARAMLIST
                a_pvThis                dv ?
                a_ridIID        dv ?
                a_pvObjRet      dv ?
        PARAMLISTEND
        mov R4 , [R3 + JRBBase.m_pvMain]
        mov R1 , a_ridIID
        test R4 , R4
        jz .NoMain
                add R3 , R4
                mov R4 , a_pvObjRet
                JRBBase_QueryInterface R3 , R1 , R4
                jmp .ret
.NoMain: //Se este for o objeto principal
        mov R4 , a_pvObjRet
        xor R3 , R3
        LocateGUID R1 , IID_IUnknown , .FoundThis , IIDBase , .FoundThis
                mov [R4] , R3
                mov R1 , E_NOINTERFACE
                jmp .ret
.FoundThis:
        mov R4 , a_pvObjRet
        inc vword [R3 + JRBBase.m_cRefs]
        mov R1 , 0              
        mov [R4] , R3
        
PROCOBJEND
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
PROCOBJ AddRef
        PARAMLIST
                this dv ?
        PARAMLISTEND
        mov R1 , [R3 + JRBBase.m_cRefs]
        inc R1
        mov [R3 + JRBBase.m_cRefs] , R1
PROCOBJEND
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
PROCOBJ Release
        PARAMLIST
                this dv ?
        PARAMLISTEND
        mov R1 , [R3 + JRBBase.m_cRefs]
        dec R1
        mov [R3 + JRBBase.m_cRefs] , R1
        jnz .ret
                JRBBase_Destructor R3
                xor R1 , R1
PROCOBJEND
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ClassEndCode
    


Now, some observations that I have noticed during my first project:
1 - EXCEPTION HANDLING is good. You should definetely invest you time on it, it will pay for itself many times over. The biggest problem I had, however, was buffer overrun. I suggest you watch out for this, since Win32 exception handling will suffer from it as well.
2 - You may have automatic object creation and destruction in the stack. If I were you, I would not worry so much about heap. I have done one project, and I was able to do it in it's completion in the stack. If you do everything like a C compiler would, you will not have gains. I suggest you think about it for a little.

This being said, I don't think you really need a project for this. Just sit down and start tweaking with fasm's preprocessor, and you will get what you want.

Should you need help with anything, just ask (although most people here know *A LOT* more than I do), if I see your questions, I would try to answer them.
Post 04 Feb 2007, 01:05
View user's profile Send private message Reply with quote
tantrikwizard



Joined: 13 Dec 2006
Posts: 142
tantrikwizard 08 Feb 2007, 13:37
jbojarczuk wrote:
Hi tantrikwizard,

It is possible to do what you want with the preprocessor. I actually have been able to do it (I am doing a second library right now, because I want to do improvements on the first one, such as separating OS specific code from general code, so as to be able to port the whole thing to linux later on)


Hi, I have been re-tasked with some projects at work and haven't had much time to work on my library. The class decleration (minus the namespaces) were working somewhat and new/delete macros but that is about as far as i've gotten. The FASM preprocessor still has me a bit perplexed and I'm no guru on the subject so am learning as I go. Can you post your work to share with the rest of us?
Post 08 Feb 2007, 13:37
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2

< 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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.