How are the examples going?

Did you get my email?

Posted on 2002-10-26 18:32:16 by Maelstrom
I just downloaded you package, and have a quick look over it... I have to say nice work!

I havent tried anything out yet, but on a glance it looks good.. i will add more comments/thoughts when i get a chance to 'experince' it better ;)

Keep up the good work!
Posted on 2002-10-26 22:57:50 by NaN
Thanks NaN

I look forward to your comments.

If you think the framework looks good, wait until you see the preprocessor :grin:

Posted on 2002-10-27 01:02:10 by Maelstrom
I'm liking the look of this stuff - I've been defining custom objects using supporting linkedlist code, will there be any simple linking helper code?
I coded the linkedlist stuff as a helper for translating c++ examples back into masm... is this stuff going to be pd?
Posted on 2002-11-05 00:48:58 by Homer
I'm liking the look of this stuff - I've been defining custom objects using supporting linkedlist code, will there be any simple linking helper code?

I've already thought of creating some objects based on your linked list code but haven't gotten around to it yet.

What do you mean by simple linking helper code?

I coded the linkedlist stuff as a helper for translating c++ examples back into masm... is this stuff going to be pd?


Posted on 2002-11-05 06:16:20 by Maelstrom
helper functions - for linking an unlinked object to another object for example
pd - public domain

Some of the code in the LinkedList includefile is from Scronty.
Feel free to use anything or everything from the LinkedList code within your oop project provided that it is noncommercial, I'm sure Scronty would agree with that.
Posted on 2002-11-05 21:35:10 by Homer
What does .OBJECT mean? What does it mean to add an object to a class?

Posted on 2002-11-06 01:10:13 by _Shawn
It might help to think of "methods of a class" as being similar to "functions of a dll"... yeah yeah I know that's not at all accurate, but similarities exist.
That being said, should one of these "methods" refer to a particular "object", then the structure of that "object" needs to be defined.
Rather than redefine objects every time they need to be defined again, we can define a "reference object", and then we can "instance" this any number of times with minimal resources.
Posted on 2002-11-06 06:08:13 by Homer

I'm thick and it's time to go to bed ( currently 2:10 am ), I still don't follow about helper functions - an example?

Yep the framework is public domain.

Nice object analogy.


The .OBJECT macro allows you to add objects, or object references to the class. Embedding objects is useful for static functionality, while object references are useful for dynamic functionality.

Let's use a linked list node class as an example.





lpNext and lpPrev are object pointers of type CLINKEDLISTNODE. Defining object pointers this way simply tells the framework how to access the data they reference.

I'm I making sense or just babbling?

Posted on 2002-11-06 07:02:52 by Maelstrom
some other example of object helper functions:
-search linkedlist hierarchy for first/all named child object(s)
-duplicate an object
-reparent an object to any other
-callback to return each instance of a type of object

I guess I should have said "object and associated resource management functions" but it seemed a bit obtuse at the time.
Posted on 2002-11-07 07:00:35 by Homer
Hi EvilHomer2k

Aaaagh, now I see what you mean.

-search linkedlist hierarchy for first/all named child object(s)

Wouldn't this exist as a method of the linked list class?

-duplicate an object

I never thought of that.
I assume you mean create a copy of an object that already exists?
Out of interest, what uses are there for this?

-reparent an object to any other

Isn't this restricted to linked lists, binary trees, etc.
Wouldn't this functionality be provided by the list or tree class?

-callback to return each instance of a type of object

Now that's an interesting one.
This would require all objects to be tracked some how wouldn't it?

Posted on 2002-11-07 20:37:35 by Maelstrom
-callback to return each instance of a type of object

Now that's an interesting one.
This would require all objects to be tracked some how wouldn't it?

Heh, its not to say its a bad idea... it would require an internal resorce tracking object. The up side is if done properly, memory management/leaks could be avoided safely (even 'HDC' and such windows related leaks), with out the programmers concern.

The down side, you now have a garbage collector... much like (dare i say it.... java)...

Posted on 2002-11-11 20:13:02 by NaN
That is what I was getting at, automatic and intelligent resource management of objects, and automatic garbage collection (I suggest reference counting).
The outcome should emulate the C directives for instantiating and destroying referenced objects.
By example, at the moment the LinkedList code I worked on supports simplistic allocation and releasing, with minimal safety checks. It performs no auto garbage collection, leaving this to the application. This is not good. I was considering enshrining the current LinkedList code in a DLL along with some better management facilities, making it somewhat less flexible.
Yes, the Create() and Destroy() methods should be enshrined in the methods of each Class, but generic functions for duplicating existing objects etc probably should be available to all Classes, don't you agree?
Furthermore, as NaN pointed out, it would be lovely if the "manager" also maintained the reference database (whatever form it may take) such that it could perform the necessary auto garbage collection for us.

Duplicating referenced objects is very common in gamecoding, and in many other areas of coding. Simply "creating" another object isn't always enough, especially if you want the duplicate object to inherit some or all of the attributes of its progenitor. If the object is a referenced object, the reference object describes the attribute set, but does not hold data unique to an instance of the object. We could code a function to copy the attributes of a given object, but it would be much better to provide a function which may duplicate any instanced object, and another suggestion here would be to provide for selective masking of the fields of the progenitor. Thus the function could cope with yet-to-be-defined object structures without the need to be recoded. The way I imagine the selection mask to operate would be to point to a "dummy" object, where any bits set to one would be copied, and any bits set to zero would be excluded, and also provide the sizeof the object (as I did in the improved LinkedList code to provide for unknown new objects).

