Ex. No: 1 8 Bit Addition Date: Aim
Ex. No: 1 8 Bit Addition Date: Aim
INPUT:
B A2
D 39
OUTPUT:
C DB
RESULT:
Thus the assembly language program for 8 bit addition was executed successfully and
the output was verified.
1
Ex. No: 2 16 BIT ADDITION
Date :
AIM:
To add two 16 bit binary number using 8085 microprocessor kit or simulator.
ALGORITHM:
Step1: Load HL register pair with the data from the memory location 8085 and
8051H.
Step2: Move the contents of the HL register pair to DE register pair.
Step3: Load the HL register pair with the data from the memory location 8086 and
8061H.
Step4: Add the register pair DE and HL.
Step5: Store the result present in HL register pair to the memory location.
Step6: Verify the result present in memory.
Step7: Halt.
PROGRAM:
ADDRESS OPCODE MNEMONICS
8000 2A
8001 50 LHLD,8050 H
8002 80
8003 EB XCHG
8004 2A
8005 60 LHLD,8060 H
8006 80
8007 19 DAD D
8008 22 SHLD 8070 H
8009 70
800A 80
800B 76 HLT
INPUT:
8050 1E 8051 30
8060 FF 8061 2C
OUTPUT:
8070 1D 8071 50
RESULT:
Thus an assembly language program for 16 bit addition was executed successfully and
the output was verified.
2
Ex. No: 3 8 BIT SUBTRACTION
Date :
AIM:
To subtract 8 bit number using 8085 microprocessor kit or simulator.
ALGORITHM:
Step1: Store two 8 bit number which to be subtracted in successive memory location.
Step2: Load accumulator with the first data in memory.
Step3: Increment the memory location to point to the second 8 bit numbers.
Step4: Subtract the contents of the memory location with the content of the
accumulator.
Step5: Increment the memory location to store the result.
Step6: Move the content of the accumulator to the memory location.
Step7: Verify the result in the memory.
Step8: Halt.
PROGRAM:
ADDRESS OPCODE MNEMONICS
8000 21
8001 50 LXI H,8050 H
8002 80
8003 7E MOV A,M
8004 23 INX H
8005 96 SUB M
8006 23 INX H
8007 77 MOV M,A
8008 76 HLT
INPUT:
8050 4C
8051 32
OUTPUT:
8052 1A
RESULT:
Thus an assembly language program for 8 bit subtraction was executed successfully
and the output was verified.
3
Ex. No: 4 BCD SUBTRACTION
Date :
AIM:
To subtract two 8 bit BCD numbers using 8085 microprocessor kit or simulator.
ALGORITHM:
Step1: Store the minu end in register B and subtracted in a accumulator.
Step2: Transfer content of accumulator subtracted to register C.
Step3: Load 99 in accumulator to find the 9’s complement.
Step4: Subtract the subtracted from accumulator.
Step5: Increment the accumulator to get the 10’s complement of the subtracted.
Step6: Add the contents of B with the contents of accumulator.
Step7: Using DAA instructions convert the intermediate result in the accumulator to
BCD.
Step8: Store the result in memory.
Step9: Halt.
PROGRAM:
ADDRESS OPCODE MNEMONICS
8000 3A
8001 51 LDA 8051 H
8002 80
8003 4F MOV C, A
8004 3E
MVI A, 99
8005 99
8006 91 SUB C
8007 3C INR A
8008 47 MOV B, A
8009 3A
800A 50 LDA 8050
800B 80
800C 80 ADD B
800D 27 DAA
800E 32
800F 50 STA 9050
8010 90
8011 76 HLT
4
INPUT:
8050 72
8051 35
OUTPUT:
9050 37
RESULT:
Thus an assembly language program for BCD subtraction was executed successfully.
5
Ex. No: 5 8 BIT MULTIPLICATION
Date :
AIM:
To write an assembly language program to multiply 8 bit numbers in 8085
microprocessor kit or simulator.
ALGORITHM:
STEP1: Load the multiplier from the memory to the accumulator.
STEP2: Transfer the multiplier to B register.
STEP3: Load the multiplicand from the memory to the accumulator.
STEP4: Transfer the multiplier to register.
STEP5: Initialize accumulator to zero.
STEP6: Clear the D register for storing the carry.
STEP7: Add multiplicand in C register to accumulator.
STEP8: If the value in accumulator exceeds FFH increment D register by one.
STEP9: Decrement the multiplier in B by one.
STEP10: If the value in B register becomes zero store the result present in the
accumulator to memory.
STEP 11: Store the high byte of the result present in D register in memory.
STEP 12: HLT.
PROGRAM:
6
8012 80
8013 32 STA 8053
8014 52
END LOOP 8015 80
8016 7A MOV A, D
8017 32
8018 53 STA 8053
8019 80
801A 76 HLT
INPUT/OUTPUT:
8050 04
8051 24
8052 90
8053 00
RESULT:
Thus an assembly language program for 8 bit multiplication has been executed
successfully.
7
Ex. No: 6 BCD MULTIPLICATION
Date :
AIM:
To write an assembly language program to multiply BCD numbers in 8085
microprocessor kit or simulator.
ALGORITHM:
STEP1: Load the multiplier from the memory to the accumulator.
STEP2: Transfer the multiplier to B register.
STEP3: Load the multiplicand from the memory to the accumulator.
STEP4: Transfer the multiplier to register C.
STEP5: Initialize accumulator to zero.
STEP6: Add the contents of register B with that of the accumulator.
STEP7: Convert the content of accumulator to BCD using DAA instruction.
STEP8: Decrement the register C by one.
STEP9: If content of register C is not zero goto Step 4.
STEP10: Store the content of the accumulator to memory.
STEP 11: HLT.
PROGRAM:
8
INPUT/OUTPUT:
8050 27
8051 03
8053 81
RESULT:
Thus an assembly language program for BCD multiplication has been executed
successfully.
9
Ex. No: 7 8 BIT DIVISION
Date :
AIM:
To write an assembly language program to divide 8 bit numbers in 8085
microprocessor kit or simulator.
ALGORITHM:
STEP1: Store the division and dividend in register B and accumulator respectively.
STEP2: Clear register to store the quotient.
STEP3: Subtract the division from the dividend until the dividend is less than the
dividend
STEP4: Number of times subtraction in performed gives the quotient.
STEP5: The content of accumulator gives the remainder.
STEP6: The results are stored in memory.
STEP7: HLT.
PROGRAM:
10
8016 79 MOV A, C
8017 32
8018 53 STA 8053
8019 80
801A CF RST
INPUT/OUTPUT:
8050 02
8051 0B
8052 01
8053 05
RESULT:
Thus an assembly language program for 8 bit division has been executed
successfully.
11
Ex. No: 8 SEARCHING FOR AN ELEMENT IN AN ARRAY
Date :
AIM:
To write an assembly language program to search the data in an array using 8085
microprocessor kit.
ALGORITHM:
STEP1: Store the search data in register D.
STEP2: Store the number of elements in an array in register C.
STEP3: Move the first data present in the array to accumulator.
STEP4: Compare the search data with the contents of accumulator.
STEP5: If equal move FF to accumulator and go step 9.
STEP6: If not equal increment the memory location to point to the next data in the
array and store it in the accumulator.
STEP7: Decrement the count present in register CIF not zero.
STEP8: Clear the contents of accumulator.
STEP9: Store the contents of accumulator memory.
STEP10: Stop the execution.
PROGRAM:
12
END LOOP 8015 3E MV A,FF,H
8016 FF
8017 21
8018 00 LXI M,8500
8019 85
801A 77 MOV M,A
801B CF RST 1
INPUT 1:
D A2
C 05
8050 C3
8051 89
8052 A2
8053 74
8054 E7
OUTPUT 1:
8500 FF
INPUT 2:
D A2
C 05
8050 C3
8051 89
8052 A2
8053 74
8054 E7
OUTPUT 1:
8500 00
RESULT:
Thus an assembly language program for searching an element in an array has been
executed successfully and the output was verified.
13
Ex No: 9 SORTING IN ASCENDING ORDER
Date :
Aim:
To write a program to arrange the array of data in ascending order in microprocessor
kit or simulator.
Algorithm:
PROGRAM:
14
SKIP 8015 15 DCR D
8016 C2
8017 09 JNZ 8009 (LOOP)
8018 80
8019 0D DCR C
8020 C2
8021 05 JNZ 8005 (REPEAT)
8022 80
8023 76 HLT
INPUT:
8200 05 (Size of the array)
8201 05
8202 04
8203 03
8204 02
8205 01
OUTPUT:
8200 05 (Size of the array)
8201 01
8202 02
8203 03
8204 04
8205 01
RESULT:
Thus an assembly language program to arrange the elements in an array is ascending
order to written executed successfully.
15
Ex. No: 10 (a) LARGEST ELEMENT IN AN ARRAY
Date :
AIM:
To find the largest number in an array of data using 8085 instruction set.
ALGORITHM:
Step 1: Load the address of the first element of the array in HL pair.
Step 2: Move the count to B register.
Step 3: Increment the pointer.
Step 4: Get the first data in A register.
Step 5: Decrement the count.
Step 6: Increment the pointer.
Step 7: Compare the content of memory addressed by HL pair with that of A
register.
Step 8: If Carry = 0, go to step 10 or if Carry = 1 go to step 9
Step 9: Move the content of memory addressed by HL to A register.
Step 10: Decrement the count.
Step 11: Check for Zero of the count. If ZF = 0, go to step 6, or if ZF = 1 go to
next step.
Step 12: Store the largest data in memory.
Step 13: Halt.
PROGRAM:
16
800C 7E MOV A, M
AHEAD 800D 05 DCR B
800E C2
800F 07 JNZ 8007 (LOOP)
8010 80
8011 32
8012 00 STA 8300
8013 83
8014 76 HLT
INPUT/OUTPUT:
8200 05
8201 01
8202 02
8203 03
8204 04
8205 05
8300 05
RESULT:
Thus an assembly language program to find the largest element in an array is executed
successfully.
17
Date :
AIM:
To find the smallest number in an array of data using 8085 instruction set.
ALGORITHM:
Step 1: Load the address of the first element of the array in HL pair
Step 2: Move the count to B register.
Step 3: Increment the pointer
Step 4: Get the first data in A register.
Step 5: Decrement the count.
Step 6: Increment the pointer
Step 7: Compare the content of memory addressed by HL pair with that of A
register.
Step 8: If Carry = 0, go to step 10 or if Carry = 1 go to step 9
Step 9: Move the content of memory addressed by HL to A register.
Step 10: Decrement the count
Step 11: Check for Zero of the count. If ZF = 0, go to step 6, or if ZF = 1 go to
next step.
Step 12: Store the largest data in memory.
Step 13: Halt.
PROGRAM:
18
AHEAD 800D 05 DCR B
800E C2
800F 07 JNZ 8007 (LOOP)
8010 80
8011 32
8012 00 STA 8300
8013 83
8014 76 HLT
INPUT/OUTPUT:
8200 05
8201 01
8202 02
8203 03
8204 04
8205 05
8300 01
RESULT:
Thus an assembly language program to find the smallest element in an array is
executed successfully.
19
AIM:
ALGORITHM:
Step 1: Load the address where the count and the element of the given array are
stored.
Step 2: Store the count in register C.
Step 3: Point to the address of reverse array.
Step 4: Move the data from the given array to accumulator and store it in the
reverse array.
Step 5: Update the pointers of the given array and reverse array.
Step 6: Decrement register C if not zero go to step 4.
Step 7: Halt.
PROGRAM:
INPUT/OUTPUT:
8500 05
20
8501 7E
8502 F4
8503 47
8504 83
8505 76
85FC 76
85FD 83
85FE 47
85FF F4
8600 7E
RESULT:
Thus an assembly language program to reverse the element in an array is executed
successfully.
Date :
AIM:
21
To implement the block move concept in array using 8085 microprocessor kit or
simulator.
ALGORITHM:
Step 1: Load register pair HL with the address 8500.
Step 2: Load register pair DE with the address 8600
Step 3: Move the content at memory location into accumulator.
Step 4: Store the content of accumulator into memory pointed by DE.
Step 5: Increment value of register pair HL and DE by 1.
Step 6: Decrements value of register C by 1.
Step 7: If zero flag not equal to 1, go to step 3.
Step 8: Halt.
PROGRAM:
INPUT/OUTPUT:
8500 05
8501 7E
22
8502 F4
8503 47
8504 83
8505 76
8600 7E
8601 F4
8602 47
8603 83
8604 76
RESULT:
Thus an assembly language program to move the array element using block move
concept is executed successfully.
Date :
AIM:
To write a program to arrange the array elements in descending order.
23
ALGORITHM:
24
8023 76 HLT
INPUT:
8200 05 (Size of the array)
8201 01
8202 02
8203 03
8204 04
8205 01
OUTPUT:
8200 05 (Size of the array)
8201 05
8202 04
8203 03
8204 02
8205 01
RESULT:
Thus an assembly language program to arrange the elements in an array is descending
order to written executed successfully.
Date :
AIM:
25
ALGORITHM:
Step 1: Initialize memory pointer to 8050.
Step 2: Get the most significant digit.
Step 3: Multiply the MSD by ten using repeated addition.
Step 4: Add the least significant digit to the result obtained in previous step.
Step 5: Store the HEX data in memory.
Step 6: Halt.
PROGRAM:
INPUT:
8050 02
8051 09
26
OUTPUT:
8052 1D
RESULT:
Thus an assembly language program to convert BCD to HEX is executed
successfully.
Date :
AIM:
To convert HEX number to BCD number using 8085 microprocessor kit or
27
simulator.
ALGORITHM:
Step 1: Initialize memory pointer to 8050.
Step 2: Get the hexa decimal number in C register.
Step 3: Perform repeated addition for C number of times.
Step 4: Adjust for BCD in each step.
Step 5: Store the BCD in each step.
Step 6: Halt.
PROGRAM:
INPUT:
8050 FF
OUTPUT:
28
8051 55
8052 02
RESULT:
Thus an assembly language program to convert HEX to BCD is executed
successfully.
Date :
AIM:
29
To convert binary number to ASCII number using 8085 microprocessor kit or
simulator.
ALGORITHM:
Step 1: Load Accumulator with the data from memory.
Step 2: Copy the number into B.
Step 3: Set Carry Flag.
Step 4: Complement Carry Flag.
Step 5: Subtract 0A from A.
Step 6: When carry is present, A is numeric.
Step 7: Add 41H for Alphabet.
Step 8: Jump to store the value.
Step 9: Get back B to A.
Step 10: Add 30H with A to get ASCII.
Step 11: Point to next location to store address.
Step 12: Store A to memory location pointed by HL pair.
Step 13: Halt.
PROGRAM:
30
8015 77 MOV M, A
8016 76 HLT
INPUT:
8050 0A
OUTPUT:
8051 41
RESULT:
Thus an assembly language program to convert binary to ASCII is executed
successfully.
Date :
AIM:
31
To convert ASCII number to binary number using 8085 microprocessor kit or
simulator.
ALGORITHM:
Step 1: Load address of the number
Step 2: Load ASCII data to accumulator from memory
Step 3: Compare with ASCII (9) + 1
Step 4: The input is numeric
Step 5: Subtract offset to get Alphabetic character
Step 6: Store the result
Step 7: Subtract 30to get numeric value
Step 8: Point to next location
Step 9: Store Acc content to memory
Step 10: Halt.
PROGRAM:
INPUT:
8050 41
OUTPUT:
32
8051 0A
RESULT:
Thus an assembly language program to convert ASCII to Binary is executed
successfully.
Date :
AIM:
33
To convert ASCII number to BCD number using 8085 microprocessor kit or
simulator.
ALGORITHM:
PROGRAM:
INPUT:
8100 36
OUTPUT:
8101 06
RESULT:
Thus an assembly language program to convert ASCII to BCD is executed
successfully.
Date :
AIM:
34
To convert BCD number to ASCII number using 8085 microprocessor kit or
simulator.
ALGORITHM:
Step 1: Input the content of 2050 in accumulator.
Step 2: Move content of Accumulator to register B.
Step 3: Separate the least significant digit using AND with 0F and ADD 30 to
accumulator
PROGRAM:
35
8017 76 HLT
INPUT:
8050 98
OUTPUT:
9050 38
9051 39
RESULT:
Thus an assembly language program to convert BCD to ASCII is executed
successfully.
Date :
AIM:
36
To find the square of a number in microprocessor 8085 kit or simulator.
ALGORITHM:
Step 1: Assign 20 to register H, 50 to register L and 00 to accumulator A.
Step 2: Load the content of memory location which is specified by M in register
B.
Step 3: Load the content of memory location which is specified by M is register
B.
Step 4: Add content of M in accumulator A and decrement value of B by 01.
Step 5: Check if B holds 00, if true then store the value of A at memory location
9050 otherwise goto step 3.
Step 6: Halt.
PROGRAM:
INPUT:
8050 03
37
OUTPUT:
8051 09
RESULT:
Thus an assembly language program to find the square of a number is executed
successfully.
Date :
38
AIM:
ALGORITHM:
Step 1: Assign address location.
Step 2: Move the content of accumulator to D register.
Step 3: Load the address location to give input.
Step 4: Move the content of accumulator to B register.
Step 5: Move the content of accumulator to C register.
Step 6: Immediately move 00 to E register.
Step 7: Assign address location.
Step 8: Move the content of E register to accumulator.
Step 9: Add the content of B register with accumulator.
Step 10: Jump to step 13.
Step 11: Move the content of D to accumulator.
Step 12: Decrement the value of D.
Step 13: Call subroutine.
Step 14: Move the content of A to D.
Step 15: Jump to step 7.
Step 16: Call display address.
Step 17: Halt.
PROGRAM:
39
800F 16
8010 80
8011 7A MOV A, D
8012 C6
ADI 01
8013 01
8014 27 DAA
8015 57 MOV D, A
8016 C2
8017 00 CALL 8100
8018 81
8019 C2
801A 0A JNZ 800A
801B 80
801C 0D
801D C0 CALL 13CO
801E 13
801F 76 HLT
SUB ROUTINE
8100 3E
MVI A, 99
8101 99
8102 D6
SUI 01
8103 01
8104 3C INR A
8105 81 ADD C
8106 27 DAA
8107 4F MOV C, A
8108 C9 RET
INPUT:
8050 03
OUTPUT:
8051 09
RESULT:
Thus an assembly language program to find the square of BCD number is executed
successfully.
Ex. No: 19 SQUARE ROOT OF A NUMBER
Date :
AIM:
40
To find the square root of a number in microprocessor 8085 kit or simulator.
ALGORITHM:
Step 1: Assign 01 to register D and E.
Step 2: Load the value, stored at memory location 8050 in accumulator A.
Step 3: Subtract value stored at accumulator A from register D.
Step 4: Check if accumulator holds 0, if true then jump to step 8.
Step 5: Increment value of register D by 2.
Step 6: Increment value of register E by 1.
Step 7: Jump to step 3.
Step 8: Move value stored at register E in A.
Step 10: Halt.
PROGRAM:
INPUT:
8050 09
41
OUTPUT:
8051 03
RESULT:
Thus an assembly language program to find the square root of a number is executed
successfully.
Date :
AIM:
42
To find the square root of a number in microprocessor 8085 kit or simulator.
ALGORITHM:
Step 1: Assign address location.
Step 2: Move the content of accumulator to D register.
Step 3: Load the address location to give input.
Step 4: Move the content of accumulator to B register.
Step 5: Move the content of accumulator to C register.
Step 6: Immediately move 00 to E register.
Step 7: Assign address location.
Step 8: Move the content of E register to accumulator.
Step 9: Add the content of B register with accumulator.
Step 10: Jump to step 13.
Step 11: Move the content of D to accumulator.
Step 12: Decrement the value of D.
Step 13: Call subroutine.
Step 14: Move the content of A to D.
Step 15: Jump to step 7.
Step 16: Call display address.
Step 17: Halt.
PROGRAM:
43
8012 3E
MVI A, 99
8013 99
8014 90 SUB B
8015 3C INR A
8016 32 ADD D
8017 27 DAA
8018 0C INR C
8019 CA
801A 20 JZ 8020
801B 80
801C DA
801D 0C JC 800C
801E 80
801F CD
8020 C0 CALL C013
8021 13
8022 76 HLT
SUBROTINE
8100 F5 PUSH PSW
8101 78 MOV A, B
8102 C6
ADI 00
8103 00
8104 27 DAA
8105 47 MOV B, A
8106 F1 POP PSW
8107 C9 RET
INPUT:
8050 09
OUTPUT:
8051 03
RESULT:
Thus an assembly language program to find the square root of BCD number is
executed successfully.
44