Code:
; PROGRAM TO MULTIPLY TWO 16 BIT UNSIGNED
; NUMBERS RESULT IS MAX 32 BIT
.MODEL SMALL
.STACK 100
.DATA
NUM1 DW 012F0H
NUM2 DW 002FFH
RES_LSB DW 0
RES_MSB DW 0
.CODE
MOV AX , @DATA ; INITIALIZING DATA SEGMENT
MOV DS , AX
MOV AX , NUM1
MOV BX , NUM2
MUL BX ; MULTIPLYING NUM1 BY NUM2
AAM
MOV RES_MSB , DX ; MOVING RESULT
MOV RES_LSB , AX
MOV AH , 2 ; PRINTING HIGHER 16 BIT
INT 21H
MOV DX , RES_LSB ; PRINTING LOWER 16 BIT
MOV AH , 2
INT 21H
MOV AH, 4CH ; SERVICE ROUTINE FOR EXIT
INT 21H
END
Ouput:
; PROGRAM TO MULTIPLY TWO 16 BIT UNSIGNED
; NUMBERS RESULT IS MAX 32 BIT
.MODEL SMALL
.STACK 100
.DATA
NUM1 DW 012F0H
NUM2 DW 002FFH
RES_LSB DW 0
RES_MSB DW 0
.CODE
MOV AX , @DATA ; INITIALIZING DATA SEGMENT
MOV DS , AX
MOV AX , NUM1
MOV BX , NUM2
MUL BX ; MULTIPLYING NUM1 BY NUM2
AAM
MOV RES_MSB , DX ; MOVING RESULT
MOV RES_LSB , AX
MOV AH , 2 ; PRINTING HIGHER 16 BIT
INT 21H
MOV DX , RES_LSB ; PRINTING LOWER 16 BIT
MOV AH , 2
INT 21H
MOV AH, 4CH ; SERVICE ROUTINE FOR EXIT
INT 21H
END