News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

dwtoa with no crt

Started by thomas_remkus, February 28, 2008, 12:09:33 AM

Previous topic - Next topic

thomas_remkus

There must be a MASM-ish way to do take a DWORD and put it in a buffer as a string without needing to include the masm32rt.lib. Is there a macro that's inside MASM that will do this or a windows API that does this? wsprintf seems like such an overkill.

ChrisLeslie

If you want to just convert dw to ascii then you don't need any API. There are many version of this and something that should be basic for you to roll your own. Look in the masmlib for the dwtoa proc and copy it individually to your application if you wish rather than including the library. But - just dwtoa by itself won't go very far because the reason for it is usually to display it. Then you will need Win APIs.

thomas_remkus

Thanks. I presumed to create a buffer and then put my eax value in the buffer with a dwtoa function. I presumed the normal MASM method to do this was either something inside MASM, a macro, or something from Microsoft in general. I was under the understanding that Microsoft did not create the masm32rt.lib so I would not be able to use these functions if I did not have the MASM project installed but rather Express. So I was looking for a method to do this from Express and from MASM both so the code was compatible with both.

It's sad that there is no dwtoa API from Microsoft inside the OS. That would be my prefered method if MASM did not come with a solution in the language or standard installed header.

MichaelW

dwtoa is still present in the MASM32 library, and the str$ and sstr$ macros still use it. The ustr$ macro was changed from dwtoa to crt__ultoa, I think because dwtoa assumes signed values. I also seem to recall a thread where the goal was to create faster versions.
eschew obfuscation