Hey All, I just finished working on a little program inspired by me old Java experiences.. (Dont get me wrong, i think its way too slow to be usefull, but it does have its good points).

As everyone must know by now, Im working on a set of Object tools to allow for Objects (or a very close replica) in MASM. And since im working with these daily I found a need to some quick refencing an Object file with out scouring through miles of code.. (this where the java light when off.. (slowly) :tongue: .

The Program i just finished Takes an ASM file and parses it for specific tags and then generates an output file, Based on a given Output path... (its hard coded in my test program). Its quite simple, but i thought i would toss it out for the general public to take a look see and find comments/faults/inflexibilities etc. with the design... My work is to accent everyones MASM platform, so i would like to get constuctive feedback before i release the entire package...

There is a Sample HTML ouput attached... As well as the CHtmlParse.asm file that has example tags within it...
Posted on 2001-08-06 01:20:02 by NaN
I can't do Multiple Attachments apparently.. so here is the HTML output that the Exe will generate... (BTW: the exe is a Drag and Drop Window ~ and the ouput is hard coded to C:\WINDOWS\DESKTOP)

(( As well i now learn an HTML file is an invalid format... ))

So here it is on the web... :

Posted on 2001-08-06 01:26:22 by NaN
Java is pretty slow yes... but ask X-Calibre about the bilinearly
filtered quake BSP renderer... :)
Posted on 2001-08-06 02:48:34 by f0dder
Well 26 downloads and not one piece of feedback... I will take that as "good job" and "you cant possibly add anything else to make it better" :)

Posted on 2001-08-07 12:33:03 by NaN
Yes, a 'good job'.

Any thoughts on supporting a #VERSION label ?

I don't always get things right the first time.
Posted on 2001-08-07 19:46:49 by Wayne
Now thats a good idea...

By the time you read this it will be in place... (definitely needed, your right...)

Anyone else?? (( In a day or so, i will have some prototype objects ready for generic use ))...

I have a CFile class written to take care of most file Input or Output.. Simple methods allow for loading/saving a char/structure/line of text in one statement. As well as still being flexible. My thoughts were to provide a simple class that can handle file parsing quickly, and write data out with out hastle.

I have also written a CString class that dynamically allocates memory for a String of text (buffers etc...) such that buffer management in larger projects and be easily delt with.. (f your done with it.. DESTROY it...) Its methods are more basic, returning string length, and string size (max allocated), as well as fill string with new info from a lpSrc etc. etc.

I will release some of these in a day or two, Im sure it may serve its purpose quickly (as they make things simple)... and they will be packaged with the HTML descriptions and source (that this thread deals with... )

Good stuff comming....

Posted on 2001-08-07 21:06:01 by NaN
Ive also got a cool tool written that will will provide solid encapulation of your objects, by creating a unique library file for each object. The tool builds an Include header... Places it in one directory, and then compiles and builds a lib file and places it in another directory...

Such that once an object is writen and ready for use, you run the source through the 'packager' program and it will set up everything such all you have to do in the future is:

include \masm32\classlib\MyObject.inc

(( The program automatically insterts one line in the include file to this effect: ))

includelib \masm32\classlib\ClassBin\MyObject.Class

Such that everything remains 'grandular'....

Posted on 2001-08-07 21:12:10 by NaN
Heres a sample of what my object stuff can do in the sense of encapulating and re-using exisitng code in your projects...

Unzip the file into your MASM32 root.. Go into the directory: ClassLib\ClassSrc and run the 'Packager Tool'

This is a drag and drop window... Drag both the Source files (one at a time) into the window and let it rip.... (( This is re-building the libraries since your masm directory may not be on D: as mine is..))

Once this is done, up a directory in ClassNfo will have the HTML listings of the two classes provided. ClassBin has the library files generated (binaries), and in the ClassLib dir there will be the two generated .Inc files as well..

The Inc file has all the stuff packed and ready.. you just include them, and follow the HTML guide for methods... (Objects.inc is also provided in the EXAMPLE directory ~ used to create and destroy objects)

Go into the Example Directory and check out my test progie..

It simply Opens a Memory Mapped file, Reads and stores separately 2 lines of text from file. One into a CString Instance, the other is still in the file buffer...

Then I display a MessageBox with these two strings... (Simple enough...)

The neat thing is the SIZE :grin:

The $METHOD is the same as METHOD except it is for in-line use as shown... (Likewise for NEWOBJECT )

