You are on page 1of 11

Microprocessor & Microcontroller

Experiment No.02
Aim: Write and execute 8086 program

A) To find smallest byte from a block of 10 bytes present in DMS.

B) To find largest byte from a block of 10 bytes present in DMS.

and verify using Trainer kit and MASM.

Department of Electronics & Telecommunication Engineering, S.B.J.I.T.M.R, Nagpur


Microprocessor & Microcontroller
AIM: Write and execute 8086 program

A) To find smallest byte from a block of 10 bytes present in DMS.

B) To find largest byte from a block of 10 bytes present in DMS.

and verify using Trainer kit and MASM.

OBJECTIVE/EXPECTED LEARNING:
The objective and expected learning outcomes of this practical are
 The student will be able to analyze, specify, design, write and test assembly
language programs of moderate complexity.

 Troubleshoot interactions between software and hardware.

APPARATUS:

Sr. Name of Apparatus Quantity


No.

1 Trainer kit 1

2 Keyboard 1

3 Power supply 1

4 MASM (Microsoft -
Assembler)

ALGORITHM:
a. SMALLEST NUMBER

1. Initialize the memory segment and Store ten numbers in data memory segment.

2. Initialize counter in register CL.

3. Copy first data from source memory location into register AL.

4. Increment the source memory pointer.

Department of Electronics & Telecommunication Engineering, S.B.J.I.T.M.R, Nagpur


Microprocessor & Microcontroller
5. Compare the data of source memory location with the contents of AL.

6. If CF = 1 then go to step 8.

7. If CF = 0 then copy the content of Source memory location into AL.

8. Decrement the counter.

9. If ZF not equal to zero then go back to step 4.

10. If ZF equals to zero then store the result into memory.

b. LARGEST NUMBER

1. Initialize the memory segment and Store ten numbers in data memory segment.

2. Initialize counter in register CL.

3. Copy first data from source memory location into register AL.

4. Increment the source memory pointer.

5. Compare the data of source memory location with the contents of AL.

6. If CF = 0 then go to step 8.

7. If CF = 1 then copy the content of Source memory location into AL.

8. Decrement the counter.

9. If ZF not equal to zero then go back to step 4.

10. If ZF equals to zero then store the result into memory.

PROGRAM:

a. Using MASM

A) To find smallest byte from a block of 10 bytes present in DMS.


ASSUME CS:CODE, DS:DATA

Department of Electronics & Telecommunication Engineering, S.B.J.I.T.M.R, Nagpur


Microprocessor & Microcontroller
DATA SEGMENT
NUM DB 01H,05H,06H,07H,08H,02H,09H,04H,03H,10H
COUNT EQU 09H

RESULT DB 01H DUP (?)


DATA ENDS
CODE SEGMENT
START: MOV AX,DATA
MOV DS,AX
MOV SI,OFFSET NUM

MOV CL,COUNT
MOV AL,[SI]
UP: INC SI
CMP AL,[SI]
JC L1
MOV AL,[SI]

L1: DEC CL
JNZ UP
MOV SI,OFFSET RESULT
MOV [SI],AL
MOV AH,4CH
INT 21H

CODE ENDS
END START

B) To find largest byte from a block of 10 bytes present in DMS.


ASSUME CS:CODE, DS:DATA

DATA SEGMENT
NUM DB 01H,05H,06H,07H,08H,02H,09H,04H,03H,10H
COUNT EQU 09H

Department of Electronics & Telecommunication Engineering, S.B.J.I.T.M.R, Nagpur


Microprocessor & Microcontroller
RESULT DB 01H DUP (?)
DATA ENDS
CODE SEGMENT
START: MOV AX,DATA

MOV DS,AX
MOV SI,OFFSET NUM

MOV CL,COUNT
MOV AL,[SI]
UP: INC SI

CMP AL,[SI]
JNC L1
MOV AL,[SI]
L1: DEC CL

JNZ UP
MOV SI,OFFSET RESULT
MOV [SI],AL

MOV AH,4CH
INT 21H
CODE ENDS
END START

b.Using Trainer Kit

ADDRESS OPCODE LABEL MNEMONICS OPERAND COMMENT

Department of Electronics & Telecommunication Engineering, S.B.J.I.T.M.R, Nagpur


Microprocessor & Microcontroller

Result: Program is executed and verified.

CONCLUSION:

DISCUSSION & VIVA QUESTIONS:

1. Write an assembly language for multiplying two 8 bit numbers by using 8085 micro
processor kit.

2. Write an assembly language program for dividing two 8 bit numbers using
microprocessor kit.

3. Write and execute 8086 program to add 10 bytes present at 2000H Store the result
after data

REFERENCES:

 Book on Microprocessor & Microcontroller By Douglas Hall, Tata McGraw Hill


Education.

 https://en.wikipedia.org/wiki/Intel_8086

 “Advanced Microprocessors and Peripherals”, A. K. Ray , K. M. Bhurchandi

Department of Electronics & Telecommunication Engineering, S.B.J.I.T.M.R, Nagpur


Microprocessor & Microcontroller

AIM: Write and execute 8086 program

A) To find smallest byte from a block of 10 bytes present in DMS.


B) To find largest byte from a block of 10 bytes present in DMS.
and verify using Trainer kit and MASM.

OBJECTIVE/EXPECTED LEARNING:
The objective and expected learning outcomes of this practical are
 The student will be able to analyze, specify, design, write and test assembly
language programs of moderate complexity.

 Troubleshoot interactions between software and hardware.

APPARATUS:

Sr. Name of Apparatus Quantity


No.

1 Trainer kit 1

2 Keyboard 1

3 Power supply 1

4 MASM (Microsoft -
Assembler)

FLOWCHART:

Department of Electronics & Telecommunication Engineering, S.B.J.I.T.M.R, Nagpur


Microprocessor & Microcontroller

OUTPUT:

a. TRAINER KIT

A. SMALLEST BYTE OUTPUT


ADDRESS DATA BEFORE DATA AFTER
EXECUTION EXECUTION
0100 55

0101 65

0102 98

0103 2A

0104 4F

0105 64

0106 5D

0107 36

0108 FF

0109 62

010A 34

A. LARGEST BYTE OUTPUT


ADDRESS DATA BEFORE DATA AFTER
EXECUTION EXECUTION
0100 55
0101 65
0102 98
0103 2A
0104 4F
Department of Electronics & Telecommunication Engineering, S.B.J.I.T.M.R, Nagpur
Microprocessor & Microcontroller

0105 64
0106 5D
0107 36
0108 FF
0109 62
010A 34

b.MASM Output

A) To find smallest byte from a block of 10 bytes present in DMS.

B) To find largest byte from a block of 10 bytes present in DMS.

Department of Electronics & Telecommunication Engineering, S.B.J.I.T.M.R, Nagpur


Microprocessor & Microcontroller

Department of Electronics & Telecommunication Engineering, S.B.J.I.T.M.R, Nagpur

You might also like