Microprocessor File
Microprocessor File
Submitted to:
Submitted by:
Nishchey khajuria 102283032
Yuvraj Bhalla 102153015
Divyajot Kaur Sodhi 102103293
Yashika 102283033
Komal 102283043
TIET, Patiala
INDEX
Sr. Experiment Name Page
No. No.
2.1 Write a program to store 8-bit data into one register and then copy that to all 8
registers.
11
2.2 Write a program for addition of 2 bit numbers.
Write a program to add two 8-bit numbers using direct and indirect 13
2.3
addressing.
Write a program to add 16-bit number using direct and indirect addressing 17
2.4
mode.
2.5 24
Write a program to add 8-bit numbers using carry(using JNC instruction).
3 30
Write a program for the sum of series of numbers.
4 Write a program for data transfer from memory block B1 to memory block B2 34
6 Write a program to add ten 8-bit numbers. Assume the numbers are stored in 41
8500-8509. Store the result in 850A and 850B memory address
2
9 Write a program to arrange numbers in ascending order. 51
3
Experiment No.1
Aim: Introduction of 8085-microprocessor kit and steps for execution on the kit.
Microprocessor
Microprocessor is a hardware component of a computer , and it works as the
brain of the computer system.It is a small chip that is made of silicon and performs
all functions of the central processing unit.
4
● 40-pin I.C. package fabricated on a single LSI chip.
● Clock cycle is 320ns.
● 80 basic instructions and 246 opcodes.
Intel 8085
1. Registers Array :
(a) General purpose register (8 bit) :
● can be used singly or in pairs (16b-bit): {B,C,D,E,H,L} , {BC,DE,HL}
● Used to store the intermediate data and result
● H & L: used as a data pointer (holds memory address)
(b) Special Purpose Register Accumulator (A) (8 bit):
● All the ALU operations are performed with reference to the contents of
Accumulator.
● Result of an operation is stored in A.
Instruction Register:
● When an instruction is fetched from memory, it is loaded in IR. Then
transferred to the decoder for decoding.
(c) Flag Register (F) (8 bit) :
● Indicates the status of the ALU operation.
● ALU includes 5 flip flops, which are set or reset after an operation
according to data conditions of the result in the accumulator.
(d) Temporary Register [ W, Z, Temporary data register] : Internally used by the
MP
W and Z register (8 bit): Used to hold temporary addresses during the
execution of some instructions
Temporary data register (8 bit) : Used to hold temporary data during ALU
operations.
5
(2) ALU & Logical Group: it consists of ALU, Accumulator, Temporary register and
Flag Register
ALU
● Performs arithmetic and logical operations
● Stores result of arithmetic and logical operations in accumulator
Accumulator ( 8 bit data)
● General purpose register
● Stores one of the operand before any arithmetic and logical operations and
result of operation is again stored back in Accumulator
Temporary Register (8 bit)
● During the arithmetic and logical operations one operand is available in A
and other operand is always transferred to temporary register
Flag Register
● Five flags are connected to ALU
● After the ALU operation is performed the status of result will be stored in
five flags.
(3) Interrupt Control group
Interrupt:- Occurrence of an external disturbance
● After servicing the interrupt, 8085 resumes its normal working sequence
● Transfer the control to special routines
6
Fig. 1.2 Vikas Simulator
Functional Keys in Vikas 8085 simulator
● Press Reset
● Press Examine Memory
● Enter starting address
● Press Next
● Enter opcodes by subsequently pressing Next
● Press Reset
● Press Go
● Enter starting address of the program to compile
● Press EXEC/FILL
● Press Reset
● Press Examine Memory
● Enter Output Address
● Press Next
7
Program No: 2.1
Aim: Write a program to store 8-bit data into one register and then copy that to all registers .
RST 5 8008 EF
Table 2.1 Program to store 8-bit data into one register and then copy that to all registers
8
Fig 2.1.2 A-48 Fig 2.1.3 B-48
9
Fig 2.1.8 E-48
Flag Register:
10
Program no: 2.2
Aim: Write a program for addition of two 8 bit numbers.
ADD B 8004 80
RST 5 8008 EF
Table 2.2 Program for addition of two 8 bit numbers.
11
Output: [8500 ] – 90
12
Program no: 2.3
Aim: Write a program to add two 8-bit numbers using direct and indirect addressing mode.
ADD B 8007 80
RST 5 8011 EF
Table 2.3 Program to add 8-bit numbers using direct addressing mode
Code:
Fig. 2.3.1 Code to add 8-bit numbers using direct addressing mode
13
Input : [ 8500 ] – 88, [ 8501 ] – 88
Output: [ 8502 ] – 10
14
Instruction Location
Opcode
MOV A, M 8003 7E
INX H 8004 23
ADD M 8005 86
INX H 8006 23
MOV M, A 8007 77
RST 5 8008 EF
Table 2.3.5 Program to add 8-bit numbers using indirect addressing mode
Code :
Fig. 2.3.6 Code to add 8-bit numbers using indirect addressing mode
Input : [ 8500 ] – 88, [ 8501 ] – 88
15
Fig 2.3.7 [8500]-88 Fig 2.3.8 [8501]-88
Output: A – 10
16
Program no: 2.4
Aim: Write a program to add 16-bit numbers using direct and indirect addressing.
a) Direct Addressing:
XCHG 8003 EB
DAD D 8007 19
RST 5 800B EF
Table 2.4 Program to add 16-bit numbers using direct addressing mode
Code:
Fig. 2.4.1 Code to add 16-bit numbers using direct addressing mode
17
Input: [8500]- 48, [8501]- 48, [8502]- 48, [8503]-48
18
b) Indirect Addressing:
LDAX B 8003 0A
MOV D, A 8004 57
INX B 8005 03
LDAX B 8006 0A
ADD D 8007 82
INX B 800B 03
LDAX B 800C 0A
INX B 800E 03
LDAX B 800F 0A
ADC D 8010 8A
RST 5 8014 EF
Table 2.4.8 Program to add 16-bit numbers using indirect addressing mode
19
Input: [8500]- 34, [8501]- 48, [8502]- 54, [8503]- 78
20
Program no: 2.5
Title: Write a program to add 8-bit numbers using carry.(using JNC function)
INX H 8006 23
ADD M 8007 86
INR C 800B 0C
INX H 800E 23
RST 5 8010 EF
Table 2.5 Program to add 8-bit numbers using carry(JNC function)
21
Input: [8500]- 88, [8501]- 88
22
Fig. 2.5.5 [ 8503 ] – 01
23
Program no: 2.6
Aim: Write a program to find the 1’s complement and 2’s complement of a 8-bit number.
a) 1’s complement
CMA 8003 2F
RST 5 8007 EF
Input: [8500]- 48
24
Output: [8501]- B7
b) 2’s complement:
CMA 8003 2F
INR A 8004 3C
RST 5 8008 EF
25
Input: [8500]- 48
26
Program No.: 3
Aim : Write a program for the sum of series of numbers.
a) 1’s Complement
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, 800C, 800D C2, 08, 80
STA 8600H
800E 32, 00, 86
RST 5
800F EF
Table 3.1 Program to find the negative numbers in a block of data
27
Input - [8500] – 04, [8501] – 9A, [8502] – 52, [8503] – 89, [8504] – 3E
28
Output - [8600] – B3
Fig.3.8 [8600]-B3
29
Program No. 4:
Aim : Write a program for data transfer from memory block B1 to memory block B2.
STAX D 8009 12
INX H 800A 23
INX D 800B 13
DCR C 800C 0D
RST 5 8010 EF
Fig-4.1: Program for data transfer from memory block B1 to memory block B2
30
Input - [8500] – 01, [8501] – 02, [8502] – 03,……… [8509] – 0A
31
Fig 4.9 [8506]-07 Fig 4.10 [8507]-08
32
Output - [8600] – 01, [8601] – 02, [8602] – 03,……… [8609] – 0A
33
Fig 4.19 [8606]-07 Fig 4.20 [8607]-08
34
Program No. 5:
Aim : Write a program to multiply two 8-bit numbers.
MOV E, A 8003 5F
MOV C, A 8009 4F
DCR C 800E 0D
RST 5 8015 EF
35
Input - [8500] – B2, [8501] – 03
Result – B2 + B2 + B2 = 0216 H
Result – B2 + B2 + B2 = 0216 H
36
Program No. 6:
Aim : 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.
MOV A, M 8007 7C
ADD M 8009 86
INR C 800D 0C
INX H 8012 23
MOV M, A 8013 77
INX H 8014 23
MOV M, C 8015 71
RST 5 8016 EF
37
Fig 6.3 [8500]-16 Fig 6.4 [8501]-02
38
Fig 6.5 [8506]-01 Fig 6.6 [8507]-01
39
Program No. 7:
Aim : Write a program to find the negative numbers in a block of data.
MOV C, A 8003 4F
INR B 800F 04
DCR C 8011 0D
MOV A, B 8015 78
RST 5 8019 EF
40
Input - [8500] – 04, [8501] – 56, [8502] – A9, [8503] – 73, [8504] – 82
41
Output - [8600] – 02
42
Program No. 8
Aim : Write a program to count the number of one's in a number.
INR D 800B 14
RST 5 8014 EF
Fig.8.1: Program to count the number of one's in a number.
Input: [8500] – 25
43
Fig 8.3 [8500]-25
Output - [8600] – 03
44
Program No. 9
Aim: Write a program to arrange numbers in ascending order.
CODE MEMORY LOCATION OPCODE
LXI H, 8500H 8000,8001,8002 21,00,85
MOV C, M 8003 4E
DCR C 8004 0D
Repeat: MOV D, C 8005 51
LXI H, 8501H 8006,8007,8008 21,01,85
Loop: MOV A, M 8009 7E
INX H 800A 23
CMP M 800B BE
JC Skip 800C,800D,800E DA,14,80
MOV B, M 800F 46
MOV M , A 8010 77
DCX H 8011 2B
MOV M, B 8012 70
INX H 8013 23
Skip: DCR D 8014 15
JNZ Loop 8015,8016,8017 C2,09,80
DCR C 8018 0D
JNZ Repeat 8019,801A,801B C2,05,80
RST5 801C EF
Fig.9.1: Program to arrange numbers in ascending order.
45
Input: [8500] – 05, [8501] – 05, [8502] – 04, [8503] – 03, [8504] – 02, [8505] – 01
46
Fig 9.6 [8505]-05
47
Program No. 10
Aim: Write a program to calculate the sum of a series of even numbers.
MOV C, A 8003 4F
MOV A, B 800F 78
ADD M 8010 86
MOV B, A 8011 47
DCR C 8013 0D
RST 5 801A EF
Fig.10.1: Program to calculate the sum of a series of even numbers.
48
Input: [ 8500] – 04, [8501] – 20, [8502] – 15 , [8503] – 13, [8504] – 22
49
Output : [8600] – 42
50
Program no. 11
Aim : Write an assembly language program to verify how many bytes are present in a given
set, which resembles 10101101 in 8085
51
Input - [8500] – AD, [8501] – 01, [8502] – 01, [8503] – 01, [8504] – 01, [8505] – 01,
[8506]–01, [8507] – 01, [8508] – 01, [8509] – 01
52
Fig 11.7 [8506]-01 Fig 11.8 [8507]-01
53
Program no. 12
Aim: Write an assembly language program to find the numbers of even parity in ten
consecutive memory locations in 8085
54
Input - [8500] – 01, [8501] – 03, [8502] – 01, [8503] – 03, [8504] – 01, [8505] – 03, [8506]
–
01,[8507] – 03, [8508] – 01, [8509] – 03
55
56
Output - [8600] – 05
57
Program No. 13
Aim :
Write an assembly language program to convert a BCD number into its equivalent binary in
8085.
MOV B, A 8003 47
MOV C, A 8006 4F
MOV A, B 8007 78
RRC 8009 0F
RRC 800A 0F
RRC 800B 0F
RRC 800C 0F
MOV B, A 800D 47
XRA A 800E AF
DCR B 8012 05
ADD C 8016 81
RST 5 8019 EF
Table 13.1 Program for addition of two 8 bit numbers
Input - [8500] – 67
58
Fig. 13.3 [ 8500 ] – 67
Output - [8600] – 43
59
Program No. 14
Write an ALP for exchange the contents of memory location.
MOV B, A 8003 47
MOV A, B 800A 78
RST 5 800D EF
Table 14.1 ALP program for exchange the contents of memory location
60
Output: [8500] – 88, [8600] – 48
61
Program No. 15
Write a program to find the largest number in an array of 10 elements.
MOV A, M 8005 7E
INX H 8006 23
MOV A, M 800B 7E
DCR B 800D 05
RST 5 8014 EF
Fig.15.1 Program to find the largest number in an array of 10 elements.
62
Input - [8500] – 01, [8501] – 02, [8502] – 03, [8503] – 04, [8504] – 05,[8505] – 06, [8506]
–
07,[8507] – 08, [8508] – 09 ,[8509] – 0A
63
64
Fig. 15.7 [ 8508 ] – 09 Fig. 15.2[ 8509 ] – 0A
Output - [850A] – 0A
65