Sei sulla pagina 1di 21

Experiment No: …………….

Date: ……. /……. /…………… 1151EC303 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 1

4.PROGRAMS FOR ALU OPERATIONS (8086)


A) 16-BIT DATA ADDITION-8086
Aim:
To write a program to add two 16-bit numbers using 8086.
.

Equipment and Components Required:

8086 Microprocessor kit, Power Supply

Algorithm:

 Start the program.

 Initialize the memory locations with input data.

 Load the values from memory location to the registers..

 Add the two values stored in the registers.

 If carry occurs (CF=1) increment the carry storing register and store the sum and

carry in the memory location. Otherwise store the sum in the memory location.

VTU R 2015 Department of ECE Veltech Dr. RR & Dr. SR University


Experiment No: …………….
Date: ……. /……. /…………… 1151EC303 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 2

Flow chart:

Start

Clear CL Register

Get the content of


1100H &1101H in AX

Get the content of


1102H &1103H in BX

Perform Addition
[AX]=[AX]+[BX]

NO
Is
CF=1 ?

YES

Increment CL
Register

Store the Content of


CL register to 1106H

Store the Result


[1104]=[AL],[1105]=[AH]

End

VTU R 2015 Department of ECE Veltech Dr. RR & Dr. SR University


Experiment No: …………….
Date: ……. /……. /…………… 1151EC303 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 3

BYTE MACHINE T- EXECUTION


ADDRESS LABEL MNEMONICS OPERAND OPCODE COMMENTS
S CYCLES STATES TIME
1000 START MOV CL,00H
1001
1002
MOV AX, [1100]
1003
1004
1005
1006 MOV BX, [1102]
1007
1008 ADD AX, BX
1009
100A JNC L1
100B
100C INC CL
100D
100E L1 MOV [1104], AX
100F
1010
1011 MOV [1106], CL
1012
1013 HLT

VTU R 2015 Department of ECE Veltech Dr. RR & Dr. SR University


Experiment No: …………….
Date: ……. /……. /…………… 1151EC303 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 4

Observation:

INPUT OUTPUT
ADDRESS 1100 1101 1102 1103 1104 1105 1106 1107
DATA1
DATA2

Conclusion:

Thus the 16 bit numbers stored in memory location are added and the result stored in
another memory location using 8086p kits.

………………………………………………………………………………………………………………………………………..

VTU R 2015 Department of ECE Veltech Dr. RR & Dr. SR University


Experiment No: …………….
Date: ……. /……. /…………… 1151EC303 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 5

Questions:

1. What are the features of 8086 Microprocessor?

2. What is the function of accumulator?

3. What are the different types of flags available in 8086 microprocessor?

4. List the general purpose registers in 8086?

5. What type of architecture used in 8086 microprocessor?

VTU R 2015 Department of ECE Veltech Dr. RR & Dr. SR University


Experiment No: …………….
Date: ……. /……. /…………… 1151EC303 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 6

B) 16-BIT DATA SUBTRACTION-8086


Aim:
To write a program to subtract two 16-bit numbers using 8086.
.

Equipment and Components Required:

8086 Microprocessor kit, Power Supply

Algorithm:

 Start the program.

 Initialize the memory locations with input data.

 Load the values from memory location to the registers..

 Subtract the two values stored in the registers.

 If carry occurs (CF=1) increment the carry storing register and store the difference

and borrow in the memory location. Otherwise store the difference in the memory

location.

VTU R 2015 Department of ECE Veltech Dr. RR & Dr. SR University


Experiment No: …………….
Date: ……. /……. /…………… 1151EC303 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 7

Flow chart:

Start

Clear CL Register

Get the content of


1100H &1101H in AX

Get the content of


1102H &1103H in BX

Perform Subtraction
[AX]=[AX]-[BX]

NO
Is
CF=1 ?

YES

Increment CL
Register

Store the Content of


CL register to 1106H

Store the Result


[1104]=[AL],[1105]=[AH]

End

VTU R 2015 Department of ECE Veltech Dr. RR & Dr. SR University


Experiment No: …………….
Date: ……. /……. /…………… 1151EC303 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 8

MACHINE T- EXECUTION
ADDRESS LABEL MNEMONICS OPERAND OPCODE BYTES COMMENTS
CYCLES STATES TIME
1000 START MOV CL,00H
1001
1002
MOV AX, [1100]
1003
1004
1005
1006 MOV BX, [1102]
1007
1008 SUB AX, BX
1009
100A JNC L1
100B
100C INC CL
100D
100E L1 MOV [1104], AX
100F
1010
1011 MOV [1106], CL
1012
1013 HLT

VTU R 2015 Department of ECE Veltech Dr. RR & Dr. SR University


Experiment No: …………….
Date: ……. /……. /…………… 1151EC303 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 9

Observation:

INPUT OUTPUT
ADDRESS 1100 1101 1102 1103 1104 1105 1106 1107
DATA1
DATA2

Conclusion:

Thus the 16 bit numbers stored in memory location are subtracted and the result stored
in another memory location using 8086p kits.

………………………………………………………………………………………………………………………………………..

VTU R 2015 Department of ECE Veltech Dr. RR & Dr. SR University


Experiment No: …………….
Date: ……. /……. /…………… 1151EC303 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 10

Questions:

1. What are the two types of conditional jumps?

2. Write short notes on Pointers and Index Group of Registers?

3. List the types of interrupts.

4. What happens when interrupt occurs?

5. Compare 8086 and 8088.

VTU R 2015 Department of ECE Veltech Dr. RR & Dr. SR University


Experiment No: …………….
Date: ……. /……. /…………… 1151EC303 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 11

D) 16-BIT DATA MULTIPLICATION-8086


Aim:
To write a program to perform multiplication of two 16 bit number using 8086.

