The MASM Forum

Microsoft 64 bit MASM => MASM64 SDK => Topic started by: caraveiro on August 19, 2022, 01:20:17 PM

Title: ".if eax > 0" error (warning A4010:expected '>' on text literal)
Post by: caraveiro on August 19, 2022, 01:20:17 PM
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:

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:
Title: Re: ".if eax > 0" error (warning A4010:expected '>' on text literal)
Post by: quarantined on August 19, 2022, 01:52:46 PM
I don't have temphls.inc on my computer but...
try this

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



Title: Re: ".if eax > 0" error (warning A4010:expected '>' on text literal)
Post by: quarantined 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.
Title: Re: ".if eax > 0" error (warning A4010:expected '>' on text literal)
Post by: hutch-- 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


Title: Re: ".if eax > 0" error (warning A4010:expected '>' on text literal)
Post by: caraveiro on August 20, 2022, 02:06:31 AM
Quote from: hutch-- on August 19, 2022, 02:36:35 PM
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:


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



Quote from: swordfish on August 19, 2022, 01:55:41 PM
Need further help? All you need is to ask.
Thank, swordfish.
Title: Re: ".if eax > 0" error (warning A4010:expected '>' on text literal)
Post by: quarantined on August 20, 2022, 02:10:15 AM
Quote from: caraveiro on August 20, 2022, 02:06:31 AM
Thank, swordfish.

You're welcome. Glad your all sorted.