Assignment (102103539 540)
Assignment (102103539 540)
Submitted by:
Aneet 102103540
Submitted to:
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.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.
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.
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.
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.
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.
● 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.
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
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:
● 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..
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.
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
Table 2.1
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.
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
14
Fig 2.3.1
Fig 2.3.2
15
ADD M 8005 86
INX H 8006 23
MOV M,A 8007 77
RST 5 8008 EF
Table 2.3.2
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.
Table 2.4.1
18
Input - [ 8500 ] – 48, [ 8501 ] – 48, [8502 ] – 48, [ 8503 ] – 48
Fig 2.4.1
Fig 2.4.2
19
Fig 2.4.3
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
21
Fig 2.4.5
Fig 2.4.6
v) AIM- Write a program to 8-bit numbers using carry. (using JNC instruction).
MOV A, M 8005 7E
INX H 8006 23
ADD M 8007 86
INR C 800B 0C
MOV M, A 800D 77
INX H 800E 23
MOV M, C 800F 71
22
RST 5 8010 EF
Table 2.5
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
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
CMA 8004 2F
INR A 8005 3C
RST 5 8009 EF
Table 2.6.2
25
Input - [ 8500 ] – 48
Output - [ 8501 ] – B8
Fig 2.6.2
26
Code Memory Location Opcode
MOV C, A 8003 4F
SUB A 8004 97
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
27
Fig 3
EXPERIMENT-4
Aim-Write a program for data transfer from memory block B1 to memory
block B2 .
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:
MOV E, A 8003 7B
MOV C, A 8009 4F
DCR C 800E 0D
40
Fig 5.1 Output at memory location 8600
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
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
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
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
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
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
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.
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.
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.
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.
Table 15
66
Fig 15.1
8086 MICROPROCESSORS
S.No Name of Experiments Page
No.
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.
1
Experiment 1
Soln. -
MOV AX,1234H
MOV BX,1236H
ADD AX,BX
HLT
Output:
2
3
Experiment 2
Soln. -
MOV AX,1234H
MOV BX,1236H
SUB AX,BX
HLT
Output:
4
5
Experiment 3
Soln. -
MOV AX,[0301H]
MOV BX,[0303H]
MUL BX
HLT
Output:
6
7
Experiment 4
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
AAA OR AL,0030H
HLT HLT
AAM AAD
MUL BL AAD
AAM DIV BX
OR AX,3030H HLT
HLT
10
DAA DAS
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
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. -
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. -
19
20
Experiment 9
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