0% found this document useful (0 votes)
6 views90 pages

Assignment (102103539 540)

This report details a lab assignment focused on microprocessor-based systems design using the 8085 and 8086 microprocessors. It includes various experiments that involve programming tasks such as data storage, arithmetic operations, and data transfer using assembly language. The report serves as an educational resource for understanding the architecture and functionality of the 8085 microprocessor kit.

Uploaded by

saraosukham
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views90 pages

Assignment (102103539 540)

This report details a lab assignment focused on microprocessor-based systems design using the 8085 and 8086 microprocessors. It includes various experiments that involve programming tasks such as data storage, arithmetic operations, and data transfer using assembly language. The report serves as an educational resource for understanding the architecture and functionality of the 8085 microprocessor kit.

Uploaded by

saraosukham
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 90

A PRACTICAL ACTIVITY BASED REPORT ON

MICROPROCESSOR-BASED SYSTEMS DESIGN (UCS617)


LAB ASSIGNMENT (8085 + 8086 )

Submitted by:

Name of Student Roll No.


Sukham 102103539

Aneet 102103540

Submitted to:

Dr. Anju Bala

THAPAR INSTITUTE OF ENGINEERING AND TECHNOLOGY


(DEEMED TO BE UNIVERSITY)
PATIALA, PUNJAB, INDIA
Jan-May 2024
CONTENTS

Sr. Experiment Page


No. No.

1 Introduction of 8085-microprocessor kit and steps for execution on the kit. 4-8
4-8
2 Familiarity with 8085-microprocessor kit. 9-246

2.1 Write a program to store 8-bit data into one register and then copy that to all
registers.

2.2 Write a program for addition of two 8-bit numbers.

2.3 Write a program to add 8-bit numbers using direct and indirect addressing
mode.

2.4 Write a program to add 16-bit numbers using direct and indirect addressing
mode.

2.5 Write a program to 8-bit numbers using carry. (using JNC instruction).

2.6 Write a program to find 1’s complement and 2’s complement of 8-bit
number.

3 Write a program for the sum of series of numbers. 24-26


27
4 Write a program for data transfer from memory block B1 to memory block 27-39
28-39
B2.

5 Write a program for multiply two 8-bit numbers. 39-42

6 Write a program to add ten 8-bit numbers. Assume the numbers are stored 43-45
in 8500-8509. Store the result in 850A and 850B memory address.

7 Write a program to find the negative numbers in a block of data. 46-47

8 Write a program to count the number of one's in a number. 48-49

9 Write a program to arrange numbers in Ascending order. 50-52

10 Calculate the sum of series of even numbers. 55-56

11 Write an assembly language program to verify how many bytes are present 57-59
in a given set, which resembles 10101101 in 8085.

2
12 Write an assembly language program to find the numbers of even parity in 60-62
ten consecutive memory locations in 8085.

13 Write an assembly language program to convert a BCD number into its 63-64
equivalent binary in 8085.

14 Write an assembly language program for exchange the contents of memory 65-66
location.

15 Write a program to find the largest number in an array of 10 elements. 66-67

3
EXPERIMENT-1

AIM- Introduction of 8085-microprocessor kit and steps for execution on the kit.
THEORY-

1. Introduction:

The 8085 microprocessor kit serves as an essential educational resource for grasping the foundational
concepts of digital electronics and microprocessor programming. It consists of a basic hardware setup
equipped with the 8085 CPU, memory, input/output (I/O) devices, and debugging utilities. This lab
session aims to offer a thorough introduction to the kit's fundamentals and the necessary steps for
running programs on it.

Fig 1.1 Intel 8085 Block Diagram

2. Intel 8085 Architecture:

1. Register Array:

● Acts as a storage space for temporary data and intermediate results during program
execution.
● Comprises eight 8-bit general-purpose registers: A, B, C, D, E, H, L, and F.
● Includes two 16-bit registers: PC (Program Counter) and SP (Stack Pointer).

