WRITE A 8085 ASSEMBLY LANGUAGE PROGRAM TO DIVIDE TWO 8-BIT NUMBERS USING 8085 MICROPROCESSOR AND PERFORM THE OPERATION BETWEEN PREDEFINED LOCATION. 3:2
THEORY : In 8085 microprocessor, There is no division operation. To get the result of the division, we should use the repetitive subtraction method. By using this program, we will get the quotient and the reminder. Here we also can be store the carry value. Then store the value of that performed resultant value.
ALGORITHM :
Step 1: LXI H,2000h; to point source memory location, register pair H-L is initialized.Step 2: MOV A, M; to move the value of memory to the accumulator.Step 3: INX H; to increment the value by 1 for the H-L register pair.Step 4: MOV B, M; to move the value of memory to the B register.Step 5: MVI C,00h; to load the value 00h in register C.Step 6: CMP B; to compare the value of the accumulator and the B register.Step 7: JC ; to jump on carry in step 11.Step 8: SUB B; to subtract the accumulator and B register value.Step 9: INR C; to increment the value of C register.Step 10: JMP; to jump on step 6 Step 11: INX H; to increment the value of H-L register pair.Step 12: MOV M, C; to store the value of C register into a memory location.Step 13: STA 2003h; to store the accumulator value into 2003h memory location.Step 14: HLT; to stop the program.
IMPLEMENTATION :
Location | Mnemonics | Hex Code |
---|---|---|
3000 | LXI H | 21 |
3001 | 00h | 00 |
3002 | 20 | 20 |
3003 | MOV A, M | 7E |
3004 | INX H | 23 |
3005 | MOV B, M | 46 |
3006 | MVI C,00H | 0E |
3007 | 00 | 00 |
3008 | CMP B | BB |
3009 | JC | DA |
300A | 11 | 11 |
300B | 30 | 30 |
300C | SUB B | 90 |
300D | INR C | 0C |
300E | JMP | C3 |
300F | 08 | 08 |
3010 | 30 | 30 |
3011 | INX H | 23 |
3012 | MOV M, C | 71 |
3013 | STA 2003 | 32 |
3014 | 03 | 03 |
3015 | 20 | 20 |
3016 | HLT | 76 |
INPUT AND OUTPUT :
Location | Input |
---|---|
2000 | FF |
2001 | 02 |
Location | Output |
---|---|
2002 | 7F |
2003 | 01 |
DISCUSSION :
In this program, We tried to solve the division problem, where we took a kind of value and that's resultant value will give a carry value. Firstly, we've taken the location where the value is stored with LXI H and moves the value to the accumulator. Then we've incremented the value of H-L pair to take the next of B register.Then we send 00h value to store carry value in C register. Then we compare the value between Accumulator and B register. Then in comparison, we got a high value of carry flag, and store in C register.Then subtract the value of the accumulator and B register, and store it into a memory location. Then Stop the program.
Comments
Post a Comment
Please do not enter any spam link in the comment box.