1.b. 8-BIT SUBTRACTION
AIM:
            To write a assembly language program for the subtraction of two 8-bit numbers
APPARATUS REQUIRED:
                                    8085 kit, power chord
ALGORITHM:
1. Start the program
            2. Load the HL pair with 8-bit numbers
            3. Move the content of HL to accumulator
            4. Increment the address of Hl pair
            5. Subtract the content of memory from accumulator
            6. Jump on no carry to step
            7. Increment the C-register
            8. Store the content of accumulator and C-register
9. Stop the program
PROGRAM:
|     ADDRESS  |        LABEL  |        OPCODE  |        MNEMONICS  |        OPERAND  |        COMMENTS  |   
|     4100  |        |        21,50,41  |        LXI  |        H, 4150  |        Load data to   HL Register  |   
|     4103  |        |        7E  |        MOV  |        A, M  |        Move data to   accumulator  |   
|     4104  |        |        0E, 00  |        MVI  |        C, 00  |        Clear c   register.  |   
|     4106  |        |        23  |        INX  |        H  |        Increment   address.  |   
|     4107  |        |        9E  |        SBB  |        M  |        Subtract   with borrow  |   
|     4108  |        |        D2, 0C, 41  |        JNC  |        REPET  |        Jump on no   carry.  |   
|     410B  |        |        0C  |        INR  |        C  |        Increment c   register  |   
|     410C  |        REPET  |        32,52,41  |        STA  |        4152  |        Store the   result  |   
|     410F  |        |        79  |        MOV  |        A, C  |        Move carry   to acc  |   
|     4110  |        |        32,53,41  |        STA  |        4153  |        Store the   carry  |   
|     4113  |        |        76  |        HLT  |        |        Stop the   program  |   
INPUT:                                             OUTPUT:
4150 = 57, 4151 = 66                      4152 – f1 (Result), 4153 – 01 (carry)
RESULT:
            Thus the assembly language program for 8-bit subtraction is executed and the results are verified.
No comments:
Post a Comment