1.c. 8-BIT MULTIPLICATION.
AIM: 
To write an assembly language program for the multiplication of two 8 – bit numbers.
APPARATUS REQUIRED:
ALGORITHM:
1.      Start the program                                    
2.      Load the accumulator as zero
3.      Load the B-register as 05                      
4.      Load the multiplier to C-register
5.      Load the D-register for carry   
6.      Add the content of B to accumulator until C became zero
7.      Jump on no carry to step 9                   
8.      Increment the D-register                       
9.      Store the content of accumulator and D-register to memory
10. Stop the program
PROGRAM:
|     ADDRESS  |        LABEL  |        OPCODE  |        MNEMONICS  |        OPERAND  |        COMMENTS  |   
|     4500  |        |        3E, 00  |        MVI  |        A, 00  |        Move data to   accumulator  |   
|     4502  |        |        06,data1  |        MVI  |        B, data1  |        Move multiplicand to   b register  |   
|     4504  |        |        0E,data2  |        MVI  |        C, data2  |        Move the multiplier   to c register  |   
|     4506  |        |        16,00  |        MVI  |        D, 00  |        Clear d reg for carry  |   
|     4508  |        LOOP2  |        80  |        ADD  |        B  |        Repetitive addition  |   
|     4509  |        |        D2, 0D, 45  |        JNC  |        LOOP1  |        Jump on no carry to   an address  |   
|     450C  |        |        14  |        INR  |        D  |        Increment the d   register for carry  |   
|     450D  |        LOOP1  |        0D  |        DCR  |        C  |        Decrement c register  |   
|     450E  |        |        C2, 08,45  |        JNZ  |        LOOP2  |        Jump on no zero to   address  |   
|     4511  |        |        32,00,50  |        STA  |        5000  |        Store resultant product  |   
|     4514  |        |        7A  |        MOV  |        A, D  |        Move carry to accumulator  |   
|     4515  |        |        32,01,50  |        STA  |        5001  |        Store the carry.  |   
|     4518  |        |        76  |        HLT  |        |        Stop the process.  |   
INPUT: B =05, C =05         OUTPUT: 5001 = 19, 5002 – 00
RESULT: 
Thus the assembly language program for 8-bit multiplication is executed and the results are verified.
0 comments:
Post a Comment