Microprocessor Lab
Microprocessor Lab
Engineering
LAB MANUAL
Chandigarh University
Gharuan, Mohali
Table of Contents
Beyond Syllabus:
11. (A) To perform multibyte addition.
(B) To perform multibyte subtraction. 46-47
Experiment No.1(A)
AIM: Addition of two 8-bit numbers, sum 8 bit.
APPARATUS: 8085 trainer kit.
PROGRAM:
2
Address Mnemonics Operand Opcode Remarks
2000 LXI H, 3000H 21 Load H-L pair with address 3000H.
2001 00 Lower-order of 3000H.
2002 30 Higher-order of 3000H.
st
2003 MOV A, M 7E Move the 1 operand from memory to reg. A.
2004 INX H 23 Increment H-L pair.
nd
2005 MOV B, M 46 Move the 2 operand from memory to reg. B.
2006 MVI C, 00H 0E Initialize reg. C with 00H.
2007 00 Immediate value 00H.
2008 ADD B 80 Add B with A.
2009 JNC 200D D2 Jump to address 200DH if there is no carry.
200A 0D Lower-order of 200DH.
200B 20 Higher-order of 200DH.
200C INR C 0C Increment reg. C.
200D INX H 23 Increment H-L pair.
200E MOV M, A 77 Move the result from reg. A to memory.
200F INX H 23 Increment H-L pair.
2010 MOV M, C 71 Move carry from reg. C to memory.
2011 HLT 76 Halt.
Explanation:
This program adds two operands stored in memory location 3000H and 3001H, along
with considering the carry produced (if any).
Let us assume that the operands stored at memory location 3000H is FAH and 3001H is
28H.
Initially, H-L pair is loaded with the address of first memory location.
The first operand is moved to accumulator from memory location 3000H and H-L pair is
incremented to point to next memory location.
The second operand is moved to register B from memory location 3001H.
Register C is initialized to 00H. It stores the carry (if any).
The two operands stored in register A and B are added and the result is stored in
accumulator.
Then, carry flag is checked for carry. If there is a carry, C register is incremented.
H-L pair is incremented and the result is moved from accumulator to memory 3002H.
H-L pair is again incremented and carry (either 0 or 1) is moved from register C to
memory location 3003H.
PROCEDURE:
← Write down the program in mnemonics.
← Hand Assemble the program.
← Load the data at required location:
Press RESET.
Press EXMEM.
Enter the required address where data is to be load.
3
Press NEXT key to enter data in data field.
Repeat step (d) for all the data.
Press Terminate key (.) to save the data.
← Verification
Press RESET.
Press EXMEM.
Enter the required address where result is stored.
Output:
Before Execution:
3000H: FAH
3001H: 28H
After Execution:
3002H: 22H
3003H: 01H
4
Experiment No.1(B)
AIM: Addition of two 16-bit numbers, sum 16-bits.
APPARATUS: 8085 trainer kit.
PROGRAM:
Address Mnemonics Operand Opcode Remarks
2000 LHLD 3000 H 2A Load H-L pair with data from 3000 H
2001 00
2002 30
2003 XCHG EB Exchange H-L pair with D-E pair
2004 LHLD 3002 H 2A Load H-L pair with data from 3002 H
2005 02
2006 30
2007 MVI C, 00 H 0E Move 0 to C
2008 00
2009 DAD D 19 Add D-E pair with H-L pair
200A JNC 200E H D2 Jump to location 200E H if no carry
200B 0E
200C 20
200D INR C 0C Increment C
200E SHLD 3004 H 22 Store the result at location 3004 H
200F 04
2010 30
2011 MOV A, C 79 Move carry from C to A
2012 STA 3006 H 32 Store the carry at location 3006 H
2013 06
2014 30
2015 HLT 76 Halt
PROCEDURE:
← (1) Write down the program in mnemonics.
← (2) Hand Assemble the program.
← (3) Load the data at required location:
Press RESET.
Press EXMEM.
Enter the required address where data is to be load.
Press NEXT key to enter data in data field.
Repeat step (d) for all the data.
Press Terminate key (.) to save the data.
← (7) Verification:
Press RESET.
Press EXMEM.
Enter the required address where result is stored.
Output:
Before Execution:
3000: 16 H
3001: 5A H
3002: 9A H
3003: 7C H
After Execution:
3004: B0 H
3005: 76 H
3006: 01 H
6
Experiment No. 2(A)
AIM: Subtraction of two 8-bit numbers along with considering the borrow.
APPARATUS: 8085 trainer kit.
PROGRAM:
Explanation:
This program subtracts two operands stored in memory location 3000H and 3001H,
along with considering the borrow taken (if any).
Let us assume that the operands stored at memory location 3000H is 05H and 3001H is
02H.
Initially, H-L pair is loaded with the address of first memory location.
The first operand is moved to accumulator from memory location 3000H and H-L pair is
incremented to point to next memory location.
The second operand is moved to register B from memory location 3001H.
Register C is initialized to 00H. It stores the borrow (if any).
The two operands stored in register A and B are subtracted and the result is stored in
accumulator.
Then, carry flag is checked for borrow. If there is a borrow, C register is incremented.
H-L pair is incremented and the result is moved from accumulator to memory location
3002H.
H-L pair is again incremented and borrow (either 0 or 1) is moved from register C to
7
memory location 3003H.
PROCEDURE:
← (1) Write down the program in mnemonics.
← (2) Hand Assemble the program.
← (3) Load the data at required location:
Press RESET.
Press EXMEM.
Enter the required address where data is to be load.
Press NEXT key to enter data in data field.
Repeat previous step for all the data.
Press Terminate key (.) to save the data.
← (7) Verification:
Press RESET.
Press EXMEM.
Enter the required address where result is stored.
Output:
Before Execution:
3000H: 05H
3001H: 02H
After Execution:
3002H: 03H
3003H: 00H
8
Experiment No. 2(B)
AIM: Subtraction of two 16-bit numbers along with considering the borrow.
APPARATUS: 8085 trainer kit.
PROGRAM:
PROCEDURE:
9
← (1) Write down the program in mnemonics.
← (2) Hand Assemble the program.
← (3) Load the data at required location:
Press RESET.
Press EXMEM.
Enter the required address where data is to be load.
Press NEXT key to enter data in data field.
Repeat previous step for all the data.
Press Terminate key (.) to save the data.
← (7) Verification:
Press RESET.
Press EXMEM.
Enter the required address where result is stored.
Output:
Before Execution:
3000H: 02H
3001H: 02H
3002H: 04H
3003H: 04H
After Execution:
3004H: FEH
3005H: FDH
3006H: 01H
The result is in 2’s complement form.
10
Experiment No. 3(A)
Explanation:
This program finds the 1’s complement of an 8-bit number stored in memory location
3000H.
Let us assume that the operand stored at memory location 3000H is 85H.
The operand is moved to accumulator from memory location 3000H.
Then, its complement is found by using CMA instruction.
The result is stored at memory location 3001H.
PROCEDURE:
← (1) Write down the program in mnemonics.
← (2) Hand Assemble the program.
← (3) Load the data at required location:
Press RESET.
Press EXMEM.
Enter the required address where data is to be load.
Press NEXT key to enter data in data field.
Repeat previous step for all the data.
Press Terminate key (.) to save the data.
← (7) Verification:
Press RESET.
Press EXMEM.
Enter the required address where result is stored.
Output:
Before Execution:
3000H: 85H
After Execution:
3001H: 7AH
12
Experiment No. 3(B)
Explanation:
This program finds the 1’s complement of 16-bit number stored in memory 3000H-
3001H.
There is no direct way to find 1’s complement of 16-bit number. Therefore, this can be
accomplished by finding the 1’s complement of two 8-bit numbers.
Let us assume that the operand stored at memory locations 3000H-3001H is 45H-6AH.
The operand is loaded into H-L pair from memory locations 3000H-3001H.
The lower-order is moved from register L to accumulator.
Its complement is found by using CMA instruction.
The result obtained is moved back to register L.
Then, the higher-order is moved from register H to accumulator.
Its complement is found by using CMA instruction.
The result obtained is moved back to register H.
Now, the final result is in H-L pair.
The result is stored from H-L pair to memory locations 3002H-3003H.
PROCEDURE:
← (1) Write down the program in mnemonics.
← (2) Hand Assemble the program.
← (3) Load the data at required location:
Press RESET.
13
Press EXMEM.
Enter the required address where data is to be load.
Press NEXT key to enter data in data field.
Repeat previous step for all the data.
Press Terminate key (.) to save the data.
← (7) Verification:
Press RESET.
Press EXMEM.
Enter the required address where result is stored.
Output:
Before Execution: After Execution:
3000H: 45H 3002H: BAH
3001H: 6AH 3003H: 95H
14
Experiment No. 4(A)
Explanation:
This program finds the 2’s complement of an 8-bit number stored in memory location 3000H.
Let us assume that the operand stored at memory location 3000H is 85H.
The operand is moved to accumulator from memory location 3000H.
Then, its complement is found by using CMA instruction.
One is added to accumulator by incrementing it to find its 2’s complement.
The result is stored at memory location 3001H.
PROCEDURE:
← (1) Write down the program in mnemonics.
← (2) Hand Assemble the program.
← (3) Load the data at required location:
Press RESET.
Press EXMEM.
Enter the required address where data is to be load.
Press NEXT key to enter data in data field.
Repeat previous step for all the data.
Press Terminate key (.) to save the data.
15
← (6) Execute the Program:
Press GO.
Enter the starting address of the program.
Press Terminate Key (.)
To check the result press EXMEM.
Enter the memory address where result has been stored in memory.
Press NEXT key.
← (7) Verification:
Press RESET.
Press EXMEM.
Enter the required address where result is stored.
Output:
Before Execution:
3000H: 85H
After Execution:
3001H: 7BH
16
Experiment No. 4(B)
Explanation:
This program finds the 2’s complement of 16-bit number stored in memory locations
3000H-3001H.
There is no direct way to find 2’s complement of 16-bit number. Therefore, this can be
accomplished by finding the 1’s complement of two 8-bit numbers and then
incrementing it to get 2’s complement.
Let us assume that the operand stored at memory locations 3000H-3001H is 12H-05H.
The operand is loaded into H-L pair from memory locations 3000H-3001H.
The lower-order is moved from register L to accumulator.
Its complement is found by using CMA instruction.
The result obtained is moved back to register L.
Then, the higher-order is moved from register H to accumulator.
Its complement is found by using CMA instruction.
The result obtained is moved back to register H.
H-L pair is incremented to get 2’s complement.
Now, the final result is in H-L pair.
The result is stored from H-L pair to memory locations 3002H-3003H
PROCEDURE:
17
← (1) Write down the program in mnemonics.
← (2) Hand Assemble the program.
← (3) Load the data at required location:
Press RESET.
Press EXMEM.
Enter the required address where data is to be load.
Press NEXT key to enter data in data field.
Repeat previous step for all the data.
Press Terminate key (.) to save the data.
← (7) Verification:
Press RESET.
Press EXMEM.
Enter the required address where result is stored.
Output:
Before Execution: After Execution:
3000H: 12H 3002H: EEH
3001H: 05H 3003H: FAH
18
Experiment No. 5(A)
AIM: To find the smaller number out of two numbers.
APPARATUS: 8085 trainer kit.
PROGRAM:
Explanation:
This program compares two operands to find the smallest out of them.
If it is not in accumulator, then first it is moved to accumulator and then from there, it is
moved to memory.
Let us assume that the operands stored at memory location 3000H is 25H and 3001H is
15H.
Initially, H-L pair is loaded with the address of first memory location.
The first operand is moved to accumulator from memory location 3000H and H-L pair is
incremented to point to next memory location.
The second operand is moved to register B from memory location 3001H.
The two operands are compared.
After comparison, if A > B, then CF = 0, and if A < B, then CF = 1.
Carry flag is checked for carry. If there is no carry, it means B is smaller than A and it is
moved to accumulator.
At last, H-L pair is incremented and the smallest number is moved from accumulator to
memory location 3002H.
19
PROCEDURE:
← (1) Write down the program in mnemonics.
← (2) Hand Assemble the program.
← (3) Load the data at required location:
Press RESET.
Press EXMEM.
Enter the required address where data is to be load.
Press NEXT key to enter data in data field.
Repeat previous step for all the data.
Press Terminate key (.) to save the data.
← (7) Verification:
Press RESET.
Press EXMEM.
Enter the required address where result is stored.
Output:
Before Execution:
3000H: 25H
3001H: 15H
After Execution:
3002H: 15H
20
Experiment No. 5(B)
Explanation:
This program finds the smallest number in an array.
Initially, the counter is initialized with the size of an array.
Then, two numbers are moved to registers A and B, and compared.
Counter is decremented and checked whether it has reached zero. If it has, the loop
terminates otherwise, the next number is moved to register and compared.
21
Let us assume that the memory location 3000H stores the counter. The next memory
locations store the array.
Initially, H-L pair is loaded with the address of the counter and is moved to register C.
The first number is moved from memory to accumulator and counter is decremented by
one.
H-L pair is again incremented and second number is moved to register B.
The two numbers are compared.
After comparison, if A > B, then CF = 0, and if A < B, then CF = 1.
Carry flag is checked for carry. If there is no carry, it means B is smaller than A and it is
moved to accumulator.
Counter is decremented and checked whether it has become zero.
If it hasn’t become zero, it means there are numbers left in the array. In this case, the
control jumps back to increment the H-L pair and moves the next number to register B.
This process continues until counter becomes zero, i.e. all the numbers in the array are
compared.
At last, H-L pair is incremented and the smallest number is moved from accumulator to
memory.
PROCEDURE:
← (1) Write down the program in mnemonics.
← (2) Hand Assemble the program.
← (3) Load the data at required location:
Press RESET.
Press EXMEM.
Enter the required address where data is to be load.
Press NEXT key to enter data in data field.
Repeat previous step for all the data.
Press Terminate key (.) to save the data.
22
Repeat previous step till the end of program.
← (7) Verification:
Press RESET.
Press EXMEM.
Enter the required address where result is stored.
Output:
Before Execution:
3000H: 05H (Counter)
3001H: 15H
3002H: 01H
3003H: 65H
3004H: E2H
3005H: 83H
After Execution:
3006H: 01H
23
AIM: To find the larger number out of two numbers.
APPARATUS: 8085 trainer kit.
PROGRAM:
Explanation:
This program compares the two operands to find the largest out of them.
If it is not in accumulator, then first it is moved to accumulator and then from there, it is
moved to memory.
Let us assume that the operands stored at memory location 3000H is 25H and 3001H is
15H.
Initially, H-L pair is loaded with the address of first memory location.
The first operand is moved to accumulator from memory location 3000H and H-L pair
is incremented to point to next memory location.
The second operand is moved to register B from memory location 3001H.
The two operands are compared.
After comparison, if A > B, then CF = 0, and if A < B, then CF = 1.
Carry flag is checked for carry. If there is a carry, it means B is greater than A and it is
moved to accumulator.
24
At last, H-L pair is incremented and the largest number is moved from accumulator to
memory location 3002H.
PROCEDURE:
← (1) Write down the program in mnemonics.
← (2) Hand Assemble the program.
← (3) Load the data at required location:
Press RESET.
Press EXMEM.
Enter the required address where data is to be load.
Press NEXT key to enter data in data field.
Repeat previous step for all the data.
Press Terminate key (.) to save the data.
← (7) Verification:
Press RESET.
Press EXMEM.
Enter the required address where result is stored.
Output:
Before Execution:
3000H:25H
25
3001H:15H
After Execution:
3002H:25H
26
Experiment No. 6(B)
Explanation:
This program finds the largest number in an array.
Initially, the counter is initialized with the size of an array.
Then, two numbers are moved to registers A and B, and compared.
Counter is decremented and checked whether it has reached zero. If it has, the loop
terminates otherwise, the next number is moved to register and compared.
27
Let us assume that the memory location 3000H stores the counter. The next memory
locations store the array.
Initially, H-L pair is loaded with the address of the counter and is moved to register C.
Then, H-L pair is incremented to point to the first number in the array.
The first number is moved from memory to accumulator and counter is decremented by
one.
H-L pair is again incremented and second number is moved to register B.
The two numbers are compared.
After comparison, if A > B, then CF = 0, and if A < B, then CF = 1.
Carry flag is checked for carry. If there is a carry, it means B is greater than A and it is
moved to accumulator.
Counter is decremented and checked whether it has become zero.
If it hasn’t become zero, it means there are numbers left in the array. In this case, the
control jumps back to increment the H-L pair and moves the next number to register B.
This process continues until counter becomes zero, i.e. all the numbers in the array are
compared.
At last, H-L pair is incremented and the largest number is moved from accumulator to
memory.
PROCEDURE:
← (1) Write down the program in mnemonics.
← (2) Hand Assemble the program.
← (3) Load the data at required location:
Press RESET.
Press EXMEM.
Enter the required address where data is to be load.
Press NEXT key to enter data in data field.
Repeat previous step for all the data.
Press Terminate key (.) to save the data.
28
Press NEXT key to enter opcode and data (hand assembly done in step-2).
Repeat previous step till the end of program.
← (7) Verification:
Press RESET.
Press EXMEM.
Enter the required address where result is stored.
Output:
Before Execution:
3000H: 05H (Counter)
3001H: 15H
3002H: 01H
3003H: 65H
3004H: E2H
3005H: 83H
After Execution:
3006H: E2H
PROCEDURE:
← (1) Write down the program in mnemonics.
← (2) Hand Assemble the program.
← (3) Load the data at required location:
Press RESET.
Press EXMEM.
Enter the required address where data is to be load.
Press NEXT key to enter data in data field.
Repeat previous step for all the data.
Press Terminate key (.) to save the data.
(4) Load the Program:
Press RESET.
Press EXMEM.
Enter the starting address of RAM i.e. 2000H.
Press NEXT key to enter opcode and data (hand assembly done in step-2).
30
Repeat previous step till the end of program.
← (7) Verification:
Press RESET.
Press EXMEM.
Enter the required address where result is stored.
31
AIM: To sort the given series in ascending order.
APPARATUS: 8085 trainer kit.
PROGRAM:
Label Mnemonics Effect Remarks
START: LXI H, 2101 H HL2101H Starting Address of Series
MVI C, 06 H C06H Counter to keep track of No. of bytes in
series
LOOP: DCR C CC-1
JZ STOP Jump if result of just preceding instruction
is zero.
MOV A, M AMHL Load the Accumlator with the first byte
from the memory.
INX H HLHL+1 Address of Next Byte
CMP M AA-M If A>0, No flag affected
A=0, Z=1
A<0, CY=1
JC LOOP Jump if result of just preceding instruction
has generated carry.
MOV B, M B MHL Save MHL in B for swapping.
MOV M, A MHLA
DCX H HLHL-1 Address of previous byte.
MOV M, B BMHL A and MHL get swapped.
JMP START Unconditional Jump
STOP: HLT
PROCEDURE:
← (1) Write down the program in mnemonics.
← (2) Hand Assemble the program.
← (3) Load the data at required location:
Press RESET.
Press EXMEM.
Enter the required address where data is to be load.
Press NEXT key to enter data in data field.
Repeat previous step for all the data.
Press Terminate key (.) to save the data.
(4) Load the Program:
Press RESET.
Press EXMEM.
Enter the starting address of RAM i.e. 2000H.
Press NEXT key to enter opcode and data (hand assembly done in step-2).
32
Repeat previous step till the end of program.
← (7) Verification:
Press RESET.
Press EXMEM.
Enter the required address where result is stored.
Experiment No.8(A)
33
AIM: To shift left 8-bit number by 1-bit.
APPARATUS: 8085 trainer kit.
PROGRAM:
Explanation:
This program performs the left shift operation on an 8-bit number by one bit stored in
memory location 3000H.
Let us assume that the operand stored at memory location 3000H is 05H.
The operand is moved to accumulator from memory location 3000H.
Then, shift left operation is done by using RAL instruction.
The result is stored at memory location 3001H
PROCEDURE:
← (1) Write down the program in mnemonics.
← (2) Hand Assemble the program.
← (3) Load the data at required location:
Press RESET.
Press EXMEM.
Enter the required address where data is to be load.
Press NEXT key to enter data in data field.
Repeat previous step for all the data.
Press Terminate key (.) to save the data.
(4) Load the Program:
Press RESET.
Press EXMEM.
Enter the starting address of RAM i.e. 2000H.
Press NEXT key to enter opcode and data (hand assembly done in step-2).
Repeat previous step till the end of program.
34
← (5) Save the Program:
Press Terminate key (.) to save the entered program.
← (6) Execute the Program:
Press GO.
Enter the starting address of the program.
Press Terminate Key (.)
To check the result press EXMEM.
Enter the memory address where result has been stored in memory.
Press NEXT key.
← (7) Verification:
Press RESET.
Press EXMEM.
Enter the required address where result is stored.
Output:
Before Execution:
3000H: 05H
After Execution:
3001H: 0AH
35
Experiment No.8(B)
PROCEDURE:
← (1) Write down the program in mnemonics.
← (2) Hand Assemble the program.
← (3) Load the data at required location:
Press RESET.
Press EXMEM.
Enter the required address where data is to be load.
Press NEXT key to enter data in data field.
Repeat previous step for all the data.
Press Terminate key (.) to save the data.
(4) Load the Program:
Press RESET.
Press EXMEM.
Enter the starting address of RAM i.e. 2000H.
Press NEXT key to enter opcode and data (hand assembly done in step-2).
Repeat previous step till the end of program.
36
Press Terminate Key (.)
To check the result press EXMEM.
Enter the memory address where result has been stored in memory.
Press NEXT key.
← (7) Verification:
Press RESET.
Press EXMEM.
Enter the required address where result is stored.
OUTPUT:
Before Execution:
3000: 05 H
After Execution:
3001: 14 H
37
Experiment No.9 (A)
Explanation:
This program masks the lower nibble of an 8-bit number stored in memory location
3000H.
Let us assume that the operand stored at memory location 3000H is 45H.
The operand is moved to accumulator from memory location 3000H.
Then, AND operation of F0H is performed with accumulator. This results in the
masking of lower nibble.
The result is stored at memory location 3001H.
PROCEDURE:
← (1) Write down the program in mnemonics.
← (2) Hand Assemble the program.
← (3) Load the data at required location:
Press RESET.
Press EXMEM.
Enter the required address where data is to be load.
Press NEXT key to enter data in data field.
Repeat previous step for all the data.
Press Terminate key (.) to save the data.
(4) Load the Program:
Press RESET.
38
Press EXMEM.
Enter the starting address of RAM i.e. 2000H.
Press NEXT key to enter opcode and data (hand assembly done in step-2).
Repeat previous step till the end of program.
← (7) Verification:
Press RESET.
Press EXMEM.
Enter the required address where result is stored.
Output:
Before Execution:
3000H: 45H
After Execution:
3001H: 40H
39
Experiment No. 9(B)
AIM: Mask the higher nibble of an 8-bit number.
APPARATUS: 8085 trainer kit.
PROGRAM:
Explanation:
This program masks the higher nibble of an 8-bit number stored in memory location
3000H.
Let us assume that the operand stored at memory location 3000H is 45H.
The operand is moved to accumulator from memory location 3000H.
Then, AND operation of 0FH is performed with accumulator. This results in the
masking of higher nibble.
The result is stored at memory location 3001H
PROCEDURE:
← (1) Write down the program in mnemonics.
← (2) Hand Assemble the program.
← (3) Load the data at required location:
Press RESET.
Press EXMEM.
Enter the required address where data is to be load.
Press NEXT key to enter data in data field.
Repeat previous step for all the data.
Press Terminate key (.) to save the data.
(4) Load the Program:
40
Press RESET.
Press EXMEM.
Enter the starting address of RAM i.e. 2000H.
Press NEXT key to enter opcode and data (hand assembly done in step-2).
Repeat previous step till the end of program.
← (7) Verification:
Press RESET.
Press EXMEM.
Enter the required address where result is stored.
Output:
Before Execution:
3000H: 45H
After Execution:
3001H: 05H
41
Experiment No. 10(A)
AIM: To check whether any number is even or odd.
APPARATUS: 8085 trainer kit.
PROGRAM:
Example: 2100 55
Label Mnemonics Effect Remarks
LXI H, 2100 H HL2100H Address of byte
MOV A, M BMHL= M2100H Load Accumlator with the given byte
ANI, 01 H AA AND 01H AND operation between Accumlator & 01H
bit by bit.
A7 A6 A5A4A3A2A1A0
0 0 0 0 0 0 0 1
Bits A7-A1 would get masked.
Result= 0, if A0= 0
1, if A0=1
JZ EVEN Jump if the result of the just preceding
instruction is zero.
MVI M, 00H MHL=00H 00 represent Byte is Odd.
JMP STOP Unconditional Jump
LOOP: MVI M, EE H MHL=EEH EE represent Byte is Even.
STOP: HLT
PROCEDURE:
← (1) Write down the program in mnemonics.
← (2) Hand Assemble the program.
← (3) Load the data at required location:
Press RESET.
Press EXMEM.
Enter the required address where data is to be load.
Press NEXT key to enter data in data field.
Repeat previous step for all the data.
Press Terminate key (.) to save the data.
(4) Load the Program:
Press RESET.
Press EXMEM.
Enter the starting address of RAM i.e. 2000H.
Press NEXT key to enter opcode and data (hand assembly done in step-2).
Repeat previous step till the end of program.
42
← (5) Save the Program:
Press Terminate key (.) to save the entered program.
← (6) Execute the Program:
Press GO.
Enter the starting address of the program.
Press Terminate Key (.)
To check the result press EXMEM.
Enter the memory address where result has been stored in memory.
Press NEXT key.
← (7) Verification:
Press RESET.
Press EXMEM.
Enter the required address where result is stored.
43
Experiment No. 10(B)
AIM: To check the parity of a given number.
APPARATUS: 8085 trainer kit.
PROGRAM:
Example: 2100 44
Label Mnemonics Effect Remarks
LXI H, 2100 H HL2100H Address of byte
MOV B, M B MHL = M2100H Load B Reg. with the given byte
MVI A, 80 H A80H
MVI C, 08 H C08H Loop to be executed for a byte
MVI D, 00 H D00H Counter to count No of 1’s
LOOP1: DCR C CC-1
JZ END Jump if result of just preceding
instruction is zero.
MOV E, A EA To save contents of Accumlator.
ANA B AA AND B
JZ LOOP Jump if result of just preceding
instruction is zero.
INR D DD+1
LOOP: MOV A, E AE
RAR
JMP LOOP1 Unconditional Jump
END: MOV A, D AD
ANI, 01 H AA AND 01 H AND operation between Accumlator &
01H bit by bit.
A7 A6 A5A4A3A2A1A0
0 0 0 0 0 0 0 1
Bits A7-A1 would get masked.
Result= 0, if A0= 0
1, if A0=1
PROCEDURE:
← (1) Write down the program in mnemonics.
← (2) Hand Assemble the program.
44
← (3) Load the data at required location:
Press RESET.
Press EXMEM.
Enter the required address where data is to be load.
Press NEXT key to enter data in data field.
Repeat previous step for all the data.
Press Terminate key (.) to save the data.
(4) Load the Program:
Press RESET.
Press EXMEM.
Enter the starting address of RAM i.e. 2000H.
Press NEXT key to enter opcode and data (hand assembly done in step-2).
Repeat previous step till the end of program.
45
Experiment No. 11(A)
AIM: To perform multibyte addition.
APPARATUS: 8085 trainer kit.
PROGRAM:
Example:
Addend
46
Experiment No. 11(B)
AIM: To perform multibyte subtraction.
APPARATUS: 8085 trainer kit.
PROGRAM:
Example:
47
Experiment No. 12(A)
AIM: To perform multiplication of two 8-bit numbers.
APPARATUS: 8085 trainer kit.
PROGRAM:
Example: Multiplicand: X =04 H
Multiplier: Y=03 H
48
Experiment No. 12(B)
AIM: To perform division of two 8-bit numbers.
APPARATUS: 8085 trainer kit.
PROGRAM:
49