News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

I am looking for an object oriented assembler

Started by iAPX86, March 27, 2006, 02:54:06 PM

Previous topic - Next topic

iAPX86

I want to be able to declare objects, instantiate them, and call their methods.
I could do it the hard way, and build it all by hand.

I want to know if anyone has considered making this kind of facility available
as either macros, or as extensions to the MASM32 language.

Thanks in advance for your replies.

Biterider

Hi iAPX86
Take a look at the ObjAsm32 model for MASM at http://objasm32.tripod.com/. It has a several objects ready to use and a lot of examples and tutorials for the beginner and for the more advanced user.
Another useful model is ATC(2) developed by Ultrano. Search the boards to find a current link.

Regards,

Biterider


iAPX86

Thank you.  I am reviewing objasm32 as I write this.



Sevag.K

Yes.  If you want to see it in action, there are various projects that make use it.

-Randall's AGE engine in the HLA examples package on webster.
-You can find an older alpha version of Arayna on this forum which expands AGE to a GUI interface
-aoaprogramming files section has several projects: heap-sort, red-blacktrees, etc.
-I'm currently writing an edit-buffer that uses OOP (you can find the 1st slightly buggy version in my "hidelib" library.
-I'm writing a portable gui library in OOP (also on aoaprogramming files section).

If you don't have access to aoaprogramming Yahoo group, I'll upload it to this forum since it's handy (it's still in very early phase so it doesn't do much).



Randall Hyde

Quote from: iAPX86 on March 27, 2006, 02:54:06 PM
I want to be able to declare objects, instantiate them, and call their methods.
I could do it the hard way, and build it all by hand.

I want to know if anyone has considered making this kind of facility available
as either macros, or as extensions to the MASM32 language.

Thanks in advance for your replies.

You might want to check out the following chapter in "Art of Assembly" on OOP in assembly:

http://webster.cs.ucr.edu/AoA/Windows/HTML/ClassesAndObjects.html#998258

Cheers,
Randy Hyde

MickD

Being that HLA can be OO, is it possible to work with existing OO lib's and the classes they contain?
For example, I use a cad package and can use its native (C/C++) api to customise the main application by writing dll's to plug in at run time but was wondering if I could do the same using HLA for an exercise in building dll's/plug-ins for this and other app's.
If so, would the method be similar for all OO languages?

Thanks,
Mick.

BogdanOntanu

And BTW ...

TASM 5.0 had such OOP implementation included inside the assembler core (not macros) back in 1996 ...
...that is about 10 years ago...

I guess just to show off the power and advancement of ASM compilers compared to their HLL counterparts...

However I rarely find any kind of use for OOP programming ... other than mind show-off and aberation
Whenever I need OOP concepts I do it by hand ... of course that is just me ...

Ambition is a lame excuse for the ones not brave enough to be lazy.
http://www.oby.ro

MickD

Quote from: BogdanOntanu on August 30, 2006, 09:05:52 PM

However I rarely find any kind of use for OOP programming ... other than mind show-off and aberation
Whenever I need OOP concepts I do it by hand ... of course that is just me ...

I'm not too concerned with using OOP although it does have its benefits, another reason I ask is because there is more and more lib's written using 'classes'.
For instance, if you want to use HLA in Linux to create a gui using wxWidgets (or any others) you will have to be able to derive a class from their base classes to simply create a window. The main problem I can see is that classes have vtables, structs are simply a set of data types, perhaps classes are the same but contain a pointer to the function in the vtable?? If that's the case it may not be so bad.

Sevag.K

I thought about the same thing with wxWidgets, but couldn't figure out anything concerning C++ headers.  Technically, it should'nt be too hard for anyone who knows C++ and HLA pretty well.  I only meet half the requirement.  The concept should be to first convert the C++ headers to something that can be used in C then from there, conversion to HLA format will be a snap.

I personally gave up on the concept and decided to design my own portable GUI.  The first attempt you can find here under the heading "guilib" (it's in HLA OOP).  Currently all you can do is open a window, monitor mouse movements, clicks and print some colored text.  The project is on hold as my Linux system is down, but you can take a look at what's there to get a feel of the marriage between X and MS.






MickD

Thanks for the link Sevag.K, I'll take a look.

I had contemplated doing something similar myself, just get a simple window up in each OS and create a nice gui using OpenGL. Lot of work though!

Randall Hyde

Quote from: MickD on August 30, 2006, 10:25:18 PM
Quote from: BogdanOntanu on August 30, 2006, 09:05:52 PM

However I rarely find any kind of use for OOP programming ... other than mind show-off and aberation
Whenever I need OOP concepts I do it by hand ... of course that is just me ...

I'm not too concerned with using OOP although it does have its benefits, another reason I ask is because there is more and more lib's written using 'classes'.
For instance, if you want to use HLA in Linux to create a gui using wxWidgets (or any others) you will have to be able to derive a class from their base classes to simply create a window. The main problem I can see is that classes have vtables, structs are simply a set of data types, perhaps classes are the same but contain a pointer to the function in the vtable?? If that's the case it may not be so bad.

That is generally the case. In most C++ implementations I've seen, the first four bytes of the class object contain a pointer to the vtable.

One big difference between HLA's OO implementation and most C++ implementations is that HLA passes the object pointer in ESI and a pointer to the vtable in EDI to methods of the class. In C++, the object pointer is typically passed as the first (last pushed) parameter on the stack and you don't get the address of the vtable (directly) passed to the method.

Other than it's a pain to call class methods, there is no reason you *can't* call C++ classes from assembly. However, you *will* have to manually supply the offset into the vtable for any routines you want to call.
Cheers,
Randy Hyde

MickD

Thanks Randall, a bit more study on my part is required before I attempt to attack it, more interested in that t 'can' be done.
While HLA's intention is a hll that is used for teaching asm, it's not a bad language full stop and I think you could quite easily use it for everyday development in a hll way given OO and a few extra procedures/macro's etc., working with existing lib's is just the icing on the cake :)

Cheers,
Mick.