Name of Program:-: ALP To Perform Multiplication Two 16 Bit Numbers
Name of Program:-: ALP To Perform Multiplication Two 16 Bit Numbers
Algorithm:-
Input:
• Two 16-bit numbers (e.g., stored in registers or memory)
Output:
• Product in DX:AX
• Steps:
START
1. Initialize:
BL ← 0
AX ← 0000
SI ← 1300
DI ← 1302
Carry ← 0
3. LOOP:
AL ← AL + [SI] + Carry ; Add multiplicand and carry to AL
CL ← CL - 1 ; Decrement multiplier
5. IF Carry = 1 THEN
BL ← BL + 1 ; Increment Carry register
6. SAVE:
[DI] ← AL ; Store result low byte at memory pointed by DI
DI ← DI + 1 ; Increment destination pointer
[DI] ← BL ; Store carry (high byte) at next memory location
STOP
Flowchart :-
Program :-
.MODEL SMALL
.STACK 100H
.DATA
MULTIPLIER DW 3 ; First number (e.g., 3)
MULTIPLICAND DW 5 ; Second number (e.g., 5)
.CODE
MAIN PROC
MOV AX, @DATA
MOV DS, AX ; Initialize data segment
LOOP_START:
CMP BX, 0
JE END_LOOP ; If BX == 0, multiplication is done
SKIP_CARRY:
DEC BX ; Decrement loop counter
JMP LOOP_START
END_LOOP:
MOV RESULT_LOW, AX ; Store result low word
MOV RESULT_HIGH, DX ; Store result high word
Value
Variable Address Description
(Hex)
MULTIPLIER 1300H 0003 The number of times to add
MULTIPLICAND 1302H 0005 The number to be added
RESULT_LOW 1304H 0000 Lower 16-bit result (initially 0)
Higher 16-bit result (carry,
RESULT_HIGH 1306H 0000
initially 0)