Author Topic: ustr$ Problem ?  (Read 10060 times)

dedndave

  • Member
  • *****
  • Posts: 8827
  • Still using Abacus 2.0
    • DednDave
ustr$ Problem ?
« on: April 16, 2013, 03:18:04 PM »
Code: [Select]
mov eax,-216152991
print ustr$(eax),13,10
inkey
exit

result.....
Code: [Select]
-216152991
i thought ustr$ displayed unsigned dwords

Code: [Select]
      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

Magnum

  • Member
  • *****
  • Posts: 2351
Re: ustr$ Problem ?
« Reply #1 on: April 16, 2013, 10:38:59 PM »
Dave,

I did not see a question.

Are you talking to yourself  ? :biggrin:

Andy
Take care,
                   Andy

Ubuntu-mate-18.04-desktop-amd64

http://www.goodnewsnetwork.org

dedndave

  • Member
  • *****
  • Posts: 8827
  • Still using Abacus 2.0
    • DednDave
Re: ustr$ Problem ?
« Reply #2 on: April 16, 2013, 11:19:42 PM »
Code: [Select]
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

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 7460
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: ustr$ Problem ?
« Reply #3 on: April 17, 2013, 12:40:51 AM »
I have read it but have not had time to look at the problem.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

dedndave

  • Member
  • *****
  • Posts: 8827
  • Still using Abacus 2.0
    • DednDave
Re: ustr$ Problem ?
« Reply #4 on: April 17, 2013, 01:23:15 AM »
i am guessing it was a simple copy/paste mistake   :P

dedndave

  • Member
  • *****
  • Posts: 8827
  • Still using Abacus 2.0
    • DednDave
Re: ustr$ Problem ?
« Reply #5 on: May 13, 2013, 12:23:06 AM »

jj2007

  • Member
  • *****
  • Posts: 10464
  • Assembler is fun ;-)
    • MasmBasic
Re: ustr$ Problem ?
« Reply #6 on: May 13, 2013, 01:09:11 AM »

Gunther

  • Member
  • *****
  • Posts: 3585
  • Forgive your enemies, but never forget their names
Re: ustr$ Problem ?
« Reply #7 on: May 13, 2013, 01:21:05 AM »
Jochen,

what has lingo's old avatar to do with Dave?

Gunther
Get your facts first, and then you can distort them.

dedndave

  • Member
  • *****
  • Posts: 8827
  • Still using Abacus 2.0
    • DednDave
Re: ustr$ Problem ?
« Reply #8 on: May 13, 2013, 01:32:58 AM »
 :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:

qWord

  • Member
  • *****
  • Posts: 1473
  • The base type of a type is the type itself
    • SmplMath macros
Re: ustr$ Problem ?
« Reply #9 on: May 13, 2013, 02:02:32 AM »
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...
MREAL macros - when you need floating point arithmetic while assembling!

jj2007

  • Member
  • *****
  • Posts: 10464
  • Assembler is fun ;-)
    • MasmBasic
Re: ustr$ Problem ?
« Reply #10 on: May 13, 2013, 03:42:35 AM »
what has lingo's old avatar to do with Dave?

Nothing. Just a warning to the little bird in the glass 8)

Gunther

  • Member
  • *****
  • Posts: 3585
  • Forgive your enemies, but never forget their names
Re: ustr$ Problem ?
« Reply #11 on: May 13, 2013, 03:57:42 AM »
Nothing. Just a warning to the little bird in the glass 8)

Ah, I understand. Thank you for the advice.  ;)

Gunther
Get your facts first, and then you can distort them.

dedndave

  • Member
  • *****
  • Posts: 8827
  • Still using Abacus 2.0
    • DednDave
Re: ustr$ Problem ?
« Reply #12 on: May 13, 2013, 05:35:59 AM »
something else that is handy is, sometimes, i want to load the address into a register
Code: [Select]
        mov        edx,uhex$(eax)
it works for uhex$ because the macro is written to exit with the address
Code: [Select]
      uhex$ MACRO DDvalue   ;; unsigned DWORD to hex string
;
;
;
        EXITM <OFFSET rvstring>
      ENDM

but, it doesn't work for ustr$ or sstr$
Code: [Select]
      ustr$ MACRO number
;
;
;
        EXITM <eax>
      ENDM

qWord

  • Member
  • *****
  • Posts: 1473
  • The base type of a type is the type itself
    • SmplMath macros
Re: ustr$ Problem ?
« Reply #13 on: May 13, 2013, 05:57:53 AM »
but, it doesn't work for ustr$ or sstr$
why does it not work? EAX holds the address.
MREAL macros - when you need floating point arithmetic while assembling!

jj2007

  • Member
  • *****
  • Posts: 10464
  • Assembler is fun ;-)
    • MasmBasic
Re: ustr$ Problem ?
« Reply #14 on: May 13, 2013, 05:58:28 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$("This is %i times more powerful", 100)
 ;)