News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

unexpected results from EQ operator

Started by Jeff, May 17, 2005, 06:05:49 AM

Previous topic - Next topic

Jeff

hey guys,
i cant really figure out what's causing the problem.  im writing up little macro functions that "simplify" the use of the OPATTR operator for me.  however, the way i have it, it always generates false and now im totally stuck.  did i do something wrong or overlook something?

this is my testing code:
.386
.MODEL FLAT,STDCALL

ISDATA MACRO symbol:REQ
    IFNB <symbol>
        IF OPATTR symbol EQ 2Ah
            EXITM <-1>
        ELSE
            EXITM <0>
        ENDIF
    ENDIF
ENDM

ISSTACK MACRO symbol:REQ
    IFNB <symbol>
        IF OPATTR symbol EQ 62h
            EXITM <-1>
        ELSE
            EXITM <0>
        ENDIF
    ENDIF
ENDM

ExitProcess PROTO :DWORD

.DATA
a1 DWORD ?

.CODE
main PROC
LOCAL a2:DWORD
    MOV eax,ISDATA(a1)
    MOV ebx,ISDATA(a2)
    MOV ecx,ISSTACK(a1)
    MOV edx,ISSTACK(a2)
    MOV eax,OPATTR a1
    MOV ebx,OPATTR a2
    MOV ecx,OPATTR a1
    MOV edx,OPATTR a2
    MOV eax,(OPATTR a1 EQ 2Ah)
    MOV ebx,(OPATTR a2 EQ 2Ah)
    MOV ecx,(OPATTR a1 EQ 62h)
    MOV edx,(OPATTR a2 EQ 62h)
    INVOKE ExitProcess,0
main ENDP
END main


your help would be greatly appreciated.

MichaelW

Hi Jeff,

Try putting parentheses around "OPATTR symbol" so MASM will compare the return value for OPATTR to 2Ah, instead of comparing the symbol to 2Ah.
eschew obfuscation

Jeff

oh that was it, thanks michael.  i was doing this thinking that OPATTR had higher precedence than EQ.  gotta slap myself for that... ow.  :)