BCD CODE TO BINARY
AIM:
To write an assembly language program for the code conversion of BCD code to binary.
APPARATUS REQUIRED:
8085 kit, power chord
ALGORITHM:
1. Start the program
2. Load the data from acc from memory and move the acc value to E register
3. Clear LSB of accumulator and rotate the acc value
4. Move the acc value to B register
5. Perform EX-OR between acc value and acc value
6. Move the data A to C register and add it with acc
7. Decrement the C register
8. Jump on no zero to address 410E
9. Move Ale to B register and move E to acc
10. Clear MSB of acc, add the acc with B and store it in 4250
11. Stop the program
PROGRAM:
| ADDRESS | LABEL | OPCODE | MNEMONICS | OPERAND | COMMENTS |
| 4100 | | 3A, 00,42 | LDA | 4200 | Load data to acc |
| 4103 | | 5F | MOV | E, A | Move acc to e reg |
| 4104 | | E6, F0 | ANI | F0 | Clear LSB of acc |
| 4106 | | 07 | RLC | | Rotate left without cy |
| 4107 | | 07 | RLC | | Rotate left without cy |
| 4108 | | 07 | RLC | | Rotate left without cy |
| 4109 | | 07 | RLC | | Rotate left without cy |
| 410A | | 47 | MOV | B, A | Move acc to b reg |
| 410B | | AF | XRA | A | EX-OR acc with acc |
| 410C | | 0E, 0A | MVI | C, 0A | Move data to c reg |
| 410E | REP | 80 | ADD | B | Add data to acc |
| 410F | | 0D | DCR | C | Decrement c register |
| 4110 | | C2, 0E, 41 | JNZ | REP | Jump on no zero to add |
| 4113 | | 47 | MOV | B, A | Move acc to b reg |
| 4114 | | 7B | MOV | A, E | Move data to acc |
| 4115 | | E6, 0F | ANI | 0F | Clear MSB of acc |
| 4117 | | 80 | ADD | B | Add b register |
| 4118 | | 32,50,42 | STA | 4250 | Store the result |
| 411B | | 76 | HLT | | Stop the process |
INPUT: 4200 – 32
OUTPUT: 4250 - 20
RESULT:
Thus the assembly language program for BCD to Binary conversion is executed and the results are verified.
0 comments:
Post a Comment