News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Why does UASM not accepting a typedef WORD in defining a unicode string?

Started by 2B||!2B, October 18, 2023, 05:01:06 PM

Previous topic - Next topic

2B||!2B

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?

jj2007

Why do you insist with that typedef nonsense? Mystring dw is perfect. An assembly programmer knows what dw means

_japheth

> 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.
Dummheit, gepaart mit Dreistigkeit - eine furchtbare Macht.

2B||!2B

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.

NoCforMe

Assembly language programming should be fun. That's why I do it.

jj2007

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

2B||!2B

QuoteI have the solution to all your problems:

Never said I have a problem. That's clearly wasn't the intention of the question.

NoCforMe

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?
Assembly language programming should be fun. That's why I do it.

Vortex

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

johnsa

Please do log this on Github, the aliased type via typedef should work in this case. Thanks!