![]() |
8085 MICRO PROCESSOR PROGRAM
Addition of two 8 bit number:- explanation of some important instructions which are used in 8 bit addition program.
- MVI Rd , data = move immediate 8 bit data in destination register or memory.
- MOV Rd , Rs = This instruction copies the contents of the source register into the destination register.
- LDA = The contents of a memory location, specified by a 16 bit address in the operand, are copied to the accumulator.
- STA = The contents of accumulator are copied into the memory location specified by the operand.
- ADD = The contents of register or memory are added to the contents of accumulator. result is stored in the accumulator.
- INR = The contents of register or memory location are incremented by 1. result is stored in the same place.
- JNC = Jump on no carry.
- JNZ = jump if not zero.
- LXI = load register pair with address of memory location.
- HLT = terminate the program.
Execution of 8 bit addition program
MVI C, 00 Initialize C register to 00
LDA 4150 Load the value to Accumulator.
MOV B, A Move the content of Accumulator to B register.
LDA 4151 Load the value to Accumulator.
ADD B Add the value of register B to A
JNC LOOP Jump on no carry.
INR C Increment value of register C
LOOP: STA 4152 Store the value of Accumulator (sum)
MOV A, C Move content of register C to Acc.
STA 4153 Store the value of Accumulator (carry)
HLT Halt the program.
SUBTRACTION OF TWO 8 BIT NUMBER
1. Any 8-bit number, or the contents of register, or the
contents of memory location can be subtracted from
the contents of accumulator. The result is stored in the accumulator.
2. Subtraction is performed in 2’s complement form.
3. If the result is negative, it is stored in 2’s complement form.
4. No two other 8-bit registers can be subtracted directly.
EXECUTION OF PROGRAM:-
MVI C, 00 Initialize C to 00
LDA 4150 Load the value to Acc.
MOV B, A Move the content of Acc to B register.
LDA 4151 Load the value to Acc.
SUB B
JNC LOOP Jump on no carry.
CMA Complement Accumulator contents.
INR A Increment value in Accumulator.
INR C Increment value in register C
LOOP: STA 4152 Store the value of A-reg to memory address.
MOV A, C Move contents of register C to Accumulator.
STA 4153 Store the value of Accumulator memory address.
HLT Terminate the program.
OBSERVATION:
Input: 06 (4150)
02 (4251)
Output: 04 (4152)
01 (4153)
RESULT:
Thus the program to subtract two 8-bit numbers was executed.
Multiplication of two 8 bit number
Multiplication of two 8 bit number
AIM:
To perform the multiplication of two 8 bit numbers using 8085.
ALGORITHM:
1) Start the program by loading HL register pair with address of memory location.
2) Move the data to a register (B register).
3) Get the second data and load into Accumulator.
4) Add the two register contents.
5) Check for carry.
6) Increment the value of carry.
7) Check whether repeated addition is over and store the value of product and carry
in memory location.
8) Terminate the program.
PROGRAM:
MVI D, 00 Initialize register D to 00
MVI A, 00 Initialize Accumulator content to 00
LXI H, 4150
MOV B, M Get the first number in B – reg
INX H
MOV C, M Get the second number in C- reg.
LOOP: ADD B Add content of A - reg to register B.
JNC NEXT Jump on no carry to NEXT.
INR D Increment content of register D
NEXT: DCR C Decrement content of register C.
JNZ LOOP Jump on no zero to address
STA 4152 Store the result in Memory
MOV A, D
STA 4153 Store the MSB of result in Memory
HLT Terminate the program.
OBSERVATION:
Input: FF (4150)
FF (4151)
Output: 01 (4152)
FE (4153)
RESULT:
Thus the program to multiply two 8-bit numbers was executed.
Division of two 8 bit numbers
AIM:
To perform the division of two 8 bit numbers using 8085.
ALGORITHM:
1) Start the program by loading HL register pair with address of memory location.
2) Move the data to a register(B register).
3) Get the second data and load into Accumulator.
4) Compare the two numbers to check for carry.
5) Subtract the two numbers.
6) Increment the value of carry .
7) Check whether repeated subtraction is over and store the value of product and
carry in memory location.
8) Terminate the program.
PROGRAM:
2nd method of division:-
LDA 0000
MOV B, A
LDA 0001
MVI D, 00
BACK :SUB B
INC D
JNC , BACK
STA 0002
MOV D, A
STA 0003
HLT
(If you liked the content, then share and comment)........
LXI H, 4150
MOV B, M Get the dividend in B – reg.
MVI C, 00 Clear C – reg for quotient
INX H
MOV A, M Get the divisor in A – reg.
NEXT: CMP B Compare A - reg with register B.
JC LOOP Jump on carry to LOOP
SUB B Subtract A – reg from B- reg.
INR C Increment content of register C.
JMP NEXT Jump to NEXT
LOOP: STA 4152 Store the remainder in Memory
MOV A, C
STA 4153 Store the quotient in memory
HLT Terminate the program. 2nd method of division:-
LDA 0000
MOV B, A
LDA 0001
MVI D, 00
BACK :SUB B
INC D
JNC , BACK
STA 0002
MOV D, A
STA 0003
HLT
(If you liked the content, then share and comment)........
This Notes Are very helpful to do study very easily nice
ReplyDeletethanks broo
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteVery helpful note
ReplyDeletebhai mera naam q dal diya comment me
Delete