The test program has been changed to AsmTypeA.

I placed the routine in a DLL, so it could easily
be used for most homegrown editors.

I added a couple of options that will allow you
to set the indent and spaces.

Fixed a couple of bugs and made some changes to
the Keyword array, plus added many more assembler
Inructions to the array.

You can also create your own custom Keywords that
will allow you to enter a partial or complete
Function with a minimum of two keystrokes.

To MovingFulcrum, I fixed you e problem.

You can download AsmTypeA from my web site at:

Read the Readme file.

Play with it and let me know what you think, it
could be a good addon tool for all of us
writting editors.

Posted on 2001-08-09 14:49:17 by Ewayne
Hey i like... wel kinda.. :)

Constructive feedback here...

I think you have a exellent start on a handy feature, but i still find it a bit cumbersome, so here are my 'problems' for you to think about..

1) The auto indent looks nice, but i find it gets annoying to keep your code in line when trying to nest .if's (since you have to remind yourself not to tab all the way in first).

2) The autocomplete should have user control. I tried to write a macro called 'LOOK_AT_THIS' and no matter how i tried to start it off, i always got this.. "loopK_AT_THIS". This problem shows up elsewhere, like "movv".

3) To the effect of #2, perhaps the 3 letter standard asm commands can be left out?, after all, they are only 3 letters?.

My suggestions:

How hard would it be to have the same basic functionality (with out the tabbing), but intead of finishing the word started (and leaving the cursor at the end), have it finish it in a different shade (say red), and have the curror in the same place, waiting for a space or a tab, which would indicate "yes, this is the word i want", and then copy it black, and into memory. If not, the user keeps typing and it tries to find a autocoplete if it can...


invoke (two key presses, cursor after 'n')

If i want it: hit space --> INVOKE (is placed)
If not, i keep typing --> int 21h (not likely, but possible 'in' solution)

As well, if i dont hit space and simply type invoke, it replaces it anyways after im done...

These are a few helpful thoughts (as your hard work seems to be leaving a quite wake since your post yesterday :) )

Good Luck, and great start.

Posted on 2001-08-09 18:11:22 by NaN
Also, try typing:

in.. (and hold the v down for a sec and then let go.. )

you get: invvvvvvvvv INVOKE

Just pointing out the bug...

Posted on 2001-08-09 18:17:43 by NaN

Thanks for the feedback, thats what I need to get
it working right.

Suggestion 1.)

I'm working on the code to nest .if's & .while's.

Suggestion 2.)


I just need to include the p in the match field
for the loop group.
loop instead of loo.


That was one of my concerns that the user would
enter a varable name with the same prefix as a
Keyword. I'll have to think about that one.

Suggestion 2.) last part

I will probably put that in as an option, because
I want to keep it as automated as posible.


Posted on 2001-08-09 18:38:39 by Ewayne
At least you get something meaningful INVOKE
instead of invvvvvvvvv. :grin:

Posted on 2001-08-09 18:46:15 by Ewayne
Why don't you transverse the MASM grammar, and limit the possible input by that context? It's very similar to creating the front-end of an assembler. :grin:
Posted on 2001-08-09 19:28:08 by bitRAKE
I thought about that, but what if someone wanted
to enter jmptopatch. Would it not make some folks
angry if they could not enter what they wanted to.

Posted on 2001-08-09 20:02:07 by Ewayne
Why wouldn't that be possible? Anything that MASM could parse the front-end could parse. If you programmed it like I suggest. It's involved to create, but you seem to have the time and drive. :) Use the BNF grammar in the appendix of the documentation of MASM to create a context tree. Each leaf in the tree points to lists and functions. Many things could be done with this code: smart highlighting / completion, real-time nonlinear assembler :), detect all syntax errors before the code goes to the assembler.

I've been slowly working on the idea myself. I'm concerned about creating something that is easy to modify / add or fix features. Maybe, I'll code it in a HLL? Or, I need to create the tools to build the grammar tree from the BNF? NaN's object work should really help me, too. :)
Posted on 2001-08-09 20:04:25 by bitRAKE
Side Note... Its getting even more powerful :) :grin: :)

I revamped the macros a touch and upgraded the CString and CFile classes. To handle InString search, and InFile Search... (only took about 10 lines of code + hutches BMB Search algorithm.)

So now if i have a sample file like this (openme.txt):

01 rum and cokes!

101 Intro to CPU'n - Hurray!
I have the correct lines of data!

This is the code needed to seach for hearders like an INI file.
 mov hFile1, $NEWOBJECT( CFile, SADD("openme.txt"), CFILE_READ, 64 )

METHOD hFile1, CFile, InFile, SADD("[IMPORTANT]")
METHOD hFile1, CFile, LoadData, addr AData, SIZEOF ASTRUCT

METHOD hFile1, CFile, SetFileOffset, NULL
METHOD hFile1, CFile, InFile, SADD("[NAN]")
METHOD hFile1, CFile, LoadData, addr AData2, SIZEOF ASTRUCT

AData1 and AData2 is a four-byte structure... (playing around a bit here).. I find first, Load 4 bytes of data into a memory stucture, then i reset the offset pointer, and search for the and do the same..

The last bit of test code is:
 xor eax, eax

mov al, AData.d1
DPrintValH eax, "D1"
mov al, AData.d2
DPrintValH eax, "D2"
mov al, AData2.d1
DPrintValH eax, "D3"
mov al, AData2.d2
DPrintValH eax, "D4"

So im mixing the first 2 bytes of each loaded header data to produce the current year.. (20 + 01) or 2001. :)

Kinda pointless.. but eh.. doesnt take much work to do anymore :)

Posted on 2001-08-09 22:56:51 by NaN
Here is a quit little example of the new macro's. I made 4 extra macros that have the same purpse (to the METHOD routine). They are $EAX(), $EBX(), $EDI(), $ESI().

