The MASM Forum

General => The Campus => Topic started by: bomz on February 27, 2013, 03:52:09 PM

Title: .if .else .elseif .endif
Post by: bomz on February 27, 2013, 03:52:09 PM
mov ax, KeyBoardBuffer.Flags
test ax, KEY_MAKE
.if ZERO?;(ax & KEY_MAKE);CARY?

what constructions possible else?
Title: Re: .if .else .elseif .endif
Post by: hutch-- on February 27, 2013, 04:01:33 PM
.if

.elseif

.else        ; only 1, and must be 2nd last

.endif
Title: Re: .if .else .elseif .endif
Post by: bomz on February 27, 2013, 04:51:11 PM
I mean like this ZERO?;(ax & KEY_MAKE);CARY?. I don't know about them only
.if TRUE
.if !eax
.if eax==ebx.....
Title: Re: .if .else .elseif .endif
Post by: jj2007 on February 27, 2013, 05:22:50 PM
        invoke GetKeyState, VK_SHIFT
        .if ax & 7        ; test ax, 0007, je @F
                nop
        .elseif Carry?
                nop
        .elseif Zero?
                nop
        .elseif !Zero?
                nop
        .elseif Sign?
                nop
        .elseif !(Sign? || Zero?)        ; combis are better done "by hand"
                nop
        .endif
Title: Re: .if .else .elseif .endif
Post by: dedndave on February 28, 2013, 12:37:36 AM
ZERO?
CARRY?
OVERFLOW?
SIGN?
PARITY?
Title: Re: .if .else .elseif .endif
Post by: jj2007 on February 28, 2013, 01:06:06 AM
The Masm developers forgot the Above? and Greater? flags, unfortunately...
Title: Re: .if .else .elseif .endif
Post by: dedndave on February 28, 2013, 01:09:35 AM
yes, those would have been nice
but, you can accomplish those using the "normal" conditional expressions
Title: Re: .if .else .elseif .endif
Post by: Magnum on February 28, 2013, 01:10:45 AM

Operator Meaning

== Equal
!= Not equal
>  Greater than
>= Greater than or equal to
<  Less than
<= Less than or equal to
&  Bit test (format: expression & bitnumber)
!  Logical NOT
&& Logical AND
|| Logical OR

CARRY? Carry bit set
OVERFLOW? Overflow bit set
PARITY? Parity bit set
SIGN? Sign bit set
ZERO? Zero bit set