You are on page 1of 49

Department of Computer Science &

Engineering

SUBJECT: Microprocessors & Interfacing


(CSP-257)

B.E. II Year – IV Semester


(Branch: CSE)

LAB MANUAL

Chandigarh University
Gharuan, Mohali

Table of Contents

Sr. Name of the Experiments


Page No
No.
1. (A) Addition of two 8-bit numbers; sum 8 bits. 3-6
(B) Addition of two 16 bit numbers; sum 16 bits.
1
2. (A) Subtraction of two 8-bit numbers; result 8 bits.
(B) Subtraction of two-16 bit numbers; sum 16 bits. 7-10

3. (A) To find one’s complement of an 8-bit number.


(B) To find one’s complement of a 16-bit number. 11-14

4. (A) To find two’s complement of an 8-bit number.


(B) To find two’s complement of a 16-bit number. 15-18

5. (A) To find the smaller number out of two numbers.


(B) To find the smaller number in a data array. 19-23

6. (A) To find the larger number out of two numbers.


(B) To find the larger number in a data array. 24-29

7. (A) To sort the given series in descending order.


(B) To sort the given series in ascending order. 30-33

8. (A) To shift left 8-bit number by 1-bit.


(B) To shift left 8-bit number by 2-bits. 34-37

9. (A) To mask the lower nibble of an 8-bit number.


(B) To mask the higher nibble of an 8-bit number. 38-41

10. (A) To check whether any number is even or odd.


42-45
(B) To check the parity of a given number.

Beyond Syllabus:
11. (A) To perform multibyte addition.
(B) To perform multibyte subtraction. 46-47

12. (A) To check whether any number is even or odd.


48-49
(B) To check the parity of a given number.

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.

← 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 step (d) till the end of program.

← Save the Program:


 Press Terminate key (.) to save the entered program.
← 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.

← 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.

← (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 step (d) till the end of program.

← (5) Save the Program:


5
 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:

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:

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 SUB B 90 Subtract B from A.
2009 JNC 200D D2 Jump to address 200DH if there is no borrow.
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 borrow from reg. C to memory.
2011 HLT 76 Halt.

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.

← (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.

← (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
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:

Address Mnemonics Operand Opcode Remarks


2000 LHLD 3000 H 2A Load H-L pair with data from 3000H
2001 00
2002 30
Exchange data from H-L pair with D-
2003 XCHG EB E
2004 LHLD 3002 H 2A Load H-L pair with data from 3002 H
2005 02
2006 30
2007 MVI B, 00 H 06 Move 0 H to B
2008 00
2009 MVI C, 00 H 0E Move 0 H to C
200A 00
st
200B MOV A, E 7B Move lower order of 1 no. to A
200C SUB L 95 Subtract lower order L from A
200D JNC 2011 H D2 Jump to2011 H if there is no borrow
200E 0F
200F 20
2010 INR C 0C If borrow, then increment C
2011 MOV E, A 5F Move lower order back to E
st
2012 MOV A, D 7A Move higher order of 1 no. to A
2013 SUB C 91 First, subtract borrow from A
2014 SUB H 94 Now, subtract higher order from A
2015 JNC 2019 H D2 Jump to 2019 H if there is no borrow
2016 19
2017 20
2018 INR B 04 If borrow, increment B
2019 MOV D, A 57 Move higher order back to D
Exchange the result from D-E with
201A XCHG EB H-L
201B SHLD 3004 H 22 Store the result al location 3004 H
201C 04
201D 30
201E MOV A, B 78 Move borrow to A
201F STA 3006 H 32 Store borrow at location 3006 H
2020 06
2021 30
2022 HLT 76 Halt

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.

← (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.

← (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: 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)

AIM: To find 1’s complement of an 8-bit number


APPARATUS: 8085 trainer kit.
PROGRAM:

Address Mnemonics Operand Opcode Remarks


2000 LDA 3000H 3A Load H-L pair with data from 3000H.
2001 00 Lower-order of 3000H.
2002 30 Higher-order of 3000H.
2003 CMA 2F Complement accumulator.
2004 STA 3001H 32 Store the result at memory location 3001H.
2005 01 Lower-order of 3001H.
2006 30 Higher-order of 3001H.
2007 HLT 76 Halt.

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.

← (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.

← (5) Save the Program:


 Press Terminate key (.) to save the entered program.
← (6) Execute the Program:
 Press GO.
11
 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: 7AH

12
Experiment No. 3(B)

AIM: To find one’s complement of 16-bit number


APPARATUS: 8085 trainer kit.
PROGRAM:

Address Mnemonics Operand Opcode Remarks


2000 LHLD 3000H 2A Load H-L pair with operand from 3000H.
2001 00 Lower-order of 3000H.
2002 30 Higher-order of 3000H.
2003 MOV A, L 7D Move the lower-order from reg. L to reg. A.
2004 CMA 2F Complement accumulator.
2005 MOV L, A 6F Move the result from reg. A to reg. L.
2006 MOV A, H 7C Move the higher-order from reg. H to reg. A.
2007 CMA 2F Complement accumulator.
2008 MOV H, A 67 Move the result from reg. A to reg. H.
2009 SHLD 3002H 22 Store the result at address 3002H.
200A 02 Lower-order of 3002H.
200B 30 Higher-order of 3002H.
200C HLT 76 Halt.

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.

← (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.

← (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: After Execution:
3000H: 45H 3002H: BAH
3001H: 6AH 3003H: 95H

14
Experiment No. 4(A)

AIM: To find 2’s complement of an 8-bit number.


APPARATUS: 8085 trainer kit.
PROGRAM:

Address Mnemonics Operand Opcode Remarks


2000 LDA 3000H 3A Load H-L pair with data from 3000H.
2001 00 Lower-order of 3000H.
2002 30 Higher-order of 3000H.
2003 CMA 2F Complement accumulator.
2004 INR A 2C Increment accumulator.
2005 STA 3001H 32 Store the result at memory location 3001H.
2006 01 Lower-order of 3001H.
2007 30 Higher-order of 3001H.
2008 HLT 76 Halt.

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.

← (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.

← (5) Save the Program:


 Press Terminate key (.) to save the entered program.

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)

AIM: To find 2’s complement of 16-bit number


APPARATUS: 8085 trainer kit.
PROGRAM:

Address Mnemonics Operand Opcode Remarks


2000 LHLD 3000H 2A Load H-L pair with operand from 3000H.
2001 00 Lower-order of 3000H.
2002 30 Higher-order of 3000H.
2003 MOV A, L 7D Move the lower-order from reg. L to reg. A.
2004 CMA 2F Complement accumulator.
2005 MOV L, A 6F Move the result from reg. A to reg. L.
2006 MOV A, H 7C Move the higher-order from reg. H to reg. A.
2007 CMA 2F Complement accumulator.
2008 MOV H, A 67 Move the result from reg. A to reg. H.
2009 INX H 23 Increment H-L pair to find 2’s complement.
200A SHLD 3002H 22 Store the result at address 3002H.
200B 02 Lower-order of 3002H.
200C 30 Higher-order of 3002H.
200D HLT 76 Halt.

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.

← (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.

← (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: 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:

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 CMP B B8 Compare B with A.
2007 JC 200BH DA Jump to address 200BH if there is no carry.
2008 0B Lower-order of 200BH.
2009 20 Higher-order of 200BH.
200A MOV A, B 78 Move smallest from reg. B to reg. A.
200B INX H 23 Increment H-L pair.
200C MOV M, A 77 Move the result from reg. A to memory.
200D HLT 76 Halt.

Explanation:
 This program compares two operands to find the smallest out of them.

 After comparison, the smallest of two must be in accumulator. If it is already in


accumulator, then it is moved to memory.

 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.

← (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.

← (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: 25H
3001H: 15H
After Execution:
3002H: 15H

20
Experiment No. 5(B)

AIM: To find the smaller number in a data array.


APPARATUS: 8085 trainer kit.
PROGRAM:
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.
2003 MOV C, M 4E Move counter from memory to reg. C.
2004 INX H 23 Increment H-L pair.
st
2005 MOV A, M 7E Move the 1 number from memory to reg. A.
2006 DCR C 0D Decrement counter.
2007 INX H 23 Increment H-L pair.
2008 MOV B, M 46 Move the next number from memory to reg. B.
2009 CMP B B8 Compare B with A.
200A JC 200EH DA Jump to address 200EH if there is no carry.
200B 0E Lower-order of 200EH.
200C 20 Higher-order of 200EH.
200D MOV A, B 78 Move smallest from reg. B to reg. A.
200E DCR C 0D Decrement counter.
200F JNZ 2007H C2 Jump to address 2007H if counter is not zero.
2010 07 Lower-order of 2007H.
2011 20 Higher-order of 2007H.
2012 INX H 23 Increment H-L pair.
2013 MOV M, A 77 Move the result from reg. A to memory.
2014 HLT 76 Halt.

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.

 After comparison, the smallest of two must be in accumulator. If it is already in


accumulator, then its fine, otherwise it is moved to accumulator.

 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.

← (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).

22
 Repeat previous step till the end of program.

← (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 (Counter)
3001H: 15H
3002H: 01H
3003H: 65H
3004H: E2H
3005H: 83H

After Execution:
3006H: 01H

Experiment No. 6(A)

23
AIM: To find the larger number out of two numbers.
APPARATUS: 8085 trainer kit.
PROGRAM:

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 CMP B B8 Compare B with A.
2007 JNC 200BH D2 Jump to address 200BH if there is no carry.
2008 0B Lower-order of 200BH.
2009 20 Higher-order of 200BH.
200A MOV A, B 78 Move largest from reg. B to reg. A.
200B INX H 23 Increment H-L pair.
200C MOV M, A 77 Move the result from reg. A to memory.
200D HLT 76 Halt.

Explanation:
 This program compares the two operands to find the largest out of them.

 After comparison, the largest of two must be in accumulator. If it is already in


accumulator, then it is moved to memory.

 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.

← (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.

← (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:25H
25
3001H:15H
After Execution:

3002H:25H

26
Experiment No. 6(B)

AIM: To find the larger number in a data array.


APPARATUS: 8085 trainer kit.
PROGRAM:
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.
2003 MOV C, M 4E Move counter from memory to reg. C.
2004 INX H 23 Increment H-L pair.
st
2005 MOV A, M 7E Move the 1 number from memory to reg. A.
2006 DCR C 0D Decrement counter.
2007 INX H 23 Increment H-L pair.
2008 MOV B, M 46 Move the next number from memory to reg. B.
2009 CMP B B8 Compare B with A.
200A JNC 200EH D2 Jump to address 200EH if there is no carry.
200B 0E Lower-order of 200EH.
200C 20 Higher-order of 200EH.
200D MOV A, B 78 Move largest from reg. B to reg. A.
200E DCR C 0D Decrement counter.
200F JNZ 2007H C2 Jump to address 2007H if counter is not zero.
2010 07 Lower-order of 2007H.
2011 20 Higher-order of 2007H.
2012 INX H 23 Increment H-L pair.
2013 MOV M, A 77 Move the result from reg. A to memory.
2014 HLT 76 Halt.

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.

 After comparison, the largest of two must be in accumulator. If it is already in


accumulator, then its fine, otherwise it is moved to accumulator.

 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.

← (4) Load the Program:


 Press RESET.
 Press EXMEM.
 Enter the starting address of RAM i.e. 2000H.

28
 Press NEXT key to enter opcode and data (hand assembly done in step-2).
 Repeat previous step till the end of program.

← (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 (Counter)
3001H: 15H
3002H: 01H
3003H: 65H
3004H: E2H
3005H: 83H

After Execution:
3006H: E2H

Experiment No. 7(A)

AIM: To sort the given series in descending order.


29
APPARATUS: 8085 trainer kit.
PROGRAM:

Label Mnemonics Effect Remarks


START: LXI H, 2101 H HL2101H Starting Address of Series
MVI C, 06 H C06H Counter to keep track of No. of bytes in
series
LOOP: DCR C CC-1
JZ STOP Jump if result of just preceding instruction
is zero.
MOV A, M AMHL Load the Accumulator with the first byte
from the memory.
INX H HLHL+1 Address of Next Byte
CMP M AA-M If A>0, No flag affected
A=0, Z=1
A<0, CY=1
JNC LOOP Jump if result of just preceding instruction
has not generated carry.
MOV B, M B MHL Save MHL in B for swapping.
MOV M, A MHLA
DCX H HLHL-1 Address of previous byte.
MOV M, B BMHL 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).

30
 Repeat previous step till the end of program.

← (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: The series is in descending order.


Example: No. of bytes = 06

Experiment No. 7(B)

31
AIM: To sort the given series in ascending order.
APPARATUS: 8085 trainer kit.
PROGRAM:
Label Mnemonics Effect Remarks
START: LXI H, 2101 H HL2101H Starting Address of Series
MVI C, 06 H C06H Counter to keep track of No. of bytes in
series
LOOP: DCR C CC-1
JZ STOP Jump if result of just preceding instruction
is zero.
MOV A, M AMHL Load the Accumlator with the first byte
from the memory.
INX H HLHL+1 Address of Next Byte
CMP M AA-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 MHLA
DCX H HLHL-1 Address of previous byte.
MOV M, B BMHL 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.

← (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: The series is in ascending order.


Example: No. of bytes = 06

Experiment No.8(A)

33
AIM: To shift left 8-bit number by 1-bit.
APPARATUS: 8085 trainer kit.
PROGRAM:

Address Mnemonics Operand Opcode Remarks


2000 LDA 3000H 3A Load H-L pair with data from 3000H.
2001 00 Lower-order of 3000H.
2002 30 Higher-order of 3000H.
2003 RAL 17 Shift left accumulator.
2004 STA 3001H 32 Store the result at memory location 3001H.
2005 01 Lower-order of 3001H.
2006 30 Higher-order of 3001H.
2007 HLT 76 Halt.

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)

AIM: To Shift Left 8-bit Number by 2 Bit


APPARATUS: 8085 trainer kit.
PROGRAM:

Address Mnemonics Operand Opcode Remarks


2000 LDA 3000 H 3A Load A with data from 3000 H
2001 00
2002 30
2003 RAL 17 Shift Left Accumulator
2004 RAL 17 Shift Left Accumulator
2005 STA 3001 H 32 Store the result at location 3001 H
2006 01
2007 30
2008 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 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.

← (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.

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)

AIM: To Mask the lower nibble of an 8-bit number.


APPARATUS: 8085 trainer kit.
PROGRAM:

Address Mnemonics Operand Opcode Remarks


2000 LDA 3000H 3A Load H-L pair with data from 3000H.
2001 00 Lower-order of 3000H.
2002 30 Higher-order of 3000H.
2003 ANI F0H E6 AND Immediate F0H with reg. A.
2004 F0 Immediate value F0H.
2005 STA 3001H 32 Store the result at memory location 3001H.
2006 01 Lower-order of 3001H.
2007 30 Higher-order of 3001H.
2008 HLT 76 Halt.

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.

← (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: 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:

Address Mnemonics Operand Opcode Remarks


2000 LDA 3000H 3A Load H-L pair with data from 3000H.
2001 00 Lower-order of 3000H.
2002 30 Higher-order of 3000H.
2003 ANI 0FH E6 AND Immediate 0FH with reg. A.
2004 0F Immediate value 0FH.
2005 STA 3001H 32 Store the result at memory location 3001H.
2006 01 Lower-order of 3001H.
2007 30 Higher-order of 3001H.
2008 HLT 76 Halt.

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.

← (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: 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 HL2100H Address of byte
MOV A, M BMHL= M2100H Load Accumlator with the given byte

ANI, 01 H AA 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 HL2100H Address of byte
MOV B, M B MHL = M2100H Load B Reg. with the given byte
MVI A, 80 H A80H
MVI C, 08 H C08H Loop to be executed for a byte
MVI D, 00 H D00H Counter to count No of 1’s
LOOP1: DCR C CC-1
JZ END Jump if result of just preceding
instruction is zero.
MOV E, A EA To save contents of Accumlator.
ANA B AA AND B
JZ LOOP Jump if result of just preceding
instruction is zero.
INR D DD+1
LOOP: MOV A, E AE
RAR
JMP LOOP1 Unconditional Jump
END: MOV A, D AD
ANI, 01 H AA 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

JZ EVEN Jump if result of just preceding


instruction is zero.
MVI M, 00H MHL=00H 00 represent Byte is Odd.
JMP STOP Unconditional Jump
EVEN: 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.

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.

← (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.

45
Experiment No. 11(A)
AIM: To perform multibyte addition.
APPARATUS: 8085 trainer kit.
PROGRAM:

Example:

No. of Bytes: Augend


Augend:
Addend:

Addend

Label Mnemonics Effect Remarks


MVI A, 00 H A00H Clear the Accumulator
MVI C, 04 H C04H Loop to be executed for 04 bytes
LXI H, 2101 H HL2101H Starting Address of Augend
LXI D, 2201 H DE2201H Starting Address of Addend
LOOP : LDAX D AMDE Load the Accumulator with the contents
present at location pointed by D-E
Register Pair
ADC M A A+MHL +CY
MOV M, A MHL  A
INX H HL HL+1
INX D DE DE+1
DCR C CC-1
JNZ LOOP Jump if the result of just preceding
instruction is not zero.
HLT

46
Experiment No. 11(B)
AIM: To perform multibyte subtraction.
APPARATUS: 8085 trainer kit.
PROGRAM:

Example:

Label Mnemonics Effect Remarks


MVI A, 00 H A00H Clear the Accumulator
MVI C, 04 H C04H Loop to be executed for 04 bytes
LXI H, 2101 H HL2101H Starting Address of Minuend
LXI D, 2201 H DE2201H Starting Address of Subtrahend
LOOP : LDAX D AMDE Load the Accumulator with the contents
present at location pointed by D-E Register
Pair
SBB M A A-MHL -CY
MOV M, A MHL  A
INX H HL HL+1 Next Byte of Minuend in memory.
INX D DE DE+1 Next Byte of Subtrahend in memory.
DCR C CC-1
JNZ LOOP Jump if the result of just preceding
instruction is not zero.
HLT

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

Label Mnemonics Effect Remarks


MVI A, 00 H A00 H Clear the Accumlator
MVI B, 04 H B04H Multiplicand
MVI C, 03 H C03H Multiplier (No. of times the loop is to be
executed)
LOOP : ADD B AA+B
DCR C CC-1
JNZ LOOP Jump if the result of just preceding
instruction is not zero.
STA,2050H M2050HA Product
HLT

48
Experiment No. 12(B)
AIM: To perform division of two 8-bit numbers.
APPARATUS: 8085 trainer kit.

PROGRAM:

Example:  Dividend: X =0A H


Divisor: Y=03 H

Label Mnemonics Effect Remarks


MVI A, 0A H A 0AH Dividend
MVI B, 03 H B 03H Divisor
MVI C, 00 H C00H Counter for Quotient
LOOP : INR C CC+1
SUB B AA-B
JP LOOP Jump if result of just preceding instruction is
positive.
DCR C CC-1 To adjust the Quotient because loop is
executed one extra time.
ADD B AA+B To adjust the Remainder because subtraction
is done one extra time.
STA 2100 H M2100HA Remainder
MOV A, C

STA 2101 H M2101HA Quotient


HLT

49

You might also like