The MASM Forum

General => The Campus => Topic started by: Magnum on November 26, 2012, 02:13:01 AM

Title: Missing operator
Post by: Magnum on November 26, 2012, 02:13:01 AM
I get a "missing operator" with this.
Is the subtraction sign not a valid operator any more ?

.IF End_Count - r9Seed > 0x10
.IF (End_Count - r9Seed) > 0x10
Title: Re: Missing operator
Post by: jj2007 on November 26, 2012, 03:37:21 AM
Hi Andy,

If it's assembler, it should be 10h, not 0x10
Besides, you need
  mov eax, offset End_Count - r9Seed
  .if eax>10h
Title: Re: Missing operator
Post by: dedndave on November 26, 2012, 04:30:23 AM
or - if End_Count is an EQU and r9Seed is a memory operand....
    mov     eax,End_Count
    sub     eax,r9Seed
    .if eax>10h


that being the case, you can optimize the code that is generated a little bit

you can combine the 10h with the EQU (but not a memory operand)
    mov     eax,End_Count-10h

now, rather than looking for "greater than", you can test for sign or carry (depending on signed or unsigned)
you see, the assembler uses CMP and Jcc when you do it the original way
but, if the condition that results after SUB may be tested with a flag, the CMP is not needed
        mov     eax,End_Count-10h
        sub     eax,r9Seed
        .if !SIGN?

or
        mov     eax,End_Count-10h
        sub     eax,r9Seed
        .if !CARRY?


the assembler supports ZERO?, CARRY?, OVERFLOW?, SIGN?, and PARITY?
of course, you can precede them with "!" to get the inverse case
i'm not sure if you can combine them to use Jcc's like JLE, which examines the zero, sign, and overflow flags   :P
one of the reasons i prefer the old way of doing it - lol
Title: Re: Missing operator
Post by: Magnum on November 26, 2012, 06:19:34 AM
Error_mod_not_found


invoke GetTickCount
mov Start_Count,eax

;int 3h

invoke GetTickCount
mov End_Count,eax

mov     eax,End_Count
sub     eax,Start_Count

int 3

.if eax > 01h
invoke MessageBox,NULL,ADDR Mess, ADDR Sample,MB_ICONINFORMATION


  .ELSE

invoke MessageBox,NULL,ADDR OK, ADDR Sample,MB_ICONINFORMATION


  .ENDIF