Slide 11.4: Boolean instructions
Slide 11.6: OR instruction
Home

AND Instruction (Cont.)


The operands can be 8, 16, or 32 bits, and they must be the same size. For each matching bit in the two operands, the output bit is 1 when both of the input bits are 1; otherwise, it is 0. The table on the right describes the boolean expression X AND Y.
X Y X AND Y
0 0 0
0 1 0
1 0 0
1 1 1
 Code I: Converting Lowercase
Letters into Uppercase Letters 
 Code II: Converting an Integer
Digit into an ASCII Digit 
 INCLUDE Irvine32.inc
 .data
 buffer  BYTE  64 DUP(0)
 .code
 main PROC
     mov   edx, OFFSET buffer
     mov   ecx, SIZEOF buffer
     call  ReadString
     mov   ecx, eax
     mov   esi, OFFSET buffer

 L1: cmp   BYTE PTR [esi], 'a'
     jl    L2
     cmp   BYTE PTR [esi], 'z'
     jg    L2
     

L2: inc esi loop L1 mov edx, OFFSET buffer call WriteString exit main ENDP END main
 INCLUDE Irvine32.inc

 .data
 prompt1 BYTE "Enter a digit: ", 0
 prompt2 BYTE "The ASCII digit is ", 0

 .code
 main PROC
   call  Clrscr
   mov   edx, OFFSET prompt1
   call  WriteString
   call  ReadInt
   

mov edx, OFFSET prompt2 call WriteString call WriteChar exit main ENDP END main