User:Samupedia4

Program 1 Memory location	Op-code & operand	Mnemonics 0000:0100	B8 05  00	MOV AX,0005H 0000:0103	BB 02  00	MOV BX,0002H 0000:0106	01 D8	ADD AX,BX 0000:0108	CD A5	INT A5 Result after execution of above program AX = 0007H,	BX = 0002H,  FX = F002H,    IP = 010AH   	CS,DS,ES,SS = 0000H D7	D6	D5	D4	D3	D2	D1	D0 0	0	0	0	0	0	1	0 NS	NZ		NAC		PO		NC i.e. FL = 02H

Example 2 : If inputs are AX = 00FFH,   BX = 0002H Then output AX = 0100H,	BX = 0002H,   FX = F016H, D7	D6	D5	D4	D3	D2	D1	D0 0	0	0	1	0	1	1	0 NS	NZ		AC		PE		NC i.e. FL = 16H

Example 3 : If inputs are AX = FFFFH,   BX = 0001H Then output AX = 0000H,	BX = 0001H,   FX = F057H, D7	D6	D5	D4	D3	D2	D1	D0 0	1	0	1	0	1	1	1 NS	Z		AC		PE		C i.e. FL = 57H

Program 2 Memory location	Op-code & operand	Mnemonics 0000:0100	B8 05  00	MOV AX,0005H 0000:0103	BB 02  00	MOV BX,0002H 0000:0106	29 D8	SUB AX,BX 0000:0108	CD A5	INT A5 Result after execution of above program AX = 0003H,	BX = 0002H,  FX = F006H, D7	D6	D5	D4	D3	D2	D1	D0 0	0	0	0	0	1	1	0 NS	NZ		NAC		PE		NC

i.e. FL = 06H

Example 2 : If inputs are AX = 0002H,   BX = 0005H Then output AX = FFFDH,	BX = 0005H,   FX = F093H, D7	D6	D5	D4	D3	D2	D1	D0 1	0	0	1	0	0	1	1 S	NZ		AC		PO		C

i.e. FL = 93H

Example 3 : If inputs are AX = FFFFH,   BX = FFFFH Then output  AX = 0000H,	BX = FFFFH,   FX = F046H, D7	D6	D5	D4	D3	D2	D1	D0 0	1	0	0	0	1	1	0 NS	Z		NAC		PE		NC

i.e. FL = 46H

Program 3 Memory location	Op-code & operand	Mnemonics 0000:0100	B8 00  00	MOV AX,0000H 0000:0103	9F	LAHF 0000:0104	CD A5	INT A5 Result after execution of above program AX = 0200H,	  FX = F002H, D7	D6	D5	D4	D3	D2	D1	D0 0	0	0	0	0	0	1	0 NS	NZ		NAC		PO		NC i.e. FL = 02H

Example 2 : If inputs are AX = FFFFH, Then output AX = 02FFH,	   FX = F002H, D7	D6	D5	D4	D3	D2	D1	D0 0	0	0	0	0	0	1	0 NS	NZ		NAC		PO		NC i.e. FL = 02H

Example 3 : If inputs are AX =1234H, Then output AX = 0234H,	  FX = F002H, D7	D6	D5	D4	D3	D2	D1	D0 0	0	0	0	0	0	1	0 NS	NZ		NAC		PO		NC i.e. FL = 02H

Program 4 Memory location	Op-code & operand	Mnemonics 0000:0100	B8 00  00	MOV AX,0000H 0000:0103	9E	SAHF 0000:0104	CD A5	INT A5 Result after execution of above program AX = 0000H,	  FX = F002H, D7	D6	D5	D4	D3	D2	D1	D0 0	0	0	0	0	0	1	0 NS	NZ		NAC		PO		NC i.e. FL = 02H

Example 2 : If inputs are AX = FFFFH, Then output AX = FFFFH,	   FX = F0D7H, D7	D6	D5	D4	D3	D2	D1	D0 1	1	0	1	0	1	1	1 S	Z		AC		PE		C i.e. FL = D7H

Example 3 : If inputs are AX =1234H, Then output AX = 1234H,	  FX = F012H, D7	D6	D5	D4	D3	D2	D1	D0 0	0	0	1	0	0	1	0 NS	NZ		AC		PO		NC i.e. FL = 12H

Program 5 Memory location	Op-code & operand	Mnemonics 0000:0100	BB 00  00	MOV BX,0000H 0000:0103	B9 00  20	MOV CX,2000H 0000:0106	8E D3	MOV SS,BX 0000:0108	89 CC	MOV SP,CX 0000:010A	B8 FF  FF	MOV AX,FFFFH 0000:010D	9C	PUSHF 0000:010E	58	POP AX 0000:010F	CD A5	INT A5 Result after execution of above program AX = F002H,	BX = 0000H, CX = 2000H,  SP = 2000H,   FX = F002H, D7	D6	D5	D4	D3	D2	D1	D0 0	0	0	0	0	0	1	0 NS	NZ		NAC		PO		NC

i.e. FL = 02H

Example 2 : If 5B POP BX is used Then output BX = F002H,	   FX = F002H, D7	D6	D5	D4	D3	D2	D1	D0 0	0	0	0	0	0	1	0 NS	NZ		NAC		PO		NC

i.e. FL = 02H

Example 3 : If 59 POP CX is used Then output  CX = F002H,	   FX = F002H, D7	D6	D5	D4	D3	D2	D1	D0 0	0	0	0	0	0	1	0 NS	NZ		NAC		PO		NC

i.e. FL = 02H

Program 6 Memory location	Op-code & operand	Mnemonics 0000:0100	BB 00  00	MOV BX,0000H 0000:0103	B9 00  20	MOV CX,2000H 0000:0106	8E D3	MOV SS,BX 0000:0108	89 CC	MOV SP,CX 0000:010A	B8 FF  FF	MOV AX,FFFFH 0000:010D	50	PUSH AX 0000:010E	9D	POPF 0000:010F	CD A5	INT A5 Result after execution of above program AX = FFFFH,	BX = 0000H, CX = 2000H,  SP = 2000H,   FX = FED7H, D7	D6	D5	D4	D3	D2	D1	D0 1	1	0	1	0	1	1	1 S	Z		AC		PE		C

i.e. FL = D7H

Example 2 : If inputs are AX = 0000H, Then output AX = 0000H,	   FX = F002H, D7	D6	D5	D4	D3	D2	D1	D0 0	0	0	0	0	0	1	0 NS	NZ		NAC		PO		NC

i.e. FL = 02H

Example 3 : If inputs are AX = 1234H, Then output  AX = 1234H,	   FX = F216H, D7	D6	D5	D4	D3	D2	D1	D0 0	0	0	0	0	1	1	0 NS	NZ		NAC		PE		NC

i.e. FL = 16H

Conclusion : The above program and other number of program execution results explain that, after the execution of arithmetic, logical instructions on 8086 microprocessor kit, the flag bits D0,D2,D4,D6 & D7 are changes according to result. But the comparison between LAHF and SAHF instruction, in SAHF execution AH not observed at FL, similarly the comparison between POPF and another POP instruction like POP AX, POP BX etc, in program 6, POPF do not changes accordingly.