4
● A register is used for performing arithmetic and logical operations.
● The Stack Pointer manages data storage and retrieval on the stack.

2. Arithmetic Logic Unit and Logical Group:

● Performs mathematical computations like addition and subtraction, as well as logical


operations such as AND, OR, and NOT on data.
● Operates with 8-bit data for its actions.
● Capable of altering individual bits within registers.
● Includes components like the instruction decoder, machine cycle encoder, and timing
and control circuitry.

3.Instruction Decoder and Machine Cycle Encoder, Timing and Control


Circuitry

● Interprets instructions fetched from memory to determine the specific operation to be


performed.
● Generates time signals to govern data flow and synchronise multiple devices.
● Manages the different phases of the fetch-decode-execute cycle.

4. Control Group for Interruptions:

● Handles external events that disrupt the ongoing program execution.


● Organizes and manages interruptions based on their priority.
● Preserves the current program state and transitions to the corresponding interrupt
service function.

5. Group responsible for controlling serial input/output (I/O).

● Enables the exchange of information with external devices via serial data
transmission, transferring data one bit at a time.
● Provides precise timing signals and control logic for executing serial communication
protocols.
● Used for establishing connections with peripherals like modems, printers, or sensors..

5
3. Instruction set for the 8085 microprocessor:

The 8085 microprocessor utilizes assembly language for programming, consisting of mnemonic
codes that convey precise instructions. These instructions can be categorised into several types,
including arithmetic, logical, data transfer, and control flow operations.

4. Buttons of microprocessor simulator:

1. Reset: Clears the internal state of the 8085 microprocessor, restoring it to its original
condition. This action resets all registers, flags, and program execution.
2. Previous: Depending on the specific kit model, these buttons may have two functions. They
either shift the selection one address backward or forward in memory or register investigation
mode. During program entry, they allow selecting the previous opcode (in some kits, labeled
as "Next" for both choices).
3. Next: Advances the selection by one address in memory or register investigation mode.
4. Go:Initiates the retrieval and execution of instructions by the microprocessor from the
designated memory location.
5. Exm Mem: Activates memory inspection mode, enabling the user to observe and alter data
stored in memory regions.
6. Exm Reg: Activates the register examination mode, enabling the user to observe the
contents of the internal registers of the 8085.
7. Executive: Depending on the specific kit model, this button may have two functions. It either
initiates program execution similar to the "Go" command on certain kits or combines program
execution with memory allocation, filling any unused memory regions once the program has
finished running.
8. Kbint: Facilitates inputting data through the keyboard. The kit may allow inputting data or
commands directly via the keyboard, depending on its specifications. It enables engaging with
the program while it is running by supplying input values or control signals.

6
Fig 1.2 Flags in the 8085 Microprocessor Kit

5. Flags in the 8085 Microprocessor Kit

Flags are integral to the operations of the 8085 microprocessor, serving as small indicators that reflect
the results of arithmetic and logical operations. Each flag contains a single bit of information, which
can be either 0 or 1, representing specific conditions:

1. Carry Flag (CY):

● Indicates an overflow during addition or a borrow during subtraction.


● Set to 1 if the result of an operation exceeds the capacity of the 8-bit register, causing a "carry
over" to the next higher register.
● Used for conditional jumps and arithmetic operations involving multiple bytes.

2. Auxiliary Carry Flag (AC):

● Assists in detecting carries or borrows during addition or subtraction involving the 3rd and
4th bits of the operands.
● Set to 1 if there is a carry from the 3rd bit to the 4th bit during addition, or a borrow from the
4th bit to the 3rd bit during subtraction.
● Useful for multi-byte arithmetic operations and Binary-Coded Decimal (BCD) calculations..

3. Zero Flag (Z):

● Indicates whether the result of the last operation is zero.


● Set to 1 if the result in the accumulator register is 0.

7
● Used for conditional jumps and checking if an operation successfully cleared the accumulator.
4. Parity Flag (P):

