microprocessor presentation 8086 flags

RaihanKhan79 9 views 8 slides Aug 08, 2024
Slide 1
Slide 1 of 8
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8

About This Presentation

lab of microprocessor


Slide Content

Lab-06 Introduction to 8086 flags and addressing modes, and control transfer instructions

2 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 OF DF IF TF SF ZF AF PF CF Carry Flag This flag is set, when there is a carry out of MSB in case of addition or a borrow in case of subtraction. Parity Flag This is even parity flag. When result has even number of 1, it will be set to 1, otherwise 0 for odd number of 1s Auxiliary Carry Flag This flag is set, when there is a carry out of low-nibble in case of addition or a borrow in case of subtraction Zero Flag This flag is set, if the result of the computation or comparison performed by an instruction is zero Sign Flag After any operation if the MSB is 1, then it indicates that the number is negative. And this flag is set to 1 Trap Flag If this flag is set, the processor enters the single step execution mode by generating internal interrupts after the execution of each instruction Interrupt Flag Causes the 8086 to recognize external mask interrupts; clearing IF disables these interrupts. Direction Flag This is used by string manipulation instructions. If this flag bit is ‘0’, the string is processed beginning from the lowest address to the highest address, i.e., auto incrementing mode. Otherwise, the string is processed from the highest address towards the lowest address, i.e., auto decrementing mode. Over flow Flag The overflow flag is set to 1 when the result of a signed operation is too large to fit. Flag Register

Addressing Modes 3 8086 Microprocessor Every instruction of a program has to operate on a data. The different ways in which a source operand is denoted in an instruction are known as addressing modes. Register Addressing Immediate Addressing Direct Addressing Register Indirect Addressing Based Addressing Indexed Addressing Based Index Addressing String Addressing Direct I/O port Addressing 10. Indirect I/O port Addressing 11. Relative Addressing 12. Implied Addressing

6. Control Transfer Instructions Instruction Set 4 8086 Microprocessor Mnemonics Explanation JC disp8 Jump if CF = 1 JNC disp8 Jump if CF = 0 JP disp8 Jump if PF = 1 JNP disp8 Jump if PF = JO disp8 Jump if OF = 1 JNO disp8 Jump if OF = 0 JS disp8 Jump if SF = 1 JNS disp8 Jump if SF = 0 JZ disp8 Jump if result is zero, i.e , Z = 1 JNZ disp8 Jump if result is not zero, i.e , Z = 1 8086 conditional branch instructions affecting individual flags

Checking Different Registers & Flags 5 Mnemonics Machine Codes AX BX CX DX Set Flags MOV AX, 805EH B8, 5E, 80 MOV DX, 0540H BA, 40, 05 MOV CL, 02H B1, 02 MOV CH, 91H B5, 91 ADD AX, DX 03, C2 MOV BX, 0050H BB, 50, 00 SUB AX, BX 2B, C3 INC DL FE, C2 DEC BX 4B XCHG CX, BX 87, CB HLT F4

Understanding Overflow and Carry Flags 6 Mnemonics Machine Code OF CF Comment MOV AX, 805EH B8, 5E, 80 - ve number MOV DX, 8040H BA, 40, 80 - ve number ADD AX, DX 03, C2 + ve number MOV AX, 505EH B8, 5E, 50 + ve number MOV DX, 5040H BA, 40, 50 + ve number ADD AX, DX 03, C2 - ve number MOV AX, 805EH B8, 5E, 80 - ve number MOV DX, 5040H BA, 40, 50 + ve number ADD AX, DX 03, C2 - ve number

Understanding Addressing Modes 7 Mnemonics Machine Code Check Contents Comments on Addressing Mode MOV AX, 0001H B8, 01, 00 MOV DS, AX 8E, D8 MOV BX, 2000H BB, 00, 20 MOV AX, [1FFEH] A1, FE, 1F AX = ? MOV CH, [BX] 8A, 2F CH=? MOV CL, [BX+01H] 8A, 4F, 01 CL=? MOV SI, BX 8B, F3 MOV CX, [SI+02H] 8B, 4C, 02 CX=? MOV DX, [BX+SI+08H] 8B, 50, 08 DX=? CF=? UP: CMC F5 CF=? JC UP 72, FD HLT F4 Memory Data 0001:1FFE 01 1FFF 02 2000 03 2001 04 2002 05 2003 06 0001:4008 07 0001: 4009 08

MOV AX, 0001H MOV DX, 0000H MOV CX, 0008H NEXT: MUL CX LOOP NEXT HLT TEST: Write a program to calculate 8!.
Tags