to Multiply Two 8 Bit Numbers - Multiply Two 8 Bit Numbers in Assembly Language

Multiply Two 8 Bit Numbers in Assembly Language

Posted on

Multiply Two 8 Bit Numbers in Assembly Language

Write a program to Multiply Two 8 Bit Numbers in assembly language . Program should load first number and second number in registers AL and BL registers . Then it should implement some logic for multiplication of two numbers .

 

Consider that a byte of data is present in the AL register and second byte of data is present in the BL register.

We have to multiply the byte in AL with the byte in BL.

Using MUL instruction, multiply the contents of two registers.

The multiplication of two 8 bit numbers may result into a 16 bit number. So result is stored in AX register.

The MSB is stored in AH and LSB in AL.      

                  

For example :

AL = 09 H

09 H

BL = 02 H

´

02 H

0012 H

Algorithm to Multiply Two 8 Bit Numbers

Step I       :    Initialize the data segment.

Step II      :    Get the first number in AL register.

Step III    :    Get the second number in BL register.                                     

Step IV    :    Multiply the two numbers.

Step V      :    Display the result.

Step VI    :    Stop 

 

to+Multiply+Two+8+Bit+Numbers - Multiply Two 8 Bit Numbers in Assembly Language

 

Program to Multiply Two 8 Bit Numbers

 

How to Run this Program

For Running this program you should have installed Tasm on you computer . If you have not installed Tasm  yet please install from Here .

C:\>tasm 8bit-mul.asm

Turbo Assembler  Version 3.0  Copyright (c) 1988, 1991 Borland International

Assembling file:   8bit-mul.asm

Error messages:    None

Warning messages:  None

Passes:            1

Remaining memory:  438k

C:\>tlink 8bit-mul.obj

Turbo Link  Version 3.0 Copyright (c) 1987, 1990 Borland International

Warning: No stack

C:\>8bit-mul

0012

Source projectgeek.com