Author Topic: Mixed UNICODE/ASCII builds in Masm32  (Read 1340 times)


  • Member
  • *****
  • Posts: 8735
  • Assembler is fun ;-)
    • MasmBasic
Mixed UNICODE/ASCII builds in Masm32
« on: November 16, 2014, 04:52:40 PM »
I am testing to what extent mixing Ascii and Unicode is possible with the standard Masm32 installation, and it seems possible but the results are a bit mixed. For example, in the attached testbed, fopen fails for an existing file but succeeds for a file that doesn't exist:
Code: [Select]
mov esi, ucCmd$(1)
; print str$(fexist(esi)), " for fex", 13, 10
.if fexist(esi) ; OK
print "You have ["
print "YOU DO NOT HAVE ["
print esi, "], and "
mov ebx, fopen(esi)
print "fopen succeeded", 13, 10
fclose ebx
print "NO LUCK for fopen", 13, 10
Masm32 Unicode: Hello World
print ucCmd$=   [Args for Masm32.bat]
print GetComLine=       [Masm32Commandlines.exe  "Args for Masm32.bat" several a
StdOutW ucC=    [Args for Masm32.bat]

You DO have [Args for Masm32.bat], but NO LUCK for fopen

Masm32 Ascii: Hello World
print cmd$=     [牁獧映牯䴠獡㍭⸲慢t]
print GetComLine=       [Masm32Commandlines.exe  "Args for Masm32.bat" several a
StdOutA cmd$=   [Args for Masm32.bat]

YOU DO NOT HAVE [牁獧映牯䴠獡㍭⸲慢t], and fopen SUCCEEDED

What's wrong here? Sources and batch files for some args are attached, plus a file with a UNICODE name and spaces, for dragging over the exe. MasmBasicCommandlines.asc file contains the MasmBasic equivalent, with a different logic, i.e. one build but the option to put w like wide in front of the macros:

  wLet esi=wCL$(1)
  .if wExist(esi)            ; OK
      wPrint "You have ["
      wPrint "YOU DO NOT HAVE ["
  wPrint esi, "], and "
  wOpen "I", #1, esi
      PrintLine "wOpen succeeded"
      Close #1
      PrintLine "wOpen FAILED"