● Indicates the evenness of the number of 1 bits in the result of the last operation.
● Set to 1 if the result has an even number of 1 bits (even parity).
● Used for error checking during data transmission and communication protocols.

5. Sign Flag (S):

● Indicates the sign of the result of the last operation.


● Set to 1 if the result in the accumulator is negative (most significant bit is 1).
● Used for conditional jumps and determining the positive/negative nature of numbers.

6. Steps of execution on the intel kit as well as on simulator

1. Press Reset
2. Press Examine Memory
3. Enter starting address
4. Press Next
5. Enter opcodes by subsequently pressing Next
6. Press Reset
7. Press Go
8. Enter starting address of the program to compile
9. Press EXEC/FILL
10. Press Reset
11. Press Examine Memory
12. Enter Output Address
13. Press Next

8
EXPERIMENT-2

2. Familiarity with 8085-microprocessor kit.


i) AIM- Write a program to store 8-bit data into one register and then copy that to all registers.
Code Memory Location Opcode
MVI A,48 8000,8001 3E,48
MOV B,A 8002 47
MOV C,A 8003 4F
MOV D,A 8004 57
MOV E,A 8005 5F
MOV H,A 8006 67
MOV L,A 8007 6F
RST 5 8008 EF

Table 2.1

Output- A – 48, B – 48, C – 48, D – 48, E – 48, H – 48, L – 48

Fig 2.1
Fig 2.1.1

9
Fig 2.1.2

Fig 2.1.3

Fig 2.1.4
10
Fig 2.1.5

Fig 2.1.6

Fig 2.1.7

11
Fig 2.1.8

Fig 2.1.9

12

Fig 2.1.10
ii) AIM- Write a program for addition of two 8-bit numbers.

Code Memory Location Opcode


MVI A,48 8000,8001 3E,48
MVI B,48 8002,8003 06,48
ADD B 8004 80
STA 8500 8005,8006,8007 32,00,85
RST 5 8008 EF
Table 2.2

Output- [ 8500 ] – 90

Fig 2.2.1

13
Fig 2.2.2

iii) AIM- Write a program to add 8-bit numbers using direct and indirect addressing mode.
Code Memory Location Opcode
LDA 8500 8000,8001,8002 3A,00,85
MOV B,A 8003 47
LDA 8501 8004,8005,8006 3A,01,85
ADD B 8007 80
STA 8502 8008,8009,800A 32,02,85
RST 5 800B EF

Table 2.3.1

Input – [ 8500 ] – 88, [ 8501 ] – 88


Output – [ 8502 ] – 10

14
Fig 2.3.1

Fig 2.3.2

Code Memory Location Opcode


LXI H,8500 8000,8001,8002 21,00,85
MOV A,M 8003 7E
INX H 8004 23

15
ADD M 8005 86
INX H 8006 23
MOV M,A 8007 77
RST 5 8008 EF

Table 2.3.2

Input – [ 8500 ] – 88, [ 8501 ] – 88


Output – A – 10

Fig 2.3.2

16
Fig 2.3.3

17
Fig 2.3.4

iv) AIM- Write a program to add 16-bit numbers using direct and indirect addressing mode.

Code Memory Location Opcode


LHLD 8500 8000,8001,8002 2A,00,85
XCHG 8003 EB
LHLD 8502 8004,8005,8006 2A,02,85
DAD D 8007 19
SHLD 8504 8008,8009,800A 22,04,85
RST 5 800B EF

Table 2.4.1

18
Input - [ 8500 ] – 48, [ 8501 ] – 48, [8502 ] – 48, [ 8503 ] – 48

Output - [ 8504 ] – 90, [ 8505 ] – 90

Fig 2.4.1

Fig 2.4.2

19
Fig 2.4.3

Code Memory Location Opcode


LXI B, 8500 8000,8001,8002 01,00,85
LDAX B 8003 0A
MOV D,A 8004 57
INX B 8005 03
LDAX B 8006 0A
ADD D 8007 82
STA 8504 8008,8009,800A 32,04,85
INX B 800B 03
LDAX B 800C 0A
MOV D,A 800D 57

