Assembly 6.2
What does AND do?
1 and 1 = 0, 1 and 0 = 0, 0 and 0 = 0.
What does XOR do?
If 1 then it inverts. if 0'ed unchanged.
What does NOT do?
Inverts everything.
Convert the character in AL to upper case. a to A mov al,'a' ; AL = 01100001b
and al,11011111b ; AL = 01000001b
Write a single instruction using 16-bit operands that clears the high 8 bits of AX and does not change the low 8 bits.
and ax, 00FFh
jump to L1 if all bits 4, 5, & 6 are set
and bl, 01110000b cmp bl, 01110000b je L1
Write code that jumps to label L1 if either bit 4, 5, or 6 is set in the BL register.
and bl, 01110000b jnz L1
What does CMP do? When is carry flag set?
compares destination with source operand. Does nondestructive subtraction of source from destination. Carry flag set when destination < Source
What does OR do?
if 0 and 1 then 1. if 0 and 0, then 0. if 1 and 1 then 1.
Write code that jumps to label L3 if EAX is negative.
jump to L4 if (ebx - ecx) > 0 sub ebx, ecx cmp ebx, 0 jg L4
Write a single instruction that converts an uppercase character in AL to lowercase but does not modify AL if it already contains a lowercase letter
or al, 00100000b
Write a single instruction using 16-bit operands that sets the high 8 bits of AX and does not change low 8 bits.
or ax, 0FF0h
Write instruction that set the Zero flag if the 32-bit value in EAX is even and clear the Zero flag is odd.
test eax, 1 ;(low bit set if eax is odd)
Write a single instruction (other than NOT) that reverses all the bits in EAX
xor eax, 0FFFFFFFFh