Does anyone know where I can find any tutorials on Object Oriented Assembly programming? I found http://www.madwizard.org/ and I've downloaded Objects.INC. There are two sample projects but they are relatively undocumented. I'm hoping that Iczelion will have some Object Oriented Assembly tutorials up on his site soon. I'm a Win32/MFC programmer and I used to just optimze my code with assembly, but now if using Classes seems practical, I'm going to write whole programs and convert old ones to DLLs. Win32 Assembly seems like the best thing to happen to programming.
Posted on 2002-08-01 13:17:17 by Sibilant
The two authors of the MASM Object model (NaN and Thomas) are regulars and part of the administration team of this message board...
Ask your questions and they will answer for sure...
Posted on 2002-08-01 13:21:07 by JCP
If I created a class

class CMyClass
{
private:
int nMyInt;
int MyFunction( int MyFunctionVariable );

public:
int nMyInt2;
int MyFunction2( int MyFunctionVariable2 );
}

What would be the syntax for creating MyClass.inc?
Posted on 2002-08-01 19:09:59 by Sibilant
This is raw assembly, you can make the syntax any way you choose (if you put time into defining Object Orientated constructs for assembly) ;)

Thomas and myself have done this much a while ago, and so the syntax is our own creations, but its not to say its the "definitive way" for assembly. Check our web-pages for info on the OOP models if your interested in using our version.

Your message was a bit open ended, so i replied with such ;) . Just be aware that assembly itself is "before" OOP ideals and even "FOR loops" for that matter. Assembly is raw dough for you to forge in any way you see fit ;) . So to say there is "A" syntax for OOP is becoming more HLL and less assembly... if you know what im getting at.

On a different page, its requires alot of planning to get a good OOP model to work in assembly (with MASM). It requires even more work to make it re-usable and generically includeable (as your seeking). Our model does this as is, and supports *most* OOP idea's. It is open source and free for non-commertial uses. Take a look at it and study it if you like... it might inspire some ideas... or scare you back to C++ ( :) )

Best of luck..
NaN
Posted on 2002-08-01 22:36:16 by NaN
Didnt realize this was double posted.... would have written differently...

Anyways, as it stands, i would be glad to give help and advice to your questions with the model we worked on. But im currently adjusting to new "full time" work (and work hours), and will not have free time to get documents made for what is currently released. There is a modest number of examples tho, with some good documentation showing the basic ideas. If you need help understanding something, or just "why", please post something more specific and i will do my best.

Also be aware that the model is NOT C++ or MFC or anything else out there. Its two guys coming up with a "solution" with out cheating (ie, looking at how "they" did it). For this reason, there is some things still not worked out, like STATIC variables in classes, and INTERFACES are some what tame compared to HLL versions (its more like a by product of inheritance in our solution).

Anyways, hope this helps.. and i do agree with you Win32 Assembly is the best kind of programming ;)

:alright:
NaN
Posted on 2002-08-01 22:46:06 by NaN
I am familiar with assembly and it origens, but I guess I'm stuck in a win32 C++ 'syntax regidity' frame of mind. I've done some inline assembly for C++ optimizations, but I'm pretty new to win32 assembly. I know its very open ended, I'm just trying to pick up on some good habits early, for reading clarity, and most importantly, compilation without errors. I've downloaded alot of assembly programs in the past week and I've noticed that some are very hard to read. The same is true in C but even then, it seems as as if there are more standards in code writting (of course I'm much more familiar with C, so maybe its a moot point). Do you have any 'general' syntactical suggestions on writting OOA? I've been doing OOP for quite a while now and I'm very comfortable with this paridigm. Do you have any suggestions or recomendations on how to make an .inc file usable and generically includeable. Also what OOP doesn't your object model support?

Thanks for your knowledge and time.

Sibilant

P.S After posting this I downloaded OOP.zip so I'll probably have many more questions( and hopefully I'll be a little more informed ).
Posted on 2002-08-01 23:13:29 by Sibilant
Posted on 2002-08-02 01:40:57 by bazik
Sibilant,
to make things easier, remember the basics of OO.....

If i have two instances of a class, and they both have a function and a couple of member variables, that function only exists *once* in memory, but there is a separate copy of the data for each class. So, if you want to use classes in asm, you will be using a lot of structs, and passing their data to the "class" functions.

Of course, inheritance and overloading are another matter :)
Posted on 2002-08-02 07:59:16 by sluggy
For a while I also played with NaN/Thomas' model, but unfortunately found my capabilities short. Since (like Sibilant I use C++) my mindset had 'conformed' to OOP, I figured I'd be more familiar with C so I tried to learn Objective-C first, which I found was a totally different beast so I gave up. IMO, the closest and 'safest' way one can get to OOP in asm is at the binary level (i.e, with Ernie's CoLib). At present, I don't have enough experience with it to make further comments.

(I've just finished a medium-sized project using WTL for the UI, and COM with M$'s ATL for a custom data-access driver for Interbase. Plus a couple of COM in "raw" C++ personal projects. Makes me hope I finally have something to go through Ernie's lib :)

COM may not be "real" OOP for some C++ purists but IMO, it's got enough OOP in it to keep anyone busy.
Posted on 2002-08-02 20:03:22 by pixelwise
Hi,NaN:
I want to subclass a button in a class,but you know,when i make a callback func in the class,how can I be sure that windows will call it?A ugly way is such like this:

CBtn_Init proc uses edi esi lpTHIS:DWORD, hInst:DWORD, hWnd:DWORD,IconID:DWORD,BtnID:DWORD
...

invoke SetWindowLong,.m_hWnd,GWL_USERDATA,edi
invoke SetWindowLong,.m_hWnd,GWL_WNDPROC,.IconBtnProc
mov .m_lpCtrlProc,eax

...

CBtn_Init endp

CBBu_IconBtnProc_Funct proc uses edi hWnd:dword,uMsg:dword,wParam:dword,lParam:dword
local @rect:RECT

invoke GetWindowLong,hWnd,GWL_USERDATA
mov edi,eax
assume edi:ptr CFButton
...

CBBu_IconBtnProc_Funct endp

I now really very hate:( this way,because it make the class very ugly and not like a Object Oriented class.Hope you have some clever way!

:stupid:
Posted on 2002-08-03 09:51:37 by smallwaves
Hi,NaN:

your Object Creator only could create a class but could not edit or modify it ,so could you add this function?

Best wishes to you Realse OOA:)
Posted on 2002-08-03 10:02:54 by smallwaves