BINARY TO ASCII
AIM:
To write an assembly language program for the code conversion of BINARY to ASCII.
APPARATUS REQUIRED:
8085 kit, power chord
ALGORITHM:
1. Start the program.
2. Load the given data to A register and move to B register.
3. Mask the upper nibble of the binary data in accumulator.
4. Call sub routine code to get ASCII code of the lower nibble and store in memory.
5. Move B register to accumulator and mask the lower nibble.
6. Rotate the upper nibble.
7. Call the subroutine to get the ASCII code of upper nibble and store in memory.
8. Stop the program.
PROGRAM:
Address | Label | Opcode | Mnemonics | Operand | Comments |
4300 | | 3A, 00,42 | LDA | 4200H | Load the input binary data in accumulator |
4303 | | 47 | MOV | B, A | Move the data to B register |
4304 | | E6, 0F | ANI | 0FH | Masking the upper nibble |
4306 | | CD, 1A, 43 | CALL | CODE | Call the subroutine |
4309 | | 32,01,42 | STA | 4201H | Store the result |
430C | | 78 | MOV | A, B | Move the content of B register to accumulator |
430D | | E6, F0 | ANI | F0H | Masking the lower nibble |
430F | | 07 | RLC | | Rotating the content for 4 times |
4310 | | 07 | RLC | | |
4311 | | 07 | RLC | | |
4312 | | 07 | RLC | | |
4313 | | CD, 1A, 43 | CALL | CODE | Call the subroutine |
4316 | | 32,02,42 | STA | 4202H | Store the result |
4319 | | 76 | HLT | | Stop the process |
431A | CODE | FE, 0A | CPI | 0AH | Compare the acc content with 0AH |
431C | | DA, 21,43 | JC | SKIP | Check for carry, if carry present go to 4321 else go to 431F |
431F | | C6, 07 | ADI | 07H | Add the acc content and 07H |
4321 | SKIP | C6, 30 | ADI | 30H | Add the acc content and 30H |
4323 | | C9 | RET | | Return to main prgm |
INPUT: OUTPUT:
4200-E4 4201-34
4202-45
RESULT:
Thus the assembly language program for Binary to ASCII Code conversion is executed and the results are verified.
0 comments:
Post a Comment