I have seen many implemention using macro to support the syntax of OOP, but they all are too tricky, and not easy to use. Fully support of OOP may call for a new assembler, not even more tricky macros.
So, I think it may be in appendix or in the tail of book. OOP is really a complex thing, and most of us won't use OOP when using masm.
Posted on 2003-12-04 02:12:08 by taowen2002

Fully support of OOP may call for a new assembler, not even more tricky macros.


It's interesting you shoud say that because HLA has built in support for OOP and AOA has a chapter on it. :)
Posted on 2003-12-04 02:16:56 by Odyssey
But AoA is good enough...
Posted on 2003-12-04 02:18:44 by taowen2002

But AoA is good enough...


Yes I think its good but I am not sure what you mean. Did you mean to ask if AOA is good enough? If so good enough for what? OOP?
Posted on 2003-12-04 02:25:33 by Odyssey
I mean AoA is a book good enough, why another?
OOP in masm is not very useful.
Posted on 2003-12-04 02:58:03 by taowen2002
If you look at what HLA is doing with classes and objects, you'll discover that it's not *that* hard to simulate this stuff with MASM. Granted, HLA makes OOP a whole lot more convenient, but it's still not that difficult to do the same sort of stuff in MASM.

Consider the following simple HLA OOP example:



program t;
?@nodisplay := true;
?@noalignstack := true;

type
demoClass:
class
var
i:dword;
j:dword;

method m( k:dword );
procedure create;

endclass;

method demoClass.m( k:dword );
begin m;

mov( k, eax );
mov( eax, this.i );

end m;

procedure demoClass.create; @noframe;
begin create;

mov( &demoClass._VMT_, this._pVMT_ );
ret();

end create;

static
obj: demoClass;
vmt( demoClass );

begin t;

obj.create();
obj.m( 5 );

end t;


Here is the pertinent MASM output from the HLA compilation:




L1_m__hla_ proc near32
push ebp
mov ebp, esp
mov eax, dword ptr [ebp+8] ;/* k */
mov dword ptr [esi+4], eax ;/* this.i */
mov esp, ebp
pop ebp
ret 4
L1_m__hla_ endp

L2_create__hla_ proc near32
mov dword ptr [esi+0], offset32 (_VMT_demoClass___hla_+0) ;/* this._pVMT_ */
ret
L2_create__hla_ endp
.
.
.
mov esi, offset32 [ L3_obj__hla_+0 ] ; obj
call L2_create__hla_ ; create

pushd 05h
mov esi, offset32 [ L3_obj__hla_+0 ] ; obj
mov edi, dword ptr [esi+0] ; m's address in the VMT
call dword ptr [edi+0]


As you can see, this isn't all that difficult to achieve in MASM. As MASM's STRUCT capability even allows for inheritence, there is no reason a chapter on OOP couldn't cover MASM, TASM (which has OOP capabilites) and HLA. Other assemblers would be a bit of a pain (as they generally don't support structs and the ability to do inheritence, but, once again, you could always look at the output of the HLA compiler to determine how to write the code (e.g., for FASM).
Cheers,
Randy Hyde
Posted on 2003-12-04 10:35:56 by rhyde
Hi Tao,

AoA is arguably THE book or tutorial when you want to learn assembly. We are not competing with AoA, and we possibly never can. AoA has a purpose, and our book does too. Since the days of its inception, we've called this wiki thing a "book", which I must point out isn't entirely correct.

As you may probably know, information on assembly language is scattered all over the Web. This is a small effort to bring everything together in one place. For instance, I've written to and invited Mr. Agner Fog, Mr. Ron Thomas, Mr. Bill Tyler, and other such experts in the field to contribute articles to our little thing. I think it is more of a "reference" suitable for a programmer of any caliber. So let it evolve.

AoA is the best book and tutorial you'd ever find on the Internet. This thing or whatever you might wanna name it is a reference that supplements it, and takes you a step or two ahead, while also tackling with the basic concepts. Even though simply jumping on to advanced concepts and research would be easier than explainin stuff with all the simplicity we can afford, it would discourage beginners and confuse them more than anythin else. So, our main concern here it to produce an excellent all-round reference that meets the needs of every programmer in the field. Be him a beginner or a pro.

Regards,
Art:alright:
Posted on 2003-12-04 12:37:09 by Art Sands
Hello there,

Read your comments on OOP in assembler. Indeed programming in OOP needs a different assembler and not "tricky macro's". But you mention also HLA. Can someone give me more info about HLA.
(concerning OOP in HLA. and is HLA a real assembler or almost c++?)
Posted on 2003-12-30 02:26:31 by raidu

But you mention also HLA. Can someone give me more info about HLA.


HLA is implemented as an assembly compiler but the language it uses is assembly.
Despite the name HLA can be used to write pure assembly programs. For a more detailed explanation of HLA and its purpose you can have a look at this link.

http://webster.cs.ucr.edu/Page_AoAWin/HTML/Foreword.html#47


(concerning OOP in HLA. and is HLA a real assembler or almost c++?)


HLA is a powerful language with a powerful macro system so with the high level features it has and the macro system you could probably create something like c++ with it. :)

There's a chapter in AOA32 about OOP in HLA.
http://webster.cs.ucr.edu/Page_AoAWin/HTML/ClassesAndObjects.html#998258
Posted on 2003-12-30 04:07:04 by Odyssey
thanks a lot....
i've created my first object and it works already
Posted on 2003-12-31 06:24:56 by raidu