Author Topic: ".if eax > 0" error (warning A4010:expected '>' on text literal)  (Read 759 times)

caraveiro

  • Regular Member
  • *
  • Posts: 19
  • Quam olim da capo.
Hi.
I just cannot compile when the condition is ".if eax > 0".   :sad:

I have review the vasily.inc file and temphls.inc and I guess there is some macro logic messing around.
So far I'd run out of clues.  :undecided:
Code: [Select]
option DOTNAME          ; required for macro files               
option casemap:none     ; case sensitive
include \masm64\include64\masm64rt.inc
include temphls.inc
.code
OPTION PROLOGUE:rbpFramePrologue
WinMain proc
sub rsp,5*8
    invoke MessageBox,NULL,&MsgBoxText,&MsgCaption,MB_OK
    invoke ExitProcess,NULL
    .if eax == 0
        .if eax > 0  ;HERE Comment to compile ok.
        .endif         ;HERE Comment to compile ok.
        ;ERROR if above 2 lines are NOT commented:
        ;Assembling: C:\Masm64\Iczelion\tut2\msgbox.asm
        ;C:\Masm64\Iczelion\tut2\msgbox.asm(12) : warning A4010:expected '>' on text literal
        ;.if(1): Macro Called From
        ;C:\Masm64\Iczelion\tut2\msgbox.asm(12): Main Line Code
        ;C:\Masm64\Iczelion\tut2\msgbox.asm(12) : error A2206:missing operator in expression
        ;J_ONE_COND(9): Macro Called From
        ;J_POLY_COND(9): Macro Called From
        ;.if(3): Macro Called From
        ;C:\Masm64\Iczelion\tut2\msgbox.asm(12): Main Line Code
        ;_
        ;Link error
    .endif
WinMain endp
MsgCaption      db "Iczelion's tutorial #2",0
MsgBoxText      db "Win64 Assembly is Great!",0
END
¿Any idea what's going bad in my code?  :arrow_up:
"knowledge is now free at last, everything should be free from now on, enjoy knowledge and life and work for everybody else"
+ORC

quarantined

  • Guest
Re: ".if eax > 0" error (warning A4010:expected '>' on text literal)
« Reply #1 on: August 19, 2022, 01:52:46 PM »
I don't have temphls.inc on my computer but...
try this
Code: [Select]
include \masm64\include64\masm64rt.inc

.code

WinMain proc
    invoke MessageBox ,NULL, addr MsgBoxText, addr MsgCaption, MB_OK

    .if rax == 0                                ; or did you really want eax here? 

        .if rax } 0                               ; in masm64  use'}' in place of '>'

 ;; put you statement here

        .endif

    .endif
    invoke ExitProcess,NULL
WinMain endp

MsgCaption      db "Iczelion's tutorial #2",0
MsgBoxText      db "Win64 Assembly is Great!",0
END



quarantined

  • Guest
Re: ".if eax > 0" error (warning A4010:expected '>' on text literal)
« Reply #2 on: August 19, 2022, 01:55:41 PM »
Also you are using code after invoking ExitProcess.
After ExitProcess finishes the program will immediately close.
That code will never run unless a jump directs the flow of code to there.
I changed eax to rax, since I assume that is what you meant
I moved the .if block to above the call to ExitProcess, should assemble fine.

see attachment '1.zip' below.

Need further help? All you need is to ask.

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 10572
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: ".if eax > 0" error (warning A4010:expected '>' on text literal)
« Reply #3 on: August 19, 2022, 02:36:35 PM »
ML64 does not allow that notation.

.if eax > 0

Use this instead,

.if rax } 0

Have a look at the "MASM64 Library And Macro Reference" help file under the heading,

 Control Flow Operators
 .if Block Comparison Operators

 
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

caraveiro

  • Regular Member
  • *
  • Posts: 19
  • Quam olim da capo.
Re: ".if eax > 0" error (warning A4010:expected '>' on text literal)
« Reply #4 on: August 20, 2022, 02:06:31 AM »
ML64 does not allow that notation....
Have a look at the "MASM64 Library And Macro Reference" help file under the heading,
That's the reference I needed, hutch.  :thumbsup:

Code: [Select]
            ;.if ((cl!=0)&&(cl!='') ;note this masm32 code, like girlfriend, NEEDs SPACES in masm64   :bgrin:
            .if ( (cl {} 0) && (cl {} ' ' ) )
            .endif


Need further help? All you need is to ask.
Thank, swordfish.
"knowledge is now free at last, everything should be free from now on, enjoy knowledge and life and work for everybody else"
+ORC

quarantined

  • Guest
Re: ".if eax > 0" error (warning A4010:expected '>' on text literal)
« Reply #5 on: August 20, 2022, 02:10:15 AM »
Thank, swordfish.

You're welcome. Glad your all sorted.