Presentation is loading. Please wait.

Presentation is loading. Please wait.

How Instruction Affect the Flags. Processor executes instruction Flags are affected Some instructions do not affect while some do Instruction Affect Flags.

Similar presentations


Presentation on theme: "How Instruction Affect the Flags. Processor executes instruction Flags are affected Some instructions do not affect while some do Instruction Affect Flags."— Presentation transcript:

1 How Instruction Affect the Flags

2 Processor executes instruction Flags are affected Some instructions do not affect while some do Instruction Affect Flags MOV/XCHGnone ADD/SUBall INC/DECall except CF NEGall

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 = 0since there is no carry beyond d7 PF = 0 since there is an odd number of 1s in the result AF = 1since there is a carry from d3 to d4 ZF = 0since the result is not zero SF = 0since d7 of the result is zero

4 Example Show how the flags register affected by MOV AL,9CH MOV DH,64H ADD AL,DH

5 CF = 1since there is a carry beyond d7 PF = 1 since there is an even number of 1s in the result AF = 1since there is a carry from d3 to d4 ZF = 1since the result is zero SF = 0since d7 of the result is zero Sol

6 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)

7 DEBUG Flag symbol Status FlagsSet (1) SymbolClear (0) Symbol CFCY (carry) NC (no carry) PFPE (even parity) PO (odd parity) AFAC (auxiliary carry) NA (no auxiliary carry) ZFZR (zero) NZ (nonzero) SFNG (negative) PL (plus) OFOV (overflow) NV (no overflow) Control Flags DFDN (down) UP (up) IFEI (enable interrupt) DI (disable interrupt)


Download ppt "How Instruction Affect the Flags. Processor executes instruction Flags are affected Some instructions do not affect while some do Instruction Affect Flags."

Similar presentations


Ads by Google