1 / 6

How Instruction Affect the Flags

How Instruction Affect the Flags. Processor executes instruction Flags are affected Some instructions do not affect while some do Instruction Affect Flags MOV/XCHG none ADD/SUB all INC/DEC all except CF NEG all.

nate
Download Presentation

How Instruction Affect the Flags

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. How Instruction Affect the Flags

  2. Processor executes instruction • Flags are affected • Some instructions do not affect while some do InstructionAffect Flags MOV/XCHG none ADD/SUB all INC/DEC all except CF NEG all

  3. Example: Show how the flags register affected by the addition of 38H and 2FH Sol: MOV BH,38H ;BH=38H ADD BH,2FH;add 2F to BH, now BH=67H CF = 0 since there is no carry beyond d7 PF = 0 since there is an odd number of 1s in the result AF = 1 since there is a carry from d3 to d4 ZF = 0 since the result is not zero SF = 0 since d7 of the result is zero 0011 1000 + 0010 1111 0110 0111

  4. Sol 1001 1100 + 0110 0100 0000 0000 CF = 1 since there is a carry beyond d7 PF = 1 since there is an even number of 1s in the result AF = 1 since there is a carry from d3 to d4 ZF = 1 since the result is zero SF = 0 since d7 of the result is zero

  5. Example • Show how the flags register affected by MOV AX,34F5H ADD AX,95EBH • Show how the flags register affected by MOV BX,AAAAH ADD BX,5556H (You need to solve both as an assignment)

  6. DEBUG Flag symbol

More Related