[IF using AND]                                         [Assembler][/][8086]

This small gem show how to write code like:

        IF X=A AND Y=B THEN
           { do something }
        ELSE
           { do something else }
        END IF

In the gem presented the ELSE ... ENDIF statement may be skipped. If you
have a branch predicting CPU the optimal way maybe to combine the two
compares into a single conditional jump:

        mov     eax,a
        mov     ebx,b
        xor     eax,x           ; EAX = 0 if x = a
        xor     ebx,y           ; EBX = 0 if y = b
        or      eax,ebx         ; EAX = 0 if x = a and y = b
        jnz     short else      ; Jump if not 0
then:
                ; do this...
        jmp     short endif
else:
                ; do that...
endif:

You can use the same gem on 16 bit machines too, just use 16 bit registers
instead.
                                                  Gem writer: Vesa Karvonen
                                                   last updated: 1998-03-16