I am very enthusiastic about your project.
I am one who believes asm should grow and change, while always allowing for pure lowlevel opcodes. I am one who rides the fence. This project represents much more than a simple code module, it represents a breaching of languages, it is a bridge by which HLL coders may have an opportunity to see the light.
I encourage keen young amateurs to look at masm when choosing their next step forward, and mentor a dozen or so.. and this kind of project will be welcomed warmly by the community of coders on the edge of asm who are yet to make that leap because their foundation coding knowledge is based on virtual concepts which have no place beyond their compiler.

Keep up the good work !!
Posted on 2002-11-11 22:27:43 by Homer
Umm, I don't really understand this framework completely:

1. Does it create COM object DLLs/OCXs?
2. If so, what about idl, rgs, and other registration/registry files?
3. What about rasing events?
4. Are the COM objects created with this framework scriptable?

I'd like to use this framework in my HTACOM app wizard
(that will allow us to create a Win32ASM COM project initially via point and click)
Posted on 2002-11-28 18:58:08 by Xtreme
As far as im aware (havent seen what Maelstrom been up to since his last post), his model is simple a low level OOP structure for assembly programming (much like the one Thomas and I worked on last year).

Ie. Allocating memory from the heap and applying a structure of function pointers over them and calling the result an 'object'. His is different in that he is writing a translation engine to take keywords and translate to ASM code (behind the scenes). In ours we simple used macros (which was challenging to say the least ;) ).

Im sure his framework will easily form wrappers around com objects, but it doesnt necessarily create com's.

This is my understanding of his project, i could be 100% wrong here, but i dont think so...

Posted on 2002-11-28 21:42:01 by NaN
Sorry about the lack of updates guys but I've been busy with the everyday chores of life.

Your understanding is crystal clear NaN. I wanted the framework to be as low level as possible so people could do many different things with it. The original framework posted here uses macros, but as NaN stated I'm currently working on an object preprocessor to replace it. Due to time constraints lately I'm a bit behind with the project but I'll post here when its ready so watch this space! :)

I was also interested by your post EvilHomer2k and will play around with it using the preprocessor.

If anyones interested I can post some preprocessor info

Posted on 2002-11-29 02:21:11 by Maelstrom

If anyones interested I can post some preprocessor info
Yup, post it.. it's always interesting stuff. :alright:
Posted on 2002-11-29 04:08:19 by Maverick
Thanks Maverick, always nice to see some interest :)

The syntax is still in a state of flux so don't be surprised if it changes ;)

#class CCLASS, [base]
_data dd ?

#object _blah [*] CBLAH

#static method [C] [args]

#virtual method [*] [C] [args]

#inline ; haven't worked these out yet!
; blah


; private data and methods go here

The * means ptr ( object reference, pure virtual ) and C should be obvious. Anyone having C flashbacks yet :tongue: Arguments can be seperated by whitespace or comma's and you only have to specify C in the class definition, the proc will automatically generate correctly.

#proc [USES ebx edi esi] CCLASS::method, [args]

Object creation is controlled using these keywords

#new - creates dynamic objects
#create - creates static objects
#local - creates objects on the stack ( these are automatically destroyed when the proc in which they where defined ends )
#construct - constructs an embedded object ( defined with #object )
#destroy - destroys an embedded object

Object access is controlled using these keywords

#this - set the this ptr
#superclass - invoke overloaded base method
#overload - overload a virtual method. ( used to change the method behaviour at runtime, has nothing to do with overloading methods thru inheritance )
#assume - assumes that a register accesses an object. ( similar to MASM syntax )
#set - sets and assumes a register accesses an object

The #assume and #set keywords allow you to access objects passed to the method as well as global objects. These keywords require you to specify a name by which to access the object.

mov ebx, _lpFile
#assume ebx, CFILE::_lpFile ; access object as #_lpFile or #ebx

; or

#set ebx, CFILE::_lpFile ; same as above

; we can now access the object

#ebx.method [args]
#_lpFile.method [args]

mov eax,
mov eax,

; #new, #create, and #local work the same way

#new ebx, CFILE::_lpFile, [args] ; create a CFILE object and access it as #_lpFile or #ebx

Accessing methods and data from the class whos method your currently in is done using #this

#this.method [args]

mov eax,

I've left out a few but you get the idea.

Posted on 2002-11-29 19:33:30 by Maelstrom
Hey all

Long time without an update so I thought I had better post a few words.

The new OOP preprocessor is progressing, albeit slowly, but I hope to have it done relatively soon.

So give me your opinions for the following...

1. What's the best place to store the virtual method ptrs, in the class structure or in a seperate vmt? What about speed concerns?
2. Would it be useful if the preprocessor could create or define COM objects?
3. When creating an object, who should be responsible for initializing the class data?
4. Is multiple inheritance required?

Let me explain #3 a little. When I create an object I initialize it by copying a class template which nulls the data and initializes the virtual ptrs. The virtual ptrs should be initialized automatically but should the object data be initialized this way, or should the user be responsible for initializing it in the constructor?

Posted on 2002-12-19 23:55:29 by Maelstrom
My test.asm only contains follow lines.

.model flat, stdcall
option casemap: none



end start

However when i compile the above assembly file, the following error occurs. Could anyone know what happen and where the error comes from? : error A2008: syntax error : ARGC : error A2012: PROC, MACRO, or macro repeat directive must precede LOCAL : error A2170: directive must appear inside a macro : fatal error A1008: unmatched macro nesting

Make error(s) occured.
Posted on 2003-01-05 09:05:29 by yoursguideline