Equipment and Components Required:

8086 Microprocessor kit, Power supply.

Algorithm:

 Start the program.

 Initialize the memory locations with multiplier and multiplicand.

 Load the values from memory locations to the registers..

 Multiply the two 16 bit data stored in the registers.

 Store the product in the memory location.

VTU R 2015 Department of ECE Veltech Dr. RR & Dr. SR University


Experiment No: …………….
Date: ……. /……. /…………… 1151EC303 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 12

Flow chart:

Start

Clear CL register

Store the Data1 in


AX register

Store the Data2 in


BX register

Perform
Multiplication
[AX]=[AX]*[BX]]
[DX]=R[[DX][AX]/[BX]]
Store the results in
to memory

End

VTU R 2015 Department of ECE Veltech Dr. RR & Dr. SR University


Experiment No: …………….
Date: ……. /……. /…………… 1151EC303 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 13

ADDRESS/ MACHINE EXECUTION COMMENTS


LABEL MNEMONICS OPERAND OPCODE BYTES T-STATES
LABEL CYCLES TIME
1000 START MOV CL, 00H
1001
1002
MOV AX, [1100]
1003
1004
1005
1006 MOV BX, [1102]
1007
1008 MUL BX

1009
100A MOV [1104], AX
100B
100C
100D MOV [1106], DX
100E
1010 HLT

VTU R 2015 Department of ECE Veltech Dr. RR & Dr. SR University


Experiment No: …………….
Date: ……. /……. /…………… 1151EC303 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 14

Observation:

INPUT OUTPUT
ADDRESS 1100 1101 1102 1103 1104 1105 1106 1107
DATA1
DATA2

Conclusion:

Thus the 16 bit numbers stored in memory location are multiplied and the result stored in
another memory location using 8086p kits.

………………………………………………………………………………………………………………………………………..

VTU R 2015 Department of ECE Veltech Dr. RR & Dr. SR University


Experiment No: …………….
Date: ……. /……. /…………… 1151EC303 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 15

Questions:

1. List the various logical operations performed by the 8086?

2. How will you perform multiplication without using the MUL instruction?

3. What are the various jump instructions available in 8086 instruction set?

4. Write short notes on zero flag.

5. Define Program Counter.

VTU R 2015 Department of ECE Veltech Dr. RR & Dr. SR University


Experiment No: …………….
Date: ……. /……. /…………… 1151EC303 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 16

E) 32-BIT DATA DIVISION-8086


Aim:
To write a program to perform division of a 32 bit number by a 16 bit number using 8086.

Equipment and Components Required:

8086 Microprocessor kit, Power Supply

Algorithm:

 Start the program.

 Initialize the memory locations with divider and dividend.

 Load the values from memory locations to the registers..

 Divide the 32 bit data stored in the registers by the 16 bit data stored in the GP

register.

 Store the quotient and reminder in the memory location.

VTU R 2015 Department of ECE Veltech Dr. RR & Dr. SR University


Experiment No: …………….
Date: ……. /……. /…………… 1151EC303 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 17

Flow chart:

Start

Store the lower word


of Dividend in AX

Store the Higher word


of Dividend in DX

Store the Divider in BX

Perform Division
[AX]=Q[[DX][AX]/[BX]]
[DX]=R[[DX][AX]/[BX]]

Store the results in


to memory

End

VTU R 2015 Department of ECE Veltech Dr. RR & Dr. SR University


Experiment No: …………….
Date: ……. /……. /…………… 1151EC303 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 18

ADDRESS/ MACHINE EXECUTION COMMENTS


LABEL MNEMONICS OPERAND OPCODE BYTES T-STATES
LABEL CYCLES TIME
1000
1001 START MOV AX, [1100]
1002
1003
MOV DX, [1102]
1004
1005
1006
1007 MOV BX, [1104]
1008
1009 DIV BX

100A
100B MOV [1106], AX
100C
100D
100E MOV [1108], DX
1010
1011 HLT

VTU R 2015 Department of ECE Veltech Dr. RR & Dr. SR University


Experiment No: …………….
Date: ……. /……. /…………… 1151EC303 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 19

Observation:

INPUT OUTPUT
ADDRESS 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109
DATA1
DATA2

Conclusion:

Thus the 16 bit numbers stored in memory location are divided and the result stored
in another memory location using 8086p kits.

……………………………………………………………………………………………………………………………………
…..

VTU R 2015 Department of ECE Veltech Dr. RR & Dr. SR


University
Experiment No: …………….
Date: ……. /……. /…………… 1151EC303 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 20

Questions:

1. Write short notes on parity flag.

2. List the general purpose registers in 8086?

3. What type of architecture used in 8086 microprocessor?

4. What are the various addressing modes of 8086?

5. Draw the Flag register of 8086.

VTU R 2015 Department of ECE Veltech Dr. RR & Dr. SR


University
Experiment No: …………….
Date: ……. /……. /…………… 1151EC303 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 21

Lab Exercises:

1. Write an Assembly language program to perform 8-bit addition, subtraction,


multiplication and division using 8086.

2. Write an Assembly language program to add two 32 bit numbers stored as


double words in 8 consecutive memory locations are to be added and the result
stored as a double word in memory using 8086.

3. Write an Assembly language program to convert the number FFFFH to its


decimal equivalent and store the result in memory using 8086.

4. Write an Assembly language program to perform multiplication and division by


powers of 2 using the arithmetic shift instructions using 8086.

5. Write an Assembly language program to perform XOR operation on a 16 bit hexa


decimal number using 8086.

6. Write an Assembly language program to perform NAND operation on a 16 bit


hexa decimal number using 8086.

VTU R 2015 Department of ECE Veltech Dr. RR & Dr. SR


University

Potrebbero piacerti anche