The MASM Forum

General => The Campus => Topic started by: megavlad on May 06, 2025, 09:05:54 AM

Title: compile-time logical operators
Post by: megavlad on May 06, 2025, 09:05:54 AM
The compile-time operator AND, OR, NOT, and XOR are bitwise operator.
Does MASM support compile-time logical operators?

The goal would be to do use them in macros, like:

foo macro arg1, arg2
    if arg1 eq 11 && arg2 eq 22
        ; ...
    endm
endm
Title: Re: compile-time logical operators
Post by: Quin on May 06, 2025, 09:20:37 AM
Edit: I didn't read the topic title closely. You're talking about compile time operators.
Title: Re: compile-time logical operators
Post by: sinsi on May 06, 2025, 09:43:55 AM
MASM uses AND, not &&.

QuoteEQ - Returns true (-1) if expression1 equals expression2, or returns false (0) if it does not.
In this case, AND is logical
foo macro arg1, arg2
    if (arg1 eq 11) and (arg2 eq 22)
        ; ...
    endm
endm
I added the brackets for clarity.
Title: Re: compile-time logical operators
Post by: NoCforMe on May 06, 2025, 10:16:59 AM
Assemble-time, not compile-time (same difference but still), but yes, those operators are usable.
Very handy.
Title: Re: compile-time logical operators
Post by: megavlad on May 06, 2025, 10:59:34 AM
Quote from: sinsi on May 06, 2025, 09:43:55 AMfoo macro arg1, arg2
    if (arg1 eq 11) and (arg2 eq 22)
        ; ...
    endm
endm

Thanks
Title: Re: compile-time logical operators
Post by: daydreamer on May 07, 2025, 03:32:20 PM
I seen old 13h demo code,how powerful compile time stuff can be used to compile time create several palettes of blue fire,red fire,green fire etc ,in source file,with conditional jump to desired palette to compile