This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: EEE 410 – Microprocessors I Fall 05/06 – Lecture Notes # 10 Outline of the Lecture • Arithmetic and Logic Instructions and Programs • COMPARE of unsigned numbers A RITHMETIC AND L OGIC I NSTRUCTIONS AND P ROGRAMS XOR XOR dest,source Ex: MOV DH,54H XOR DH,78H Solution: 54H 01010100 78H 01111000 2C 00101100 SF=0, ZF=0, PF=0, CF=OF=0 ¾ The XOR instruction can be used to clear contents of a register by XORing it with itself. Ex: Assume CH=35H XOR CH,35H Solution: 35H 00110101 35H 00110101 00 00000000 SF=0, ZF=1, PF=1, CF=OF=0 ¾ The XOR instruction can be used to toggle bits of an operand. Ex: XOR BL,04H ;XOR BL with 000 0100 Solution: This will cause bit 2 of BL to change to the opposite value; all other bits would remain unchanged. • SHIFT SHR dest,source ;shift right This is the logical shift right. The operand is shifted right bit by bit, and for every shift the LSB will go to the CF and MSB is filled with a zero. Ex: MOV AL,9AH MOV CL,3 ;set number of times to shift SHR AL,CL Solution: 9AH 10011010 01001101 CF=0 (shifted once) 00100110 CF=1 (shifted twice) 00010011 CF=0 (shifted three times) After three times of shifting AL=13H and CF=0 0 MSB LSB CF ¾ dest operand can be in a register or memory. Immediate addressing mode is not possible....
View Full Document
- Spring '10