20
INX B 800E 0A
LDAX B 800F 0A
ADC D 8010 8A
STA 8505 8011,8012,8013 32,05,85
RST 5 8014 EF
Table 2.4.2

Fig 2.4.4

Input - [ 8500 ] – 34, [ 8501 ] – 48,[ 8502 ] – 54, [ 8503 ] – 78

Output – [ 8504 ] – 7C [ 8505 ] – CC

21

Fig 2.4.5
Fig 2.4.6

v) AIM- Write a program to 8-bit numbers using carry. (using JNC instruction).

Code Memory Location Opcode


MVI C, 00 8000, 8001 0E, 00

LXI H, 8500 8002, 8003, 8004 21, 00, 85

MOV A, M 8005 7E

INX H 8006 23

ADD M 8007 86

JNC Next 8008, 8009, 800A D2, 0C, 80

INR C 800B 0C

Next: INX H 800C 23

MOV M, A 800D 77

INX H 800E 23

MOV M, C 800F 71

22
RST 5 8010 EF

Table 2.5

Input - [ 8500 ] – 88, [ 8501 ] – 88

Output - [ 8502 ] – 10, [ 8503 ] – 01

Fig 2.5.1

23
Fig 2.5.2

Fig 2.5.3

vi) AIM- Write a program to find 1’s complement and 2’s complement of 8-bit number

Code Memory Location Opcode

LDA 8500H 8000, 8001,8003 3A, 00, 85

CMA 8004 2F

24
STA 8501H 8005, 8006, 8007 32, 01, 85

RST 5 8008 EF

Table 2.6.1

Input - [ 8500 ] – 48
Output - [ 8501 ] – B7

Fig 2.6.1

Code Memory Location Opcode

LDA 8500H 8000, 8001,8003 3A, 00, 85

CMA 8004 2F

INR A 8005 3C

STA 8501H 8006, 8007, 8008 32, 01, 85

RST 5 8009 EF

Table 2.6.2
25
Input - [ 8500 ] – 48

Output - [ 8501 ] – B8

Fig 2.6.2

3. AIM- Write a program for the sum of series of numbers.

26
Code Memory Location Opcode

LDA 8500H 8000, 8001, 8002 3A, 00, 85

MOV C, A 8003 4F
SUB A 8004 97

LXI H, 8501H 8005, 8006, 8007 21, 01, 85


Back: ADD M 8008 86
INX H 8009 23

DCR C 800A 0D
JNZ Back 800B C2
STA 8600H 800C, 800D, 800E 32, 00, 86

RST 5 800F EF

Table 3

Input - [8500] – 04, [8501] – 9A, [8502] – 52, [8503] – 89, [8504] – 3E

Result – 1B3 Output - [8600] – B3

27
Fig 3
EXPERIMENT-4
Aim-Write a program for data transfer from memory block B1 to memory
block B2 .

code location opcode


MVI C 8000,8001 OE
LXI H 8002,8003,8004 21
LXI D 8005,8006,8007 11
MOV A, M 8008 7E
STA D 8009 12
INX H 800A 23
DCR C 800C OD
JNZ BACK 800D,800E,800F C2
RST 5 8010 EF

Input - [8500] – 01, [8501] – 02, [8502] – 03,……… [8509] – 0A


Output - [8600] – 01, [8601] – 02, [8602] – 03,……… [8609] – 0A

28
Fig
Fig 4.2
4.1

Fig 4.2
Fig 4.3

29
Fig 4.4
Fig 4.3

Fig 4.4
Fig 4.5

30
Fig 4.6
Fig 4.5

Fig 4.7
Fig 4.6

31
Fig 4.8
Fig 4.7

Fig4.9
Fig 4.8

32
Fig 4.10
Fig 4.9

Fig 4.11
Fig 4.10

33
FigFig
4.12
4.11

FigFig
4.13
4.12

