Author Topic: hello.asm error on newer MASM  (Read 203 times)

DragonautX

  • Regular Member
  • *
  • Posts: 4
hello.asm error on newer MASM
« on: February 20, 2021, 05:44:23 AM »
Hi, I'm new to MASM. I tried out VS 2019's MASM (14.28.29334.0) on C:\masm32\tutorial\console\demo1\hello.asm. I got a "constant expected" error. But it worked fine on the MASM that's part of the MASM SDK (6.14.8444).
  -See masm-error-small.jpg

I looked at windows.inc. I found "include winextra.inc" on line 26889. In "winextra.inc", I found some STD_ALERT struct in lines 11050-11054. I commented that out. And both MASMs compile successfully.
  -See masm-fixed-small.jpg

I'm not sure why that's happening. Is that hello.asm just for the old MASM, or did I forget to add an ML.exe option?

jj2007

  • Member
  • *****
  • Posts: 11157
  • Assembler is fun ;-)
    • MasmBasic
Re: hello.asm error on newer MASM
« Reply #1 on: February 20, 2021, 06:31:52 AM »
The Masm 14.x series is notoriously buggy, so it's not your fault. Try to get a different assembler version. See in particular https://masm32.com/board/index.php?topic=8852.msg96603#msg96603

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 8146
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: hello.asm error on newer MASM
« Reply #2 on: February 20, 2021, 09:39:20 AM »
Not all versions of ML.EXE are the same. Slight changes over time and additions to instruction sets produce problems of this type. The supplied version was 6.14 worked correctly but when you choose to use a later version, you will need to check the odd bits and pieces.

There is no simple way to provide a set of include files for every ML version or Windows version. A few tweaks here and there will make it possible to use the latest ML version so you can use the latest instruction sets.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

DragonautX

  • Regular Member
  • *
  • Posts: 4
Re: hello.asm error on newer MASM
« Reply #3 on: February 20, 2021, 10:05:06 AM »
Thanks hutch--, that's good reasoning. MASM 6 should be good for me. But I'll make a note of this for future versions.

TouEnMasm

  • Member
  • *****
  • Posts: 1590
    • EditMasm
Re: hello.asm error on newer MASM
« Reply #4 on: February 20, 2021, 07:16:43 PM »
Lmalert.sdk
Quote
STD_ALERT   STRUCT DEFALIGNMASM
   alrt_timestamp DWORD ?
   alrt_eventname WORD EVLEN+1 dup (?)
   alrt_servicename WORD SNLEN+1 dup (?)
STD_ALERT      ENDS

delet the () beetween WORD EVLEN
constant EVLEN and SNLEN need include lm.h (.sdk)

Fa is a musical note to play with CL

daydreamer

  • Member
  • *****
  • Posts: 1511
  • building nextdoor
Re: hello.asm error on newer MASM
« Reply #5 on: February 20, 2021, 08:51:48 PM »
Thanks hutch--, that's good reasoning. MASM 6 should be good for me. But I'll make a note of this for future versions.
what masm version you need depend on if you gonna need use latest avx2,RDRAND etc or masm 6.14 is good enough for :
;important beginning of source file to maximize assembler caps
;otherwise you can get unnecesary error messages
Code: [Select]
.686p ;686 instructions+p=assemble protected mnemonics
          ;fpu instructions
.MMX ;Pentium MMX instructions
.XMM ;SSE only version 1 if v6.14 ,using macros you can extend to newer opcodes/mnemonics or v6.15 or little higher version
Hutch I am unsure about support for AMD specific opcodes 3dnow and such on ml 6.14?
SIMD fan and macro fan
Happy new year 2021 that can only turn out to become better than worse 2020 :)

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 8146
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: hello.asm error on newer MASM
« Reply #6 on: February 21, 2021, 12:37:41 AM »
Probably not but I don't have an old AMD to test it with.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

DragonautX

  • Regular Member
  • *
  • Posts: 4
Re: hello.asm error on newer MASM
« Reply #7 on: February 21, 2021, 06:09:04 AM »
To TouEnMasm:

Ya, MASM 14 works now. Just to double check, this is what you meant, right?

-Looks like winextra.inc already defines SNLEN and EVLEN on lines 8808 and 8816. The comment above says it's from lmcons.h.
-My STD_ALERT uses WCHAR, not WORD. But I still removed the brackets, and everything works now:

STD_ALERT struct
    alrt_timestamp dd ?
    alrt_eventname WCHAR  EVLEN + 1 dup(?)
    alrt_servicename WCHAR SNLEN + 1 dup(?)
STD_ALERT ends

====================
To daydreamer:

This is more for learning. I want to study more about the JIT from the Dolphin Emulator. It's for a personal project. It uses some x64Emitter, which is here:

https://github.com/dolphin-emu/dolphin/blob/master/Source/Core/Common/x64Emitter.cpp

As long as I can practice assembly and SIMD on the x86 MASM, I'll think I'll be alright studying the emitter.


~~~~By the way, what do you mean by "assembler caps"? Looks like you just wrote directives. Did you mean "directives"?

daydreamer

  • Member
  • *****
  • Posts: 1511
  • building nextdoor
Re: hello.asm error on newer MASM
« Reply #8 on: February 22, 2021, 03:09:37 AM »
English isn't my native language, some old examples only use. 486 directives,so i thought it was important to show max any ml version out
SIMD fan and macro fan
Happy new year 2021 that can only turn out to become better than worse 2020 :)

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 8146
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: hello.asm error on newer MASM
« Reply #9 on: February 22, 2021, 05:25:07 AM »
Magnus,

Use 686p, MMX and XMM and you can write anything.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

DragonautX

  • Regular Member
  • *
  • Posts: 4
Re: hello.asm error on newer MASM
« Reply #10 on: February 22, 2021, 06:01:19 AM »
Oh ok. That makes sense. I thought "assembler caps" meant something else, like "maximum size of your code", in terms of bytes. Instead of "what types of instructions are allowed".