The reason for this is when doing in-line macro's i found that if you have more than one inline macro, the later over writes the first before the method/function is called. (MASM will write the macro code first, then the function it was found in).

invoke MessageBox, NULL, $METHOD(hString, CString, Address), \

$METHOD(hString, CString, Address), MB_OK

will turn into this:

.. Macro code..
EAX == String 1 address
.. Macro code..
EAX == String 2 address

invoke MessageBox, NULL, eax, eax, MB_OK

Thus, I get only String 2 displayed in both fields..

The above solution allows the return to NOT be eax (and does no protection incase of eax is corrupted..) So long story short, if you only want one inline method macro.. use $EAX()..
invoke MessageBox, NULL, $EAX(hString, CString, Address), SADD("NaN!"), MB_OK

If you want to do multiple ones, use $EDI(), $ESI(), $(EBX), and if still needed $EAX() last to preserve eax for the function they are in-line with...

Anywho.. on with the example...
 mov hFile1, $NEWOBJECT( CFile, SADD("openme1.txt"), CFILE_READ, 64 )

mov hFile2, $NEWOBJECT( CFile, SADD("openme2.txt"), CFILE_READ, 64 )

push esi
push edi

invoke MessageBox, NULL, \
$ESI(hFile1, CFile, ReadLine), \
$EDI(hFile2, CFile, ReadLine), \

pop edi
pop esi


This will load the first line of file 1 and display it as the message, with the first line of file 2 as the caption in the message box..

I have also provided SetMethod and ReleaseMethod macros which simply push's ebx, esi, edi, and pop's them respectively. I didnt want to cram alot of overhead into the method calls.. so i left out pushing and poping these in the $() macro's..

Actually if people are worried about overhead.. every method gets translated, (worst case ~ no parameters) into 3 lines of code:

mov edx, hFile
push edx

parameters, like invokes will add more pushes...

Anywho.. this is not my thread... so as excited as i am with all this new stuff, i will surrender the floor back to Ewayne and his work.

BTW: Ewayne, if you think you may have a need for objects and unsure how to start with this, E-Mail/post me a message, and i will happily work out some solutions for you (if i can).

Posted on 2001-08-09 23:23:07 by NaN

I was starting to get a little confused about
what you were talking about and the conection to
my Type Ahead routine.
But it looks like all good stuff anyway.

Posted on 2001-08-09 23:56:00 by Ewayne
Sorry, it doesnt directly... Im only trying to advertise its usefullness if there is merit for it... there may not be any, but then again, maybe there is...

Really you need to examine the work ahead of you and decide if there is parts that would be better suited for OOP.. The CFile class i just finished has parsing routines withing using hutch's BMB search, this may be an asset reducing work.. Since its a class i can make many unique instances and open many files at once. Since they are all of the same type of class, they will all have the same method names, so functions don't need to "know" exactly which file its working with when called...

I really dont know how your code works (abstractly), so i can't give you suggestions, but i do know your loading and comparing strings..

Anywho, i was only offering what i know if you think you need it.. I think your work so far is good as is.. but it looks like its a big enough project, and my experience with bigger projects suggest the OOP models are better managed...

Posted on 2001-08-10 15:50:29 by NaN
Thanks for the info.

I would like to keep the code plain assembler as
much as posible, plus I know nothing about Ally

I fixed the nested .if's & .while's problem.

I put the routine in my AsmEdit program and
entering new code works good except if there is
a label or variable with the same prefix as a
Keyword. I need to come up with a fairly easy

I might take your suggestion with the
highlighting or bitRAKE's or my own, still

Right now on working on a fix to enter code in an
existing program or routine and get the proper

Posted on 2001-08-10 16:32:55 by Ewayne
Its all good :)

However, you now have me a bit inspired... Im doing a cheap verion of the same type of idea.. (except im heading towards the coloring ahead i talked about above).. Not to challenge you, but to more or less see how well my existing classes would hold up to such a project...

I have the search routine done, works well in debugger mode. But im having a f'n frustrating time with rich edit itself..

Im using the ENM_KEYEVENTS to catch WM_CHAR events, and then work on them... the problem is when i try to select and replace portions of text i get what i select.. but i alway end up with the character pressed after my handler finishes...

Long story short, i need my handler to kick in AFTER the char is placed and recognized in memory.. any suggestions how to handle this better??


If i type: inv

the prgram recognizes it as 'invoke' and replaces the last 3 from the cursor postion. But the problem is this, i get the last char placed after this..



I wrote a test routine to replace each new char with "#'.. this is its output: (typing 'abcd' )


Posted on 2001-08-10 20:07:55 by NaN

I had the same problem, what I done to overcome
is was to intercept the WM_CHAR and save the
wparam and then send that plus the wparam of
WM_KEYUP when that message is received, I only
use the wparam of WM_CHAR for special characters.

Posted on 2001-08-10 21:22:06 by Ewayne
I haven't done it, so I hate opening my mouth just yet, but what about processing selection change messages? It certainly seems like it would be harder, but offer a great deal more flexiblity? Like if you backspace and try a new keyword, or do some cut-n-paste and edit the structure references. The auto-complete could take take into account the adjacent text.
Posted on 2001-08-10 21:40:45 by bitRAKE

That might be a good idea, I already have
selection change in my AsmEdit program, I'll
check it out.


Posted on 2001-08-10 21:59:42 by Ewayne
Thanx for the tip...

Between you and me, I think monkeys designed the message structure of Rich Edit :rolleyes:

Posted on 2001-08-10 23:11:14 by NaN
I don't think the monkeys you speak of were so cute. :)
Posted on 2001-08-10 23:21:29 by bitRAKE