

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Exercise: 7.1: For each add instruction in this exercise, assume that AX contains the given contents before the instruction is executed. Give the contents of AX as well as the values of the CF, OF, SF, PF, AF and ZF after the instruction is executed. All numbers are in hex. (Hint: add ax, 45 adds 45 to the contents of register ax and stores the result back in ax). Solution: Content of AX (Before) Instruction Content of AX (After) CF OF SF PF AF ZF 0045 add ax, 45 0072 0 0 0 1 1 0 FF45 add ax, 45 FF72 0 0 1 1 1 0 0045 add ax, - 45 0018 1 0 0 1 0 0 FF45 add ax, - 45 FF18 1 0 1 1 0 0 FFFF add ax, 1 0000 1 0 0 1 1 1 Exercise 7.2: In the following instruction sequence, show the values of the Carry, Zero, and Sign flags where indicated: mov al, 01001011b test al, 10100100b ; a. CF= ZF= SF= mov al, 00000110b cmp al, 00000101b ; b. CF= ZF= SF= mov al, 00000101b cmp al, 00000111b ; c. CF= ZF= SF= Solution: (a) CF=0 ; ZF=1 ; SF= (b) CF=0 ; ZF=0 ; SF= (c) CF=1 ; ZF=0 ; SF=