Anywho check it out.. you may be impressed...
.. Or maybe not...

Posted on 2001-08-08 01:49:02 by NaN
A really nice job NaN.

I am looking forward to the release.

A 'tool' like this can really put the 'R' in 'RAD' once the object base is built up.
Posted on 2001-08-08 10:54:26 by Wayne
Im glad you like...

Im trying to provide easier solutions to redundant situations with the use of objects... But i think to key to keeping them worthy, Is knowing that they should accent your projects... where they can.. and not design entire projects out of objects.... (I believe this is where java lost its *kick*)..

Things like the CFile class can quickly get you doing file I/O without headache.. and still do normal assenbly in between.. (which is where Im trying to gear it towards..)..

I think the next Class will be a Global Memory Class... with a Lock and Unlock method provided to every instance... (this will free up headache of keeping track of your memory...)

Again, thanx for the praises...


PS: Play with them and use them if you can, but i have to warn that they may still get overhaulded if I descover a better design solution... (Im still working on Inheritance issuses, as well as CLASS methods ~ Currently there are only instance methods available...)
Posted on 2001-08-08 15:46:30 by NaN
I just got an ICQ suggesting it may be wise to actually describe what the example file does... And in hind sight, i think its a little much to assume everyone has been thinking objects since March (as i have :grin: ), so here is the breakdown:

; Objects has the MACROS for NEWOBJECT, DESTROY, METHOD, as well
; as SetObject and ReleaseObject ( the l8r was a nice brainstrom
; Thomas had...
include Objects.inc

; The Class Lib file for Strings (All pre-packaged by my tool)
include \masm32\ClassLib\CString.inc

; The Class Lib for the File IO (pre-packaged)
include \masm32\ClassLib\CFile.inc

LoadStr db "openme.txt",0

hInstance HINSTANCE ?
CommandLine LPSTR ?

hFile dd ? ; Store the CFile instance handle
hString dd ? ; Store the CString instace handle
TEMP dd ?

; nothing new here
invoke GetModuleHandle, NULL
mov hInstance,eax
invoke GetCommandLine
mov CommandLine,eax

; This is to show it can dynamically handle run-time values
; The String is created to the size of TEMP
mov TEMP, 64

; Im testing out '$' as a standard for inline macros, where the
; return value is in EAX and thus this looks like mov hString, eax
mov hString, $NEWOBJECT( CString, TEMP)

; This Opens A memory mapped file with the CFile Class and
; returns the CFile instance handle.
mov hFile, $NEWOBJECT( CFile, addr LoadStr, CFILE_READ )

; This adjusts the Line Buffer to a specific value (in this case,
; i was a maximum of 64 characters on a line). It doesnt mean
; 64 chars are loaded each line, this is just a max before it stops
; trying to find a carrage return.
; (This calls an instance method (SetLineSize) on the hFile instance)
METHOD hFile, CFile, SetLineSize, 64

; This is an example of getting alot done quickly...
; (back to front) the hFile instance is asked to read a line from
; file, and then return the address to the read line in eax..
; this is the extent of the $METHOD. From here the first METHOD
; now sees me asking the hString instance to Fill itself with
; string information found in eax (whic is what $METHOD gets
; replaced with when its done..
; To sum up: Load a string of data and directly fill the String
; Instance..
METHOD hString, CString, FillString, $METHOD( hFile, CFile, ReadLine )

; Less dramatically, Load another line of data and save the
; pointer to the file buffer's string in ecx (This will change if
; i call another read line, but since i dont it wont!)
mov ecx, $METHOD( hFile, CFile, ReadLine )

; Make a message box, and display the two loaded strings of
; data just loaded from file...
invoke MessageBox, NULL, ecx, $METHOD( hString, CString, Address ), MB_OK

; Clean up! DESTROY hFile will automatically free its file and memory
; map handles..

; This will free the allocated memory used for this instance...

invoke ExitProcess,eax
end start

The descriptions are longer than the code :tongue:
Anywho.. there are some clever macros in there inspired by Huh with his early version of SADD() (( befor Hutch refined them.. )), dont let them scare you, they just allow for more one-line operations rather than the standard approach of moving eax into handles...

I hope this helps give you all a better idea what the code is doing... (should have done this earlier.. but when you have been in it sooooo long you tend to ignore the little things... :) )

Posted on 2001-08-08 16:35:55 by NaN