Hello all,
I'm a brand new newbie to assembly language programming.  I'm enjoying the iczelion tutorials immensely.. So what is this post?  Could someone point me to either or both the generally accepted libraries that provide the basic low level manip - like strings, conversions, i/o, math etc. that I'm sure must exist and any tutorials on how to use them.  It took me quite a while to find wsprintf on my own for output conversion and formatting and short of writing my own string concatenation routine, I'd rather find the basics already done somewhere.

Second question: win32api refers to having to clean up after wsprintf since it uses cdecl C calling.  Could someone explain this?  How do you clean up the stack after a call.  I naively counted the arguments to wsprintf and did a:

add esp, '# of arguments'

but that didn't seem to work?

patience please... real newbie

Any pointers much appreciated,
namuh1
Posted on 2005-06-03 12:19:22 by namuh1
For ready made libs check the following:

Donkey ( http://donkey.visualassembler.com ) wrote some libs handling Graphics, Strings, Files, etc
The Masm lib in your C:\Masm32\ folder has a couple of functions to make your life easier..
Thomas' Page @ http://www.madwizard.org has a snippet section having quite a few handy functions too.

For wsprintf > If you call that function through 'invoke' in Masm, then Masm will handle the stack correction for you, if you do the push push call way then you have to correct it by add esp, NumberOfArguments * 4. With four beeing the size of a dword.

Hope that helps you out a bit.
J
Posted on 2005-06-03 13:07:03 by JimmyClif
Exactly what I needed.  I tried wsprintf both ways and couldn't figure why it worked with invoke (now i understand).  With the push/pop myself I simply forgot to multiply by 4.  Great links for libs... Thx!

Thank you very much,

Cheers,
Namuh1
Posted on 2005-06-03 13:14:54 by namuh1
If you have any interest in higher precision math, you may find something useful at:

http://www.ray.masmcode.com/

Raymond
Posted on 2005-06-03 21:23:09 by Raymond
wsprintf is declared as cdecl function in user.dll

wsprintfA PROTO C :DWORD,:VARARG
wsprintf equ <wsprintfA>

Since MASM knows that wsprintf is a cdecl function, whenever you call the function with invoke, MASM automatically helped to clear up the stack for you, hence there is no need for you to clear up the stack yourself.

That's one of the reason why using invoke is better than all that pushes and calls
Posted on 2005-06-04 06:30:42 by roticv
The Shell Lightweight API is also useful:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/shlwapi/shlwapi.asp
Posted on 2005-06-06 15:12:57 by QvasiModo
Yes all very helpful:
Thanks for the higher prec. math link Raymond... I am interested.

Thanks for the clear explanation for wsprintf.. i'm clear now roticv

And the Shell Lightweight API IS very useful... thanks QvasiModo

Namuh1

LOL- will now read for the next year and 1 half... expect post around 2006.5  ?stardate
Posted on 2005-06-07 09:53:11 by namuh1
Don't go away  ;) Take you time and do ask here if you have any more questions. That's how we all learn.
Posted on 2005-06-07 10:08:15 by roticv