News:

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

Main Menu

cant I just replace ml with uasm?

Started by daydreamer, February 06, 2020, 08:00:25 PM

Previous topic - Next topic

daydreamer

must I change to some unicode as standard to replace
db "this is ascii string",0

dw "this is a unicode string",0 ?
dw "一二三四五六七八九十百千万",0
so line 2 and 3 kind of text can be mixed in api calls that use WCHAR as standard?
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

daydreamer

I got a strange bug,I call a proc in a different source file and it breaks code,so it suddenly exits
wrong epilog setting?,but if I insert
jmp main
Label:


ret
main:
call label
it works

my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

johnsa

Can you sure a bit more of a complete example?

rsala

Hi daydreamer,

I think you should define unicode strings like this:

dw "t", "h", "i", "s", " ", "i", "s", " ", "a", " ", "u", "n", "i", "c", "o", "d", "e", " ", "s", "t", "r", "i", "n", "g", 0
dw "一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "百", "千", "万", 0
EC coder

johnsa

From the regression test pack in UASM, we have the following test-case/example file:

You should be able to use dw that way to declare WCHAR strings, and with OPTION LITERALS:ON + L prefix you can directly insert them into INVOKEs.

option casemap : none
option frame : auto; generate SEH - compatible prologues and epilogues
option win64 : 11; init shadow space, reserve stack at PROC level
option literals : ON
option evex:1
includelib msvcrt.lib
printf proto : vararg;
includelib kernel32.lib
includelib user32.lib

ExitProcess   proto : dword
MessageBoxExW proto : ptr, : ptr, : ptr, : dword, : word
MessageBoxExA proto : ptr, : ptr, : ptr, : dword, : word
testi proto :dword, :dword
; wprintf proto : QWORD
; swprintf_l proto : QWORD, : QWORD, : word
; swprintf(buf, 100, L"%s", L"Hello\xffff world");
; SetConsoleOutputCP proto : dword
; SetConsoleCP  proto : dword
 

.data
;mylab dq myadr1,myadr2,myadr3
one dw  "Kuća", 0
two dw "abcdef", 0
three dw "Am mulți bani", 0;
four dw "У меня много денег",0
five dw "Sok pénzem van",0
format db "%s", 13, 10, 0
; 0x0419 Russian(ru)    0x19    LANG_RUSSIAN    Russia(RU) 0x01    SUBLANG_RUSSIAN_RUSSIA
; WINAPI MessageBoxEx(
; _In_opt_ HWND    hWnd,
; _In_opt_ LPCTSTR lpText,
; _In_opt_ LPCTSTR lpCaption,
; _In_     UINT    uType,
; _In_     WORD    wLanguageId

    .code
    main proc
   ; mov edx,2
    ;lea    rax,mylab
    ;jmp QWORD PTR[rax+rdx*8]
    invoke MessageBoxExA, 0, "This is a test", "heading", 0, 0
    invoke MessageBoxExW, 0, L"У меня много денег", ADDR one, 0, 0
myadr1:   
    invoke MessageBoxExW, 0, L"لدي الكثير من المال", ADDR four, 0, 0
    invoke MessageBoxExW, 0, L"Kuća", ADDR three, 0, 0
    invoke MessageBoxExW, 0, L"Imam puno novaca", ADDR two, 0, 0
    invoke MessageBoxExW, 0, L"我有很多钱", ADDR three, 0, 0
    invoke MessageBoxExW, 0, L"Имам пуно новаца", ADDR five, 0, 0
.data
mylab dq myadr1,myadr2,myadr3
.code

myadr2:
    invoke MessageBoxExW, 0, L"Sok pénzem van", ADDR three, 0, 0
    invoke MessageBoxExW, 0, L"Am mulți bani", ADDR three, 0, 0
    invoke MessageBoxExW, 0, L"Tengo mucho dinero", ADDR three, 0, 0
    invoke MessageBoxExW, 0, L"Tengo mucho dinero", ADDR three, 0, 0
myadr3:
    invoke MessageBoxExW, 0, L"Kuća", ADDR three, 0, 0
    invoke MessageBoxExW, 0, L"Sok pénzem van", ADDR three, 0, 0
    invoke MessageBoxExW, 0, L"Am mulți bani", ADDR three, 0, 0
    ;invoke printf, addr format, lengthof three
    ;invoke printf, addr format, lengthof four
    invoke ExitProcess, 0
    ret
    main endp
    end

jj2007

Quote from: daydreamer on June 14, 2020, 05:40:31 AM
must I change to some unicode as standard to replace
db "this is ascii string",0

dw "this is a unicode string",0 ?
dw "一二三四五六七八九十百千万",0
so line 2 and 3 kind of text can be mixed in api calls that use WCHAR as standard?

Posting code that doesn't assemble in a very old stale thread is a bad habit, daydreamer :cool:

include \masm32\MasmBasic\MasmBasic.inc         ; download
  Init
  uMsgBox 0, "一二三四五六七八九十百千万", "This is Unicode, and it works:", MB_OK
EndOfCode

daydreamer

Quote from: johnsa on March 16, 2022, 02:38:31 AM
Can you sure a bit more of a complete example?
I put lots of pushes after label and pops before ret and it works,could been the problem,main loop uses most registers and call proc
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding