ASCII TO BINARY
AIM:
To write an assembly language program for the code conversion of ASCII code to binary Code.
APPARATUS REQUIRED:
            8085 kit, power chord
ALGORITHM:
1.      Start the program
2.      Set HL pair as pointer for ASCII array.
3.      Set D register as counter for number of data in the array.
4.      Set BC pair as pointer for Binary array.
5.      Increment the HL Pair and move a data of ASCII to accumulator.
6.      Call the subroutine BIN to find the binary value.
7.      The binary value is stored in the specified memory location.
8.      Increment the BC register pair.
9.      Decrement the D register.
10. Stop the program.
PROGRAM:    
|      Address  |        Label  |        Opcode  |        Mnemonics  |        Operand  |       Comments |   
|     4200  |        |        21,00,42  |        LXI  |        H, 4200H  |        Load the array of   ASCII data  |   
|     4203  |        |        56  |        MOV  |        D, M  |        Move the content of   HL pair to D reg  |   
|     4204  |        |        01,00,43  |        LXI  |        B, 4300H  |        Load the address   location in which binary results are stored  |   
|     4207  |        LOOP  |        23  |        INX  |        H  |        Increment the HL   pair.  |   
|     4208  |        |        7E  |        MOV  |        A, M  |        Move the content of   HL to A reg  |   
|     4209  |        |        CD, 13,42  |        CALL   |        BIN  |        Call the subroutine  |   
|     420C  |        |        02  |        STAX  |        B  |        Store the result in B   reg  |   
|     420D  |        |        03  |        INX  |        B  |        Increment the BC reg   pair  |   
|     420E  |        |        15  |        DCR  |        D  |    |
|     420F  |        |        C2, 07,42  |        JNZ  |        LOOP  |        Check for zero  |   
|     4212  |        |        76  |        HLT  |        |        Stop the process  |   
|     4213  |        BIN  |        D6, 30  |        SUI  |        30H  |        Subtract the content   of A reg with 30H  |   
|     4215  |        |        FE, 0A  |        CPI  |        0AH  |        Compare the content   of A reg with 0AH  |   
|     4217  |        |        D8  |        RC  |        |        Carry is present   return to main program.  |   
|     4218  |        |        D6, 07  |        SUI  |        07H  |        No carry subtract the   content of A reg with 07H  |   
|     421A  |        |        C9  |        RET  |        |        Return to main   program.  |   
INPUT:                                                          OUTPUT:
4200-07                                                           4300-01    
4201-31                                                           4301-0b
4202-42                                                           4302-05
4203-35                                                           4303-0f
4204-46                                                           4304-0C
4205-43                                                           4305-09
4206-39                                                           4306-08
4207-38
RESULT:
            Thus the assembly language program for ASCII to Binary Code conversion is executed and the results are verified.
No comments:
Post a Comment