34
Fig 4.14
Fig 4.13

Fig 4.15
Fig 4.14

35
Fig 4.16
Fig 4.15

Fig
Fig4.17
4.16

36
Fig 4.18
Fig 4.17

Fig 4.19
Fig 4.18

37
Fig 4.20
Fig 4.19

Fig 4.20
Fig 4.21

38
Fig 4.22
Fig 4.21

Fig 4.22
Fig 4.23

39
Experiment No 5:

Write a program for multiply two 8-bit numbers.

Input - [8500] – B2, [8501] – 03


Result – B2 + B2 + B2 = 0216 H
Output - [8600] – 16, [8601] – 02

Code Memory Location Opcode

LDA 8500H 8000, 8001, 8002 3A, 00, 85

MOV E, A 8003 7B

MVI D, 00 8004, 8005 16, 00

LDA 8501H 8006, 8007, 8008 3A, 01, 85

MOV C, A 8009 4F

LXI H, 0000H 800A, 800B, 800C 21, 00, 00

Back: DAD D 800D 09

DCR C 800E 0D

JNZ Back 800F, 8010, 8011 C2, 08, 80

40
Fig 5.1 Output at memory location 8600

Fig 5.2 Flag register output

41
Fig 5.3

42
Program No. 6: Write a program to add ten 8-bit numbers. Assume the
numbers are stored in 8500-8509. Store the result in 850A and 850B memory
address

Input - [8500] – FF, [8501] – 01, [8502] – 01, [8503] – 01, [8504] – 01, [8505] – 01, [8506] – 01, [8507] –
01, [8508] – 01, [8509] – 01

Output - [850A] – 08, [850B] – 01

Code Opcode Memory location Bytes


MVI C, 00 0E,00 8000,8001 2
MVI B, 09 06,09 8002,8003 2
LXI H, 21,00,85 8004,8005,8006 3
8500H
MOV A, M 7E 8007 1
Back: INX H 23 8008 1
ADD M 86 8009 1
JNC Next D2,0E,80 800A,800B,800C 3
INR C 0C 800D 1
Next: DCR B 05 800E 1
JNZ Back C2,08,80 800F,8010,8011 3
INX H 23 8012 1
MOV M, A 77 8013 1
INX H 23 8014 1
MOV M, C 71 8015 1
RST5 EF 8016 1

43
Fig 6.1

Fig 6.2

44
Fig 6.3

45
Experiment No. 7:
Write a program to find the negative numbers in a block of Code
data.
Input - [8500] – 04, [8501] – 56, [8502] – A9, [8503] – 73, [8504] – 82
Result = 02
Output - [8600] – 02

Code Opcode Memory location Bytes


LDA, 8500H 3A,00,85 8000,8001,8002 3
MOV C, A 4F 8003 1
MVI B, 00 06,00 8004,8005 2
LXI H, 8501H 21,01,85 8006,8007,8008 3
Back: MOV A, M 7E 8009 1
ANI 80H E6,80 8000A,800B 2
JZ Skip CA,10,80 800C,800D,800E 3
INR B 04 800F 1
Skip: INX H 23 8010 1
DCR C 0D 8011 1
JNZ Back C2,09,80 8012,8013,8014 3
MOV A, B 78 8015 1
STA 8600H 32,00,86 8016,8017,8018 3
RST 5 EF 8019 1

46
Fig 7.1

Fig 7.2

47
Experiment No. 8:
Write a program to count the number of one's in a number
Input - [8500] – 25 0010 0101
Output - [8600] – 03

Code Opcode Memory location Bytes


LDA, 8500H 3A,00,85 8000,8001,8002 3
MVI B, 08 06,08 8003,8004 2
MVI D, 00 16,00 8005,8006 2
Loop1: RLC 07 8007 1
JNC Loop2 D2,0C,80 8008,8009,800A 3
INR D 14 800B 1
Loop2: DCR 05 800C 1
B
JNZ Loop1 C2,07,80 800D,800E,800F 3
MOV A, D 7A 8010 1
STA 8600H 32,00,86 8011,8012,8013 3
RST 5 EF 8014 1

