Monday 26 December 2016

Multiplication of two 8-bit numbers

Here is an example of Assembly Language code for 8086. This example illustrates how the multiplication of two 8 bit numbers using Direct Addressing Mode is done.


CODE  SEGMENT                                            // start of the logical code segment
          ASSUME CS:CODE                               // this instruction will inform
                                                                           the assembler the assumed name of CS.              START: MOV  AL, 02H                             // this instruction will move
                                                                              the operand 02H to the accumulator.
              MOV BL, 03H                                    // this instruction will move
                                                                              the operand 03H to the Register B.
              MUL  BL                                             // this instruction will multiply the
                                                                              content of the Register B with the
                                                                              content of the accumulator.
              INT  21H                                             // call the interrupt handler 0x21
                                                                              which is the DOS Function dispatcher.
CODE  ENDS                                                    // end of the logical code segment
     END START                                                // end of the program


No comments:

Post a Comment