Princess Sumaya Univ. Computer Engineering Dept. Chapter 6:
Princess Sumaya University – Computer Org. & Assembly Lang. Computer Engineering Dept. 1 / 11 Boolean Instructions AND ●ANDreg, reg ●AND reg, mem ●AND reg, imm ●AND mem, reg ●AND mem, imm Sign, Zero Flags OR XOR NOT
Princess Sumaya University – Computer Org. & Assembly Lang. Computer Engineering Dept. 2 / 11 Boolean Instructions Example:ASCII Case: A = a = Sentence = “I aM A sTudeNT”
Princess Sumaya University – Computer Org. & Assembly Lang. Computer Engineering Dept. 3 / 11 Boolean Instructions TEST (Similar to AND) ●TESTreg, reg ●TEST reg, mem ●TEST reg, imm ●TEST mem, reg ●TEST mem, imm Sign, Zero Flags
Princess Sumaya University – Computer Org. & Assembly Lang. Computer Engineering Dept. 4 / 11 Compare Instruction CMP (Similar to SUB) ●CMPreg, reg ●CMP reg, mem ●CMP reg, imm ●CMP mem, reg ●CMP mem, imm Carry, Overflow, Sign, Zero Flags
Princess Sumaya University – Computer Org. & Assembly Lang. Computer Engineering Dept. 5 / 11 Jump on Condition Instructions Jcondition Label ●Zero ●Carry ●Overflow ●Sign ●CX = 0
Princess Sumaya University – Computer Org. & Assembly Lang. Computer Engineering Dept. 6 / 11 Jump on Compare Result Unsigned Comparison (CMP X, Y) ●X > Y ●X ≥ Y ●X = Y ●X < Y ●X ≤ Y
Princess Sumaya University – Computer Org. & Assembly Lang. Computer Engineering Dept. 7 / 11 Jump on Compare Result Signed Comparison (CMP X, Y) ●X > Y ●X ≥ Y ●X = Y ●X < Y ●X ≤ Y
Princess Sumaya University – Computer Org. & Assembly Lang. Computer Engineering Dept. 8 / 11 Jump on Compare Result Example: Z = MAX ( X, Y )
Princess Sumaya University – Computer Org. & Assembly Lang. Computer Engineering Dept. 9 / 11 Jump on Compare Result Example: D = MIN ( A, B, C )
Princess Sumaya University – Computer Org. & Assembly Lang. Computer Engineering Dept. 10 / 11 Jump on Compare Result Example: Find the first nonzero element in an array
Princess Sumaya University – Computer Org. & Assembly Lang. Computer Engineering Dept. 11 / 11 LOOP on Condition (Repeat While) LOOPZ (LOOPE) ●Decrement the Counter ●If Counter > 0 and ZF = 1 jump to label LOOPNZ (LOOPNE)
Princess Sumaya University – Computer Org. & Assembly Lang. Computer Engineering Dept. Chapter 6