Fig 8.1

48
Fig 8.2

49
Experiment No. 9:
Write a program to arrange numbers in Ascending order.
Input - [8500] – 05, [8501] – 05, [8502] – 04, [8503] – 03, [8504] – 02, [8505] – 01
Output - [8500] – 05, [8501] – 01, [8502] – 02, [8503] – 03, [8504] – 04, [8505] – 05

Code Opcode Memory location Bytes


LXI H, 8500H 21,00,85 8000,8001,8002 3
MOV C, M 4E 8003 1
DCR C 0D 8004 1
Repeat: MOV D, C 51 8005 1
LXI H, 8501H 21,01,85 8006,8007,8008 3
Loop: MOV A, M 7E 8009 1
INX H 23 800A 1
CMP M BD 800B 1
JC Skip DA,14,80 800C,800D,800E 3
MOV B, M 46 800F 1
MOV M , A 77 8010 1
DCX H 2B 8011 1
MOV M, B 70 8012 1
INX H 23 8013 1
Skip: DCR D 15 8014 1
JNZ Loop C2,09,80 8015,8016,8017 3
DCR C OD 8018 1
JNZ Repeat C2,05,80 8019,801A,801B 3
RST5 EF 801C 1

50
Fig 9.1

Fig 9.2

51
Fig 9.3

Fig 9.4

52
Fig 9.5

53
Fig 9.6

Fig 9.7

54
Experiment No. 10:
Write a program to calculate the sum of series of even numbers.
Input - [8500] – 04, [8501] – 20, [8502] – 15 , [8503] – 13, [8504] – 22
Output - [8600] – 42

Code Opcode Memory location Bytes


LDA, 8500H 3A,00,85 8000,8001,8002 3
MOV C, A 4F 8003 1
MVI B, 00 06,00 8004,8005 2
LXI H, 8501H 21,01,85 8006,8007,8008 3
Back: MOV A, M 7E 8009 1
ANI 01 E6,01 800A,800B 2
JNZ Skip C2,12,80 800C,800D,800E 3
MOV A, B 78 800F 1
ADD M 86 8010 1
MOV B, A 47 8011 1
Skip: INX H 23 8012 1
DCR C 0D 8013 1
JNZ Back C2,09,80 8014,8015,8016 3
STA 8600H 32,00,86 8017,8018,8019 3
RST 5 EF 801A 1

Fig 10.1

55
Fig 10.2

56
Experiment No.11:
Write an assembly language program to verify how many bytes are present in a
given set, which resembles 10101101 in 8085.

Input - [8500] – AD, [8501] – 01, [8502] – 01, [8503] – 01, [8504] – 01, [8505] – 01, [8506] – 01,
[8507] – 01, [8508] – 01, [8509] – 01

Output - [8600] – 01

Code Opcode Memory location Bytes


MVI B, 0A 06,0A 8000,8001 2
MVI D, AD 16,AD 8002,8003 2
MVI C, 00 0E,00 8004,8005 2
LXI H, 8500H 21,00,85 8006,8007,8008 3
Back: MOV A, M 7E 8009 1
CMP D BA 800A 1
JNZ Next C2,0F,80 800B,800C,800D 3
INR C OC 800E 1
Next: INX H 23 800F 1
DCR B 05 8010 1
JNZ Back C2,09,80 8011,8012,8013 3
MOV A, C 79 8014 1
STA 8600H 32,00,86 8015,8016,8017 3
RST 5 EF 8018 1

57
Fig 11.1

58
Fig 11.2

59
Experiment No. 12:
Write an assembly language program to find the numbers of even parity in ten
consecutive memory locations in 8085.

Code Memory Location Opcode


