The MASM Forum

General => The Campus => Topic started by: daydreamer on July 07, 2020, 02:01:49 AM

Title: easy way to include unicode text in .data secion?
Post by: daydreamer on July 07, 2020, 02:01:49 AM
testuni dw 041h,03041h,03A5h,04070h,04060h,04050h,04040h,04030h,04020h,04010h
        dw 040f0h,040e0h,040d0h
        dw 040c0h,040b0h,040a0h,04190h,04101h,04102h,04103h,04104h
        dw 0,0,0,0,0,0,0,0,0,0,0

I want to write 16bit unicode in .data sections same way you can write ascii strings in db "test"
like in some other languages supports a 16bit unicode source file

or I need to use some unicode macros to solve it?
Title: Re: easy way to include unicode text in .data secion?
Post by: TouEnMasm on July 07, 2020, 02:18:26 AM
I remember that there is some macro Here to do that,but i don't remember where

You are lucky,I am the good one to find that !
http://masm32.com/board/index.php?topic=1796.msg18423#msg18423 (http://masm32.com/board/index.php?topic=1796.msg18423#msg18423)
Title: Re: easy way to include unicode text in .data secion?
Post by: Vortex on July 07, 2020, 02:41:28 AM
Hi daydreamer,

You can use the WSTR macro to define UNICODE strings :

include     \masm32\include\masm32rt.inc

.data

WSTR        string,"This is a test."

.code

start:

    invoke  crt_wprintf,ADDR string

    invoke  ExitProcess,0

END start
Title: Re: easy way to include unicode text in .data secion?
Post by: jj2007 on July 07, 2020, 03:31:22 AM
@Vortex - to my surprise, this works indeed:
include     \masm32\include\masm32rt.inc

.data

WSTR        string,"Добро пожаловать"

.code

start:

    invoke  crt_wprintf,ADDR string

    invoke  ExitProcess,0

END start
Title: Re: easy way to include unicode text in .data secion?
Post by: daydreamer on July 07, 2020, 01:31:05 PM
thanks,it works :thumbsup: