Slide 12.4: Decision directives
Slide 12.6: .REPEAT directive
Home

Decision Directives (Cont.)


The .IF directive is expanded into assembly language instructions including the CMP. Assume val1 and result are 32-bit unsigned integers:

 mov eax, 6
 .IF ( eax > val1 )
   mov result, 1
 .ENDIF
  mov eax, 6
  cmp eax, val1
  jbe @C0001     ; unsigned comparison
  mov result, 1
@C0001:          ; created by assembler
 Memory Comparison   Unsigned Comparison   Signed Comparison 
 .data
 opnd1  BYTE  1
 opnd2  BYTE  2
 .code
 .IF ( opnd1 < opnd2 )
   call  WaitMsg
 .ENDIF
 .data
 opnd  BYTE  -1
 .code
 .IF ( opnd < 0 )
   call  WaitMsg
 .ENDIF
 .data
 opnd  SBYTE  -1
 .code
 .IF ( opnd < 0 )
   call  WaitMsg
 .ENDIF
 Output  Output  Output

 




 




 



 Memory & Register   Register Comparison   Constant Comparison 
 .data
 opnd  SBYTE  -1
 .code
 mov   al, 0
 .IF ( opnd < al )
   call  WaitMsg
 .ENDIF
 .code
 mov  eax, -4
 .IF ( eax < 0 )
   call  WaitMsg
 .ENDIF
 .code
 mov  eax, -4
 .IF ( 0 > eax )
   call  WaitMsg
 .ENDIF
 Output  Output  Output