MVI B, 0A 8000,8001 06,0A
MVI C, 00 8002,8003 0E,00
LXI H, 8500H 8004,8005,8006 21,00,85
Back: MOV A, M 8007 7E
ANI FF 8008,8009 E6,FF
JPO Next 800A,800B,800C E2,E0,80
INR C 800D 0C
Next: INX H 800E 23
DCR B 800F 05
JNZ Back 8010,8011,8012 C2,07,80
MOV A, C 8013 79
STA 8600H 8014,8015,8016 32,00,86
RST 5 8017 EF

Input - [8500] – 01, [8501] – 03, [8502] – 01, [8503] – 03, [8504] – 01, [8505] – 03, [8506] –
01, [8507] – 03, [8508] – 01, [8509] – 03
Output - [8600] – 05

60
Fig 12.1

61
Experiment No. 13:
Write an assembly language program to convert a BCD number into its
equivalent binary in 8085.

Code Memory Location Opcode


LDA 8500H 8000,8001,8002 3A,00,85
MOV B, A 8003 47
ANI 0F 8004,8005 E6,0F
MOV C, A 8006 4F
MOV A, B 8007 78
ANI F0 8008,8009 E6,F0
RRC 800A 0F
RRC 800B 0F
RRC 800C 0F
RRC 800D 0F
MOV B, A 800E 47
XRA A 800F AF
MVI D, 0A 8010,8011 16,0A
Sum: ADD D 8012 82
DCR B 8013 05
JNZ Sum 8014,8015,8016 C2,12,80
ADD C 8017 81
STA 8600H 8018,8019,801A 32,00,86
RST 5 801B EF

Input - [8500] – 67
Output - [8600] – 43

62
Fig 13.1

63
Experiment No. 14:
Write an assembly language program for exchanging the contents of memory
location.

Code Memory Location Opcode


LDA 8500H 8000,8001,8002 3A,00,85
MOV B, A 8003 47
LDA 8600H 8004,8005,8006 3A,00,86
STA 8500H 8007,8008,8009 32,00,85
MOV A, B 800A 78
STA 8600H 800B,800C,800D 32,00,86
RST 5 800E EF

Input - [8500] – 48, [8600] – 88


Output - [8500] – 88, [8600] – 48

Fig 14.1

64
Fig 14.2

65
Experiment No. 15:
Write a program to find the largest number in an array of 10 elements.

Code Memory Location Opcode


MVI B, 09 8000,8001 06,09
LXI H, 8500H 8002,8003,8004 21,00,85
MOV A, M 8005 7E
INX H 8006 23
Back: CMP M 8007 BE
JNC Next 8008,8009,800A D2,0C,80
MOV A, M 800B 7E
Next: INX H 800C 23
DCR B 800D 05
JNZ Back 800E,800F,8010 C2,07,80
STA 850AH 8011,8012.8013 32,0A,85
RST 5 8014 EF

Table 15

Input - [8500] – 01, [8501] – 02, ...................................... [8509] – 0A


Output - [850A] – 0A

66
Fig 15.1
8086 MICROPROCESSORS
S.No Name of Experiments Page
No.

1 Write an assembly language program to add two 16-bit numbers in 2


8086.

2 Write an assembly language program to subtract two 16-bit numbers in 4


8086.

3 Write an assembly language program to multiply two 16-bit numbers in 6


8086.

4 Write an assembly language program to divide two 16-bit numbers in 8


8086.

5 Write an assembly language program to demonstrate AAA, AAS, AAM, 10


AAD, DAA and DAS in 8086.

6 Write an assembly language program to find out the count of positive 15


numbers and negative numbers from a series of signed numbers in 8086.

7 Write an assembly language program to find out the largest number from 17
a given unordered array of 8-bit numbers, stored in the locations starting
from a known address in 8086.

8 Write an assembly language program to find out the largest number from 19
a given unordered array of 16-bit numbers, stored in the locations
starting from a known address in 8086.

9 Write an assembly language program to print Fibonacci series in 8086. 21

10 Write an assembly language program to perform the division 15/6 using 23


the ASCII codes. Store the ASCII codes of the result in register DX.

1
Experiment 1

Q. Write an assembly language program to add two 16-bit numbers in 8086.

Soln. -

MOV AX,1234H
MOV BX,1236H
ADD AX,BX
HLT

Output:

2
3
Experiment 2

Q. Write an assembly language program to subtract two 16-bit numbers in 8086.

Soln. -

MOV AX,1234H
MOV BX,1236H
SUB AX,BX
HLT

Output:

4
5
Experiment 3

Q. Write an assembly language program to multiply two 16-bit numbers in 8086.

Soln. -

MOV AX,[0301H]
MOV BX,[0303H]
MUL BX
HLT

Output:

6
7
Experiment 4

Q. Write an assembly language program to divide two 16-bit numbers in 8086.

Soln. -

MOV AX,[0301H]
MOV BX,[0303H]
DIV BX
HLT

Output:

8
9
Experiment 5

Q. Write an assembly language program to demonstrate AAA, AAS, AAM, AAD, DAA and

DAS in 8086

Soln.

AAA AAS

MOV AX,0032H MOV AL,0033H

MOV BX,0033H SUB AX,0039H

ADD AX,BX AAS

AAA OR AL,0030H

HLT HLT

AAM AAD

MOV AL,03H MOV AX,0033H

MOV BL,09H MOV BX,0032H

MUL BL AAD

AAM DIV BX

OR AX,3030H HLT

HLT

10
DAA DAS

MOV AL,71H MOV AL,71H

ADD AL,43H' SUB AL,43H'

DAA DAS

HLT HLT

11
AAA Instruction

AAS Instruction

12
AAM Instruction

AAD Instruction

13
DAA Instruction

DAS Instruction

14
Experiment 6

Q. Write an assembly language program to find out the count of positive numbers and negative

numbers from a series of signed numbers in 8086.

Soln. -

MOV CL,0AH
MOV BL,00H
MOV DL,00H
LEA SI, [1000H]
L1: MOV AL, [SI]
SHL AL, 01
JNC L2
INC DL
JMP L3
L2: INC BL
L3: INC SI
DEC CL
JNZ L1
MOV [100AH], BL
MOV [100BH], DL
HLT

15
16
Experiment 7

Q. Write an assembly language program to convert to find out the largest number from a given

unordered array of 8-bit numbers, stored in the locations starting from a known address in 8086.

Soln. -

MOV CL, 0AH


LEA SI, [1000H]
MOV AL, [SI]
L1: INC SI
MOV BL, [SI]
CMP AL, BL
JC L2
JMP L3
L2: MOV AL, BL
L3: DEC CL
JNZ L1
MOV [100AH], AL
HLT

Output:-

17
18
Experiment 8

Q. Write an assembly language program to find out the largest number from a given unordered
array of 16-bit numbers, stored in the locations starting from a known address in 8086.

Soln. -

MOV BX, 1000H


MOV C L, [BX]
INC BX
MOV AX, [BX[
DEC CL
Back: INC BX
INC BX
CMP AX, [BX]
JNC Next
MOV AX, [BX]
Next: DEC CL
JNZ Back
MOV [1020H], AX
HLT

19
20
Experiment 9

Q. Write an assembly language program to print Fibonacci series in 8086.

Soln. -

MOV AL,00H
MOV SI,500H
MOV [SI],AL
ADD SI,01H
ADD AL,01H
MOV [SI],AL
MOV CX,[0000H]
SUB CX,0002H
L1:MOV AL,[SI-1]
ADD AL,[SI]
ADD SI,01H
MOV [SI],AL
LOOP L1
HLT

Output:

21
22
Experiment 10

Q. Write an assembly language program to perform the division 15/6 using the ASCII codes.
Store the ASCII codes of the result in register DX.

Soln. -

MOV AX,‟15‟
MOV BX, „6‟
SUB AX, 3030H
SUB BH, 30H
AAD
DIV BH
ADD AX, 3030H
MOV [SI ], AX
HLT

23

You might also like