0% found this document useful (0 votes)
187 views

Microprocessor - Lab Assignment 1

The document contains an assignment for a microprocessor-based systems design course. It includes 9 questions asking to write programs for an 8085 microprocessor kit to perform tasks like storing data in memory, exchanging memory contents, adding numbers, finding complements, and summing a series of numbers using direct and indirect addressing modes. Programs are written in 8085 assembly language and outputs are shown.

Uploaded by

Jay Parmani
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
187 views

Microprocessor - Lab Assignment 1

The document contains an assignment for a microprocessor-based systems design course. It includes 9 questions asking to write programs for an 8085 microprocessor kit to perform tasks like storing data in memory, exchanging memory contents, adding numbers, finding complements, and summing a series of numbers using direct and indirect addressing modes. Programs are written in 8085 assembly language and outputs are shown.

Uploaded by

Jay Parmani
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

MICROPROCESSOR-BASED SYSTEMS DESIGN

( UCS617 )
ASSIGNMENT 1

GROUP MEMBERS

VISHESH GUPTA ( 101803125 )


PRAKHAR JINDAL ( 101803126 )
DIVYAM JAIN ( 101803128 )
JAY PARMANI ( 101803131 )

THAPAR INSTITUTE OF ENGINEERING AND TECHNOLOGY

PATIALA (147001), PUNJAB

JANUARY - MAY 2021

1
Table of Contents

S No. Title Page


No.

1 Introduction of 8085-microprocessor kit and steps for 3


execution on the kit.
2 Store 8-bit data in memory using direct and indirect 5
addressing mode.
3 Exchange the contents of memory locations using direct and 7
indirect addressing mode.
4 Familiarity with 8085-microprocessor kit. 9
● Write a program to store 8-bit data into one register
and then copy that to all registers.
● Write a program for addition of two 8-bit numbers.
● Write a program to add 8-bit numbers using direct and
indirect addressing mode.
● Write a program to add 16-bit numbers using direct
and indirect addressing mode.
● Write a program to 8-bit numbers using carry. (using
JNC instruction).
● Write a program to find 1’s complement and 2’s
complement of 8-bit numbers.

5 Write a program for the sum of a series of numbers. 18


6 Write a program for data transfer from memory block B1 to 20
memory block B2.
7 Write a program for multiplying two 8-bit numbers. 22
8 Write a program to add ten 8-bit numbers. Assume the 24
numbers are stored in 8500-8509. Store the result in 850A
and 850B memory addresses.
9 Write a program to find the negative numbers in a block of 27
data.

2
Q1. Introduction of 8085-microprocessor kit and steps for execution on
the kit.

8085 Simulator has a very user-friendly interface. Coding input is very easy
through a Code Keypad that includes a built-in assembler which translates
the given mnemonic code into machine code for 8085. This includes
provision for saving and opening coding files, so that you don't have to key
the same data over and over again and can also keep the data for future
reference. Offers easy and extensive debugging including Breakpoints and
Single Step running. Complete transparency of registers, RAM memory, IO
Memory and status flags just as an 8085 simulator should be. Has provision
to add Interrupt Service Routines (ISR) and other subroutines. Detailed Help
File included with this microprocessor 8085 simulator. Change’s background
colours in accordance to the user selected themes. The software is very
compact. Frequent software upgrades keep the 8085 simulator up to date.

3
STEPS: -

1) ENTER PROGRAM

2) ENTER DATA

3) EXECUTE PROGRAM

4) CHECK RESULT

STEPS TO ENTER PROGRAM: -

a. Press RESET

b. Press EXAMINE MEMORY (EXMEM)

c. Enter starting address

d. Press NEXT

e. Enter Opcodes, Press NEXT

f. Press RESET

g. Press GO

h. Enter starting address to compile

i. Press EXEC/FILL

j. Press RESET

k. Press EXMEM

l. Enter address

m. Press NEXT
4
Q2. Store 8-bit data in memory using direct and indirect addressing mode.

Code 1 (Direct Addressing):


MVI A, 52H
STA 9000H
RST 5

Output:

Debugform :

5
Code 2 (Indirect Addressing):
LXI H, 9500
MVI M, 32
RST 5

Output:

Debugform :

6
Q3. Exchange the contents of memory locations using direct and indirect
addressing mode.

Code 1 (Direct Addressing): Input:


LDA 9000H 9000 <- 01
MOV B, A 9500 <- 01
LDA 9500H
STA 9000H Output:
MOV A, B 9000 <- 02
STA 9500H 9500 <- 01
RST 5

Input: Output:

Debugform :

7
Code 2 (Indirect Addressing): Input:
LXI H 9000H 9000 <- 01
LXI D 9500H 9500 <- 02
MOV B, M
LDAX D Output:
MOV M,A 9000 <- 02
MOV A, B 9500 <- 01
STAX D
RST 5

Input: Output:

Debugform:

8
Q4.
(i) Write a program to store 8-bit data into one register and then copy that
to all registers.

Code:
MVI A, 48
MOV B, A
MOV C, A
MOV D, A
MOV E, A
MOV H, A
MOV L, A
RST 5

Output: DebugForm:

9
(ii) Write a program for the addition of two 8-bit numbers.

Code:
MVI A, 10
MVI B, 20
ADD B
STA 8500
RST 5

Output: DebugForm:

10
(iii) Write a program to add 8-bit numbers using direct and indirect
addressing mode.

Code 1 (Direct Addressing mode) : Input:


LDA 9801 9801 ← 14
MOV B, A 9802 ← 89
LDA 9802
ADD B Output:
STA 9803 9803 ← 9D
RST 5

11
Input: Output:

DebugForm:

Code 2 (Indirect Addressing mode): Input:


LXI H 9000 9000 ← 14
MOV A, M 9001 ← 89
INX H
ADD M Output:
INX H 9002 ← 9D
MOV M, A
RST 5

Input: Output:
12
Debugform:

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

Code 1 (Direct addressing mode): Input:


LHLD 9100 9100 ← 48
XCHG 9101 ← 48
LHLD 9102 9102 ← 48
DAD D 9103 ← 48
SHLD 9104
RST 5 Output:
9104 ← 90

13
9105 ← 90
Input: Output:

Debugform:

Code 2 (Indirect Addressing mode): Input:


LXI B, 9600 9600 ← 34
LDAX B 9601 ← 48
MOV D, A 9602 ← 54
INX B 9603 ← 78
LDAX B
ADD D Output:
STA 9604 9604 ← 7C
INX B 9605 ← CC
LDAX B

14
MOV D, A
INX B
LDAX B
ADC D
STA 9605
RST 5

Input: Output:

Debugform:

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

Code: Input:
MVI C, 00; 9500 ← FA
LXI H, 9500 9501 ← 28
MOV A, M
INX H Output:
MOV B, M Sum: 9502 ← 22
ADD B Carry: 9503 ← 01
15
JNC POS
INR C ;C=01
POS : INX H
MOV M, A
INX H
MOV M, C
RST 5

Input: Output:

DebugForm:

(vi) Write a program to find 1’s complement and 2’s complement of 8-bit
numbers.

Code 1 ( 1’s complement ): Input:


LDA 9000 9000← 48
CMA
STA 9501 Output:
RST 5 9501← B7

16
Input: Output:

DebugForm:

Code 2 ( 2’s complement ): Input:


LDA 9500 9500← 48
CMA
INR A Output:
STA 9501 9501← B8
RST 5

Input: Output:
17
Debugform:

Q5. Write a program for the sum of a series of numbers.

Code: Input:
LDA 9200 9200 ← 04
MOV C, A 9201 ← 9A
SUB A 9202 ← 52
LXI H, 9201 9203 ← 89
Back: ADD M 9204 ← 3E
18
INX H
DCR C Output:
JNZ Back 9300 ← B3
STA 9300
RST 5

Input: Output:

Debugform:

19
20
Q6. Write a program for data transfer from memory block B1 to memory
block B2.

Code: Input:
MVI C, 0A 9200 ← 00
LXI H, 9200 9201 ← 01
LXI D, 9300 9202 ← 02
Back: MOV A, M ….
STAX D 920A ← 0A
INX H
INX D Output:
DCR C 9300 ← 00
JNZ Back 9301 ← 01
RST 5 9302 ← 02
….
930A ← 0A

Input: Output:

. .
. .
. .

21
Debugform:

22
Q7. Write a program for multiplying two 8-bit numbers.

Code: Input:
LDA 9800 9800←B2
MOV E, A 9801←03
MVI D, 00
LDA 9801
MOV C, A Output:
LXI H, 0000 9900←16
Back: DAD D 9901←02
DCR C
JNZ Back
SHLD 9900
RST 5

Input: Output:

Debugform:

23
24
Q8. 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 addresses.

Code: Input:
MVI C, 00 8500←FF
MVI B, 09 8501←01
LXI H, 8500 8502←00
MOV A, M 8503←00
Back: INX H 8504←00
ADD M 8505←00
JNC Next 8506←00
INR C 8507←00
Next: DCR B 8508←00
JNZ BACK 8509←00
INX H Output:
MOV M, A 850A←00
INX H 850B←01
MOV M, C
RST 5

Input: Output:

25
Debugform:

26
27
Q9. Write a program to find the negative numbers in a block of data.
(8200H) = 04H
(8201H) = 56H
(8202H) = A9H
(8203H) = 73H
(8204H) = 82H
Result = 02 since 8202H and 8204H contain numbers with a MSB of 1.
Source program

Code: Input:
LDA 8200H 8200H←04H
MOV C, A 8201H←56H
MVI B, 00 8201H←56H
LXI H, 8201H 8201H←56H
BACK: MOV A, M 8201H←56H
ANI 80H
JZ SKIP Output:
INR B 8300←02
SKIP: INX H
DCR C
JNZ BACK
MOV A, B
STA 2300H
RST 5

Input: Output:

28
Debugform:

29
30

You might also like