The MASM Forum

64 bit assembler => UASM Assembler Development => Topic started by: 2B||!2B on October 18, 2023, 05:01:06 PM

Title: Why does UASM not accepting a typedef WORD in defining a unicode string?
Post by: 2B||!2B on October 18, 2023, 05:01:06 PM
With OPTION LITERALS:ON
We can define a unicode string like so

UniStr DW "String",0
But if we use an alias of a WORD type,
WIDE_CHAR            typedef WORD
WIDE WIDE_CHAR "String",0

It will complain about value too large
Error A2055: Initializer value too large
While using WORD directly works
WIDE WORD "String",0
Is this a bug?
Title: Re: Why does UASM not accepting a typedef WORD in defining a unicode string?
Post by: jj2007 on October 18, 2023, 07:37:40 PM
Why do you insist with that typedef nonsense? Mystring dw is perfect. An assembly programmer knows what dw means
Title: Re: Why does UASM not accepting a typedef WORD in defining a unicode string?
Post by: _japheth on October 18, 2023, 08:54:00 PM
> Is this a bug?

It does indeed look like a bug, because the TYPEDEF directive is supposed to create an "alias" type. Of course, if the documentation states that this feature is triggered by the WORD "directive" explicitely, then it's ok.
Title: Re: Why does UASM not accepting a typedef WORD in defining a unicode string?
Post by: 2B||!2B on October 19, 2023, 06:44:28 AM
Quote from: jj2007 on October 18, 2023, 07:37:40 PMWhy do you insist with that typedef nonsense?

I don't insist. I always used DW. In fact, I had this by coincidence when I used a WCHAR and just thought that it doesn't make sense.
Title: Re: Why does UASM not accepting a typedef WORD in defining a unicode string?
Post by: NoCforMe on October 19, 2023, 12:36:48 PM
Again:

"Doc, it hurts when I do this."
"Then don't do that!"
Title: Re: Why does UASM not accepting a typedef WORD in defining a unicode string?
Post by: jj2007 on October 19, 2023, 01:24:44 PM
I have the solution to all your problems:

include \masm32\include\masm32rt.inc

OPTION LITERALS:ON
WIDE_CHAR typedef WORD ; no luck
UNI_CHAR equ <dw> ; hooray!

.data
UniStr1 DW "The string", 0
; UniStr2 WIDE_CHAR "String", 0 ; won't work, damn it!
UniStr3 UNI_CHAR "String #3", 0 ; wow, this works!

.code
start:
  printf("wow, this works: %ls\n", addr UniStr3)
  invoke MessageBoxW, 0, addr UniStr1, uni$("The title"), MB_OK
  exit

end start
Title: Re: Why does UASM not accepting a typedef WORD in defining a unicode string?
Post by: 2B||!2B on October 19, 2023, 02:01:54 PM
QuoteI have the solution to all your problems:

Never said I have a problem. That's clearly wasn't the intention of the question.
Title: Re: Why does UASM not accepting a typedef WORD in defining a unicode string?
Post by: NoCforMe on October 19, 2023, 02:47:05 PM
Well, I certainly don't want to engage in trying to psychoanalyze your or your question or your motivation for asking it or any of that. I think your "problem", as stated in your original post, is:

QuoteIs this a bug?

the answer to which, apparently, is "yes". So I would guess problem (however you want to define it) solved, no? Maybe not satisfactorily, but solved nonetheless.

Is there some place you can report UASM bugs? or would that just be a black hole, like reporting bugs in older Micro$oft software?
Title: Re: Why does UASM not accepting a typedef WORD in defining a unicode string?
Post by: Vortex on October 20, 2023, 05:31:55 AM
Hi NoCforMe,

Quote13. Bug Reports and Feature Requests
bug reports and feature requests can be logged via the github project page.

https://www.terraspace.co.uk/uasm.html#p12

https://github.com/Terraspace/UASM/issues
Title: Re: Why does UASM not accepting a typedef WORD in defining a unicode string?
Post by: johnsa on October 20, 2023, 07:03:44 PM
Please do log this on Github, the aliased type via typedef should work in this case. Thanks!