Microprocessor 8085 Programs
Microprocessor 8085 Programs
Memory
Opcode Instruction Comments
Address
1000 3E MVI A, 23H Move first Immediate data in Register A.
1001 23
1002 11 MVI B,32H Move Second Immediate data in Register B.
1003 32
1004 80 ADD B Add contents of register B to register A.
1005 4F MOV C,A Move contents of register A to register C.
1006 76 HLT Stop the program
Program 2(B): Write an ALP to perform addition of two 16- bit numbers.
Memory
Opcode Instruction Comments
Address
1000 01 LXI B,1234H Load first Immediate data in one register pair BC.
1001 34
1002 12
1003 32 LXI D,4321H Load secondImmediate data in another register pair DE.
1004 21
1005 43
1006 79 MOV A,C Move lower register C content into register A.
1007 83 ADD E Add lower register E to register A.
1008 MOV L,A Store addition of lower registers in another register pair HL.
1009 MOV A,E Move lower register C content into register A
100A ADC D Add lower register E to register A.
100B MOV H,A Store addition of Higher registers in another register pair HL.
100C 76 HLT Stop the program
Program 3(A): Write an ALP to transfer 10 bytes of data from one memory block to another
memory block where the two blocks are not overlapping.
Memory
Opcode Instruction Comments
Address
1000 LXI H, 7100H Load HL pair with the source address.
1001
1002
1003 LXI D,7200H Load DE pair with the destination address.
Upesh Patel
1004
1005
1006 MVI C,0AH Set register C as a counter for 10 numbers.
1007
1008 MOV A,M Take first number in accumulator
1009 STAX D Store accumulator number to destination address.
100A INX H Increment HL pair to next address of next location.
100B INX D Increment DE pair to next address of next location.
100C DCR C Decrement counter C by 1.
100D JNZ L1 (1008H) Jump if C is not equal to 0.
100E
100F
1010 HLT Terminate the program.
Program 3(B): Write an ALP to transfer 10 bytes of data from one memory block to another
memory block where the two blocks are overlapping.
Memory
Opcode Instruction Comments
Address
1000 LXI H, 7109H Load HL pair with the source address.
1001
1002
1003 LXI D,710EH Load DE pair with the destination address.
1004
1005
1006 MVI C,0AH Set register C as a counter for 10 numbers.
1007
1008 MOV A,M Take first number in accumulator
1009 STAX D Store accumulator number to destination address.
100A DCX H Decrement HL pair to next address of next location.
100B DCX D Decrement DE pair to next address of next location.
100C DCR C Decrement counter C by 1.
100D JNZ L1 (1008H) Jump if C is not equal to 0.
100E
100F
1010 HLT Terminate the program.
Program 4: Write an ALP to find the count of odd and even numbers in a series of 10 bytes of data.
Memory
Opcode Instruction Comments
Address
1000 LXI H, 7100H Load HL pair with address of first byte stored continuously from.
1001
1002
1003 LXI D,0000H Initialize the DE pair to store ODD in D and EVEN in E register.
1004
Upesh Patel
1005
1006 MVI C,0AH Set register C as a counter for 10 numbers.
1007
1008 MOV A,M Take first number in accumulator
1009 RAR Rotate right accumulator with carry.
100A JNC L1 (1011H) Jump if not carry at address given.
100B
100C
100D INR D Increment the count of ODD number.
100E JMP L2 (1012H) Jump unconditionally at address given.
100F
1010
1011 INR E Increment register E to count EVEN number.
1012 INX H Decrement HL pair to next address of next location.
1013 DCR C Decrement counter C by 1.
1014 JNZ L3 (1008H) Jump if C is not equal to 0.
1015
1016
1017 HLT Terminate the program.
Program 5: Write an ALP to find the count of POSITIVE and NEGATIVE numbers in a series of 10
bytes of data.
Memory
Opcode Instruction Comments
Address
1000 LXI H, 7100H Load HL pair with address of first byte stored continuously from.
1001
1002
1003 LXI D,0000H Initialize the DE pair to store ODD in D and EVEN in E register.
1004
1005
1006 MVI C,0AH Set register C as a counter for 10 numbers.
1007
1008 MOV A,M Take first number in accumulator
1009 RAL Rotate left accumulator with carry.
100A JNC L1 (1011H) Jump if not carry to address given.
100B
100C
100D INR D Increment the count of NEGATIVE number.
100E JMP L2 (1012H) Jump unconditionally at address given.
100F
1010
1011 INR E Increment register E to count POSITIVE number.
1012 INX H Decrement HL pair to next address of next location.
1013 DCR C Decrement counter C to 9.
1014 JNZ L3 (1008H) Jump if C is not equal to 0.
1015
Upesh Patel
1016
1017 HLT Terminate the program.
Program 6: Write an ALP to find the count of POSITIVE and NEGATIVE numbers in a series of 10
bytes of data.
Memory
Opcode Instruction Comments
Address
1000 LXI H, 7100H Load HL pair with address of first byte stored continuously from.
1001
1002
1003 LXI D,0000H Initialize the DE pair to store ODD in D and EVEN in E register.
1004
1005
1006 MVI C,0AH Set register C as a counter for 10 numbers.
1007
1008 MOV A,M Take first number in accumulator
1009 RAL Rotate left accumulator with carry.
100A JNC L1 (1011H) Jump if not carry to address given.
100B
100C
100D INR D Increment the count of NEGATIVE number.
100E JMP L2 (1012H) Jump unconditionally at address given.
100F
1010
1011 INR E Increment register E to count POSITIVE number.
1012 INX H Decrement HL pair to next address of next location.
1013 DCR C Decrement counter C to 9.
1014 JNZ L3 (1008H) Jump if C is not equal to 0.
1015
1016
1017 HLT Terminate the program.
Program 7: Write an ALP to find out the largest number in a series of 10 bytes of data.
Memory
Opcode Instruction Comments
Address
1000 LXI H, 7100H Load HL pair with address of first byte stored continuously from.
1001
1002 MVI C,0AH Set register C as a counter for 10 numbers.
1003 .
1004 MOV A,M Take first number in accumulator
1005 INX H Decrement HL pair to next address of next location.
1006 CMP M Compare number with Accumulator.
1007 JNC L1 (1011H) Jump if not carry to address given.
1008
Upesh Patel
1009
100A MOV A,M Take first number in accumulator
100B
100C
100D INR D Increment the count of NEGATIVE number.
100E JMP L2 (1012H) Jump unconditionally at address given.
100F
1010
1011 INR E Increment register E to count POSITIVE number.
1012
1013 DCR C Decrement counter C to 9.
1014 JNZ L3 (1008H) Jump if C is not equal to 0.
1015
1016
1017 HLT Terminate the program.