Microprocessor - Lab Assignment 1
Microprocessor - Lab Assignment 1
( UCS617 )
ASSIGNMENT 1
GROUP MEMBERS
1
Table of Contents
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
a. Press RESET
d. Press NEXT
f. Press RESET
g. Press GO
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.
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.
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.
11
Input: Output:
DebugForm:
Input: Output:
12
Debugform:
(iv) Write a program to add 16-bit numbers using direct and indirect
addressing mode.
13
9105 ← 90
Input: Output:
Debugform:
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.
16
Input: Output:
DebugForm:
Input: Output:
17
Debugform:
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