A) Smallest or Largest Number in An Array Aim
A) Smallest or Largest Number in An Array Aim
Memory
Location
4100
21,00,42
4103
46
4104
05
DCR B
Decrement B register
4105
23
INX H
4106
7E
MOV A, M
4107
23
INX H
4108
BE
CMP M
4109
DA, 0D, 41
JC
410C
7E
MOV A, M
410D
05
410E
C2, 07, 41
4111
23
INX H
4112
77
4113
76
HLT
Step 7:
LOOP1 DCR B
End execution
Data
Memory location
Data
Dataset 2
Data
Memory
Location
4100
21,00,42
4103
46
4104
05
DCR B
Decrement B register
4105
23
INX H
4106
7E
MOV A, M
4107
23
INX H
4108
BE
CMP M
4109
DA, 0D, 41
410C
7E
MOV A, M
410D
05
410E
C2, 07, 41
JNZ
LOOP2
If [B]=0 go to LOOP 2
4111
23
INX H
4112
77
4113
76
HLT
LOOP1 DCR B
Comment
End execution
Result: Thus an 8085 assembly language program that finds the smallest (or largest
number in an array was written and executed using microprocessor kit.
Algorithm
Ascending order
Step 1:
Step 2:
Step 3:
Step 4:
Step 5:
Step 6:
Step 7:
Step 8:
Step 9:
subroutine:
Step 1:
Step 2:
Step 3:
Step 4:
Step 5:
Data
Descending order:
Step 1:
Step 2:
Step 3:
Step 4:
Step 5:
Step 6:
Step 7:
Step 8:
Step 9:
subroutine:
Step 1:
Step 2:
Step 3:
Step 4:
Step 5:
Memory
Location
Machine
code
Label Mnemonics
Comment
4100
21,00,42
LXI H, 4200
4103
46
MOV B, M
4104
05
DCR B
Decrement B register
4105
23
LOOP1 INX H
4106
E5
PUSH H
4107
C5
PUSH B
4108
CD, 13, 41
CALL
410B
C1
POP B
410C
E1
POP
410D
77
MOV M, A
410E
05
DCR B
Decrement register B
411F
C2, 05, 41
JNZ LOOP 1
If [B]=0 go to LOOP 2
4112
76
HLT
End execution
Sub
SUBROUTINE
Memory
Location
Mnemonics Comment
4113
7E
4114
23
LOOP 2 INX H
4115
BE
CMP M
4116
DA, 1C, 41
JC
4119
56
411A
77
411B
7A
411C
05
DCR
411D
C2, 14, 41
JNZ
LOOP2
If [B]=0 go to LOOP 2
4120
C9
RET
Decrement counnt
Data
Result:
Thus an 8085 assembly language program that sorts the given array in ascending
order (or descending order) was written and executed using microprocessor kit.
Aim:
To Write an assembly language that transfer a block of data from one set of
memory locations to other set of locations and test the program using 8085
microprocessor kit.
Apparatus required: 8085 Microprocessor kit, Power supply
Algorithm:
Step 1:
Step 2:
Step 3:
Step 4:
Step 5:
Step 6:
Step 7:
Step 8:
Memory
Location
Machine
code
4100
06 , 05
MVI B, 05
4102
21, 00, 42
Initialize a count
4105
11, 00, 43
LXI D, 4200
Initialize DE register pair as Destination
memory pointer
4108
7E
4109
12
STAX D
410A
23
INX H
410B
13
INX D
410C
05
DCR
410D
C2, 08, 41
4110
76
HLT
Input
Source location
Output
Data
Destination location
4200
4300
4201
4301
4203
4302
4204
4303
4205
4304
Data
Result:
Thus an assembly language that transfer a block of data from one set of memory
locations to other set of locations was written and tested using 8085 microprocessor kit.
Questions and Answers:
1.
Define: Instruction cycle, Machine cycle, T-state
2.
What are 8085 interrupts ? Discuss in detail.
3.
Explain the functions of the ALE and IO/M signals of the 8085
microprocessor
4.
With suitable examples explain in detail about the following instructions
a. STAX D
b. LDAX B
c. SPHL
d. PUSH B
EXERCISE