mov eax,-216152991
print ustr$(eax),13,10
inkey
exit
result.....
-216152991
i thought ustr$ displayed unsigned dwords
ustr$ MACRO number
LOCAL buffer
.data?
buffer TCHAR 40 dup (?)
align 4
.code
IFNDEF __UNICODE__
invoke crt__itoa,number,ADDR buffer,10
ELSE
invoke crt__itow,number,ADDR buffer,10
ENDIF
EXITM <eax>
ENDM
oops
i think crt__ultoa/crt__ultow was what you wanted
can't believe i am just now finding this - lol
Dave,
I did not see a question.
Are you talking to yourself ? :biggrin:
Andy
oops
i think crt__ultoa/crt__ultow was what you wanted
reporting an error
Hutch doesn't like it when we ask questions in this sub-forum - lol
I have read it but have not had time to look at the problem.
i am guessing it was a simple copy/paste mistake :P
(http://www.en.kolobok.us/smiles/artists/mini/connie_mini_bump.gif)
(http://www.masmforum.com/board/index.php?action=dlattach;id=3712;type=avatar)
Jochen,
what has lingo's old avatar to do with Dave?
Gunther
:biggrin:
i try to maintain my masm32 library so it's compatible with other members
but, i may go off the grid with str$, ustr$, and uhex$
probably the stuff i use most out of m32lib
i would also like to upgrade them so they are unicode aware
i don't control the library, but i do have control of it on my disk :biggrin:
yep, beside some bugs, there are some macros that are currently not TCHAR aware. Also I'm missing some important macros in this context. e.g. for declaring TCHAR data in arbitrary segment.
For hutch it might be more helpful if we supply him such an file with some comments what has been added and corrected...
Quote from: Gunther on May 13, 2013, 01:21:05 AM
what has lingo's old avatar to do with Dave?
Nothing. Just a warning to the little bird in the glass 8)
Quote from: jj2007 on May 13, 2013, 03:42:35 AM
Nothing. Just a warning to the little bird in the glass 8)
Ah, I understand. Thank you for the advice. ;)
Gunther
something else that is handy is, sometimes, i want to load the address into a register
mov edx,uhex$(eax)
it works for uhex$ because the macro is written to exit with the address
uhex$ MACRO DDvalue ;; unsigned DWORD to hex string
;
;
;
EXITM <OFFSET rvstring>
ENDM
but, it doesn't work for ustr$ or sstr$
ustr$ MACRO number
;
;
;
EXITM <eax>
ENDM
Quote from: dedndave on May 13, 2013, 05:35:59 AMbut, it doesn't work for ustr$ or sstr$
why does it not work? EAX holds the address.
Quote from: dedndave on May 13, 2013, 05:35:59 AM
but, it doesn't work for ustr$ or sstr$
...
EXITM <eax>
Works fine, Dave. What doesn't work is
mov eax, str$(123)
because of
EXITM <ADDR rvstring>
I recommend
mov esi, Str$ (http://www.webalice.it/jj2006/MasmBasicQuickReference.htm#Mb1186)("This is %i times more powerful", 100)
;)
of course, it works now - lol
i remember wanting to do something along that line a while back and failing :redface:
it may have been the old version - or i may have been trying to do something else
(http://www.dinasaurhedcult.com/forums/images/smilies/bump.gif)
mov eax,80000000h
print ustr$(eax)
result
-214783648
ustr$ is Unsigned, right ?
masm32_v10 macro
ustr$ MACRO DDvalue ;; unsigned integer from string
LOCAL rvstring
.data
rvstring db 20 dup (0)
align 4
.code
;; invoke dwtoa,DDvalue,ADDR rvstring
invoke crt__ultoa,DDvalue,ADDR rvstring,10
EXITM <OFFSET rvstring>
ENDM
current macro
ustr$ MACRO number
LOCAL buffer
.data?
buffer TCHAR 40 dup (?)
align 4
.code
IFNDEF __UNICODE__
invoke crt__itoa,number,ADDR buffer,10
ELSE
invoke crt__itow,number,ADDR buffer,10
ENDIF
EXITM <eax>
ENDM
this seems to work ok, unless someone sees a problem ?
ustr$ MACRO number
LOCAL buffer
.data?
buffer TCHAR 40 dup (?)
align 4
.code
IFNDEF __UNICODE__
invoke crt__ultoa,number,ADDR buffer,10
ELSE
invoke crt__ultow,number,ADDR buffer,10
ENDIF
EXITM <eax>
ENDM
tested with both ANSI and UNICODE builds