.model small
.stack 1000H
.data
msg1 db “Enter First Matrix: $”
msg2 db “Enter Second Matrix: $”
msg3 db “Product Of matrices is: $”
space db ‘ $’
A11 db ?
A12 db ?
A13 db ?
A21 db ?
A22 db ?
A23 db ?
A31 db ?
A32 db ?
A33 db ?
B11 db ?
B12 db ?
B13 db ?
B21 db ?
B22 db ?
B23 db ?
B31 db ?
B32 db ?
B33 db ?
C11 db 1,2,3
C12 db 1,2,3
C13 db 1,2,3
C21 db 1,2,3
C22 db 1,2,3
C23 db 1,2,3
C31 db 1,2,3
C32 db 1,2,3
C33 db 1,2,3
num dw ?
num1 db ?
num2 db ?
num3 db ?
.code
MAIN Proc
MOV Ax,@Data
MOV Ds,Ax
LEA Dx,msg1 ; First input message
MOV Ah,09H
INT 21H
mov dl,0AH ; New Line
mov ah,2H
int 21H
mov ah,1H ; input a11 element
int 21H
sub al,30H
mov A11,al
lea dx,space ; space
mov ah,9H
int 21H
mov ah,1H ; input a12 element
int 21H
sub al,30H
mov A12,al
lea dx,space ; space
mov ah,9H
int 21H
mov ah,1H ; input a13 element
int 21H
sub al,30H
mov A13,al
mov dl,0AH ; New Line
mov ah,2H
int 21H
mov ah,1H ; input a21 element
int 21H
sub al,30H
mov A21,al
lea dx,space ; space
mov ah,9H
int 21H
mov ah,1H ; input a22 element
int 21H
sub al,30H
mov A22,al
lea dx,space ; space
mov ah,9H
int 21H
mov ah,1H ; input a23 element
int 21H
sub al,30H
mov A23,al
mov dl,0AH ; New Line
mov ah,2H
int 21H
mov ah,1H ; input a31 element
int 21H
sub al,30H
mov A31,al
lea dx,space ; space
mov ah,9H
int 21H
mov ah,1H ; input a32 element
int 21H
sub al,30H
mov A32,al
lea dx,space ; space
mov ah,9H
int 21H
mov ah,1H ; input a33 element
int 21H
sub al,30H
mov A33,al
mov dl,0AH ; New Line
mov ah,2H
int 21H
LEA Dx,msg2 ; Second input message
mov ah,09H
int 21H
mov dl,0AH ; New Line
mov ah,2H
int 21H
mov ah,1H ; input b11 element
int 21H
sub al,30H
mov B11,al
lea dx,space ; space
mov ah,9H
int 21H
mov ah,1H ; input b12 element
int 21H
sub al,30H
mov B12,al
lea dx,space ; space
mov ah,9H
int 21H
mov ah,1H ; input b13 element
int 21H
sub al,30H
mov B13,al
mov dl,0AH ; New Line
mov ah,2H
int 21H
mov ah,1H ; input b21 element
int 21H
sub al,30H
mov B21,al
lea dx,space ; space
mov ah,9H
int 21H
mov ah,1H ; input b22 element
int 21H
sub al,30H
mov B22,al
lea dx,space ; space
mov ah,9H
int 21H
mov ah,1H ; input b23 element
int 21H
sub al,30H
mov B23,al
mov dl,0AH ; New Line
mov ah,2H
int 21H
mov ah,1H ; input b31 element
int 21H
sub al,30H
mov B31,al
lea dx,space ; space
mov ah,9H
int 21H
mov ah,1H ; input b32 element
int 21H
sub al,30H
mov B32,al
lea dx,space ; space
mov ah,9H
int 21H
mov ah,1H ; input b33 element
int 21H
sub al,30H
mov B33,al
mov dl,0AH ; New Line
mov ah,2H
int 21H
LEA Dx,msg3 ; First input message
MOV Ah,09H
INT 21H
mov dl,0AH ; New Line
mov ah,2H
int 21H
;***********************************************************************
; C11 element
MOV AL,A11 ; multiply A11 * B11
MOV CL,B11
MUL CL
mov num,ax
mov bl ,BYTE PTR [num] ; move result in num1
mov num1,bl
MOV AL,A12 ; multiply A12 * B21
MOV CL,B21
MUL CL
mov num,ax
mov bl ,BYTE PTR [num] ; move result in num2
mov num2,bl
MOV AL,A13 ; multiply A13 * B31
MOV CL,B31
MUL CL
mov num,ax
mov bl ,BYTE PTR [num] ; move result in num3
mov num3,bl
mov bl,num1
add bl,num2
add bl,num3
mov BYTE PTR [num] , bl
mov BYTE PTR [num +1] ,0
mov ax,num
mov cl,10
div cl
add ah,30H
mov c11 +2 ,ah
mov BYTE PTR [num] , al
mov BYTE PTR [num +1] ,0
mov ax, num
mov cl,10
div cl
add ah,30H
mov c11+1,ah
add al,30H
mov c11,al
mov dl,c11
mov ah,2H
INT 21H
mov dl, C11+1
INT 21H
mov dl,C11+2
INT 21H
lea dx,space ; space
mov ah,9H
int 21H
;*******************************************************************************
; c12 element
MOV AL,A11 ; multiply A11 * B12
MOV CL,B12
MUL CL
mov num,ax
mov bl ,BYTE PTR [num] ; move result in num1
mov num1,bl
MOV AL,A12 ; multiply A12 * B22
MOV CL,B22
MUL CL
mov num,ax
mov bl ,BYTE PTR [num] ; move result in num2
mov num2,bl
MOV AL,A13 ; multiply A13 * B32
MOV CL,B32
MUL CL
mov num,ax
mov bl ,BYTE PTR [num] ; move result in num3
mov num3,bl
mov bl,num1
add bl,num2
add bl,num3
mov BYTE PTR [num] , bl
mov BYTE PTR [num +1] ,0
mov ax,num
mov cl,10
div cl
add ah,30H
mov c12 +2 ,ah
mov BYTE PTR [num] , al
mov BYTE PTR [num +1] ,0
mov ax, num
mov cl,10
div cl
add ah,30H
mov c12+1,ah
add al,30H
mov c12,al
mov dl,c12
mov ah,2H
INT 21H
mov dl, C12+1
INT 21H
mov dl,C12+2
INT 21H
lea dx,space ; space
mov ah,9H
int 21H
;*******************************************************************************
; c13 element
MOV AL,A11 ; multiply A11 * B13
MOV CL,B13
MUL CL
mov num,ax
mov bl ,BYTE PTR [num] ; move result in num1
mov num1,bl
MOV AL,A12 ; multiply A12 * B23
MOV CL,B23
MUL CL
mov num,ax
mov bl ,BYTE PTR [num] ; move result in num2
mov num2,bl
MOV AL,A13 ; multiply A13 * B33
MOV CL,B33
MUL CL
mov num,ax
mov bl ,BYTE PTR [num] ; move result in num3
mov num3,bl
mov bl,num1
add bl,num2
add bl,num3
mov BYTE PTR [num] , bl
mov BYTE PTR [num +1] ,0
mov ax,num
mov cl,10
div cl
add ah,30H
mov c13 +2 ,ah
mov BYTE PTR [num] , al
mov BYTE PTR [num +1] ,0
mov ax, num
mov cl,10
div cl
add ah,30H
mov c13+1,ah
add al,30H
mov c13,al
mov dl,c13
mov ah,2H
INT 21H
mov dl, C13+1
INT 21H
mov dl,C13+2
INT 21H
mov dl,0AH ; New Line
mov ah,2H
int 21H
;*******************************************************************************
; C21 element
MOV AL,A21 ; multiply A21 * B11
MOV CL,B11
MUL CL
mov num,ax
mov bl ,BYTE PTR [num] ; move result in num1
mov num1,bl
MOV AL,A22 ; multiply A22 * B21
MOV CL,B21
MUL CL
mov num,ax
mov bl ,BYTE PTR [num] ; move result in num2
mov num2,bl
MOV AL,A23 ; multiply A23 * B31
MOV CL,B31
MUL CL
mov num,ax
mov bl ,BYTE PTR [num] ; move result in num3
mov num3,bl
mov bl,num1
add bl,num2
add bl,num3
mov BYTE PTR [num] , bl
mov BYTE PTR [num +1] ,0
mov ax,num
mov cl,10
div cl
add ah,30H
mov c21 +2 ,ah
mov BYTE PTR [num] , al
mov BYTE PTR [num +1] ,0
mov ax, num
mov cl,10
div cl
add ah,30H
mov c21+1,ah
add al,30H
mov c21,al
mov dl,c21
mov ah,2H
INT 21H
mov dl, C21+1
INT 21H
mov dl,C21+2
INT 21H
lea dx,space ; space
mov ah,9H
int 21H
;*******************************************************************************
; C22 element
MOV AL,A21 ; multiply A21 * B12
MOV CL,B12
MUL CL
mov num,ax
mov bl ,BYTE PTR [num] ; move result in num1
mov num1,bl
MOV AL,A22 ; multiply A22 * B22
MOV CL,B22
MUL CL
mov num,ax
mov bl ,BYTE PTR [num] ; move result in num2
mov num2,bl
MOV AL,A23 ; multiply A23 * B32
MOV CL,B32
MUL CL
mov num,ax
mov bl ,BYTE PTR [num] ; move result in num3
mov num3,bl
mov bl,num1
add bl,num2
add bl,num3
mov BYTE PTR [num] , bl
mov BYTE PTR [num +1] ,0
mov ax,num
mov cl,10
div cl
add ah,30H
mov c22 +2 ,ah
mov BYTE PTR [num] , al
mov BYTE PTR [num +1] ,0
mov ax, num
mov cl,10
div cl
add ah,30H
mov c22+1,ah
add al,30H
mov c22,al
mov dl,c22
mov ah,2H
INT 21H
mov dl, C22+1
INT 21H
mov dl,C22+2
INT 21H
lea dx,space ; space
mov ah,9H
int 21H
;*******************************************************************************
; C23 element
MOV AL,A21 ; multiply A21 * B13
MOV CL,B13
MUL CL
mov num,ax
mov bl ,BYTE PTR [num] ; move result in num1
mov num1,bl
MOV AL,A22 ; multiply A22 * B23
MOV CL,B23
MUL CL
mov num,ax
mov bl ,BYTE PTR [num] ; move result in num2
mov num2,bl
MOV AL,A23 ; multiply A23 * B33
MOV CL,B33
MUL CL
mov num,ax
mov bl ,BYTE PTR [num] ; move result in num3
mov num3,bl
mov bl,num1
add bl,num2
add bl,num3
mov BYTE PTR [num] , bl
mov BYTE PTR [num +1] ,0
mov ax,num
mov cl,10
div cl
add ah,30H
mov c23 +2 ,ah
mov BYTE PTR [num] , al
mov BYTE PTR [num +1] ,0
mov ax, num
mov cl,10
div cl
add ah,30H
mov c23+1,ah
add al,30H
mov c23,al
mov dl,c23
mov ah,2H
INT 21H
mov dl, C23+1
INT 21H
mov dl,C23+2
INT 21H
mov dl,0AH ; New Line
mov ah,2H
int 21H
;*******************************************************************************
; C31 element
MOV AL,A31 ; multiply A31 * B11
MOV CL,B11
MUL CL
mov num,ax
mov bl ,BYTE PTR [num] ; move result in num1
mov num1,bl
MOV AL,A32 ; multiply A32 * B21
MOV CL,B21
MUL CL
mov num,ax
mov bl ,BYTE PTR [num] ; move result in num2
mov num2,bl
MOV AL,A33 ; multiply A33 * B31
MOV CL,B31
MUL CL
mov num,ax
mov bl ,BYTE PTR [num] ; move result in num3
mov num3,bl
mov bl,num1
add bl,num2
add bl,num3
mov BYTE PTR [num] , bl
mov BYTE PTR [num +1] ,0
mov ax,num
mov cl,10
div cl
add ah,30H
mov c31 +2 ,ah
mov BYTE PTR [num] , al
mov BYTE PTR [num +1] ,0
mov ax, num
mov cl,10
div cl
add ah,30H
mov c31+1,ah
add al,30H
mov c31,al
mov dl,c31
mov ah,2H
INT 21H
mov dl, C31+1
INT 21H
mov dl,C31+2
INT 21H
lea dx,space ; space
mov ah,9H
int 21H
;*******************************************************************************
; C32 element
MOV AL,A31 ; multiply A31 * B12
MOV CL,B12
MUL CL
mov num,ax
mov bl ,BYTE PTR [num] ; move result in num1
mov num1,bl
MOV AL,A32 ; multiply A32 * B22
MOV CL,B22
MUL CL
mov num,ax
mov bl ,BYTE PTR [num] ; move result in num2
mov num2,bl
MOV AL,A33 ; multiply A33 * B32
MOV CL,B32
MUL CL
mov num,ax
mov bl ,BYTE PTR [num] ; move result in num3
mov num3,bl
mov bl,num1
add bl,num2
add bl,num3
mov BYTE PTR [num] , bl
mov BYTE PTR [num +1] ,0
mov ax,num
mov cl,10
div cl
add ah,30H
mov c32 +2 ,ah
mov BYTE PTR [num] , al
mov BYTE PTR [num +1] ,0
mov ax, num
mov cl,10
div cl
add ah,30H
mov c32+1,ah
add al,30H
mov c32,al
mov dl,c32
mov ah,2H
INT 21H
mov dl, C32+1
INT 21H
mov dl,C32+2
INT 21H
lea dx,space ; space
mov ah,9H
int 21H
;*******************************************************************************
; C33 element
MOV AL,A31 ; multiply A31 * B13
MOV CL,B13
MUL CL
mov num,ax
mov bl ,BYTE PTR [num] ; move result in num1
mov num1,bl
MOV AL,A32 ; multiply A32 * B23
MOV CL,B23
MUL CL
mov num,ax
mov bl ,BYTE PTR [num] ; move result in num2
mov num2,bl
MOV AL,A33 ; multiply A33 * B33
MOV CL,B33
MUL CL
mov num,ax
mov bl ,BYTE PTR [num] ; move result in num3
mov num3,bl
mov bl,num1
add bl,num2
add bl,num3
mov BYTE PTR [num] , bl
mov BYTE PTR [num +1] ,0
mov ax,num
mov cl,10
div cl
add ah,30H
mov c33 +2 ,ah
mov BYTE PTR [num] , al
mov BYTE PTR [num +1] ,0
mov ax, num
mov cl,10
div cl
add ah,30H
mov c33+1,ah
add al,30H
mov c33,al
mov dl,c33
mov ah,2H
INT 21H
mov dl, C33+1
INT 21H
mov dl,C33+2
INT 21H
; end
;************************************************************************
mov ah,4CH
INT 21H
MAIN endp
end main