Tuesday 20 November 2012

PROGRAM TO MULTIPLY TWO 3X3 MATRICES


.MODEL SMALL
.DATA
M1 DB 01H,01H,01H,01H,01H,01H,01H,01H,01H
M2 DB 01H,01H,01H,01H,01H,01H,01h,01H,01H
m3 db 9 dup(0)
m4 db ' $'
MES1 DB "THE multiplication OF TWO MATRIX IS  $"
.CODE
.startup
MOV DX,OFFSET MES1
MOV AH,09H
INT 21H
mov cl,0
mov ch,0
p1:xor bx,bx
mov bl,ch
mov dl,m2[bx]
xor bx,bx
mov bl,cl
mov al,m1[bx]

mul dl
add m3[bx],al
xor bx,bx
mov bl,ch
mov dl,m2[bx+1]
xor bx,bx
mov bl,cl
mov al,m1[bx+1]
mul dl
add m3[bx+1],al
xor bx,bx
mov bl,ch
mov dl,m2[bx+2]
xor bx,bx
mov bl,cl
mov al,m1[bx+2]
mul dl
add m3[bx+2],al
add ch,3
cmp ch,8
jbe p1
add cl,3
cmp cl,8
jbe p1
MOV DX,0AH
MOV AH,02H
INT 21H

MOV CL,0
mov ch,0
PP:XOR BX,BX
MOV BL,CL
MOV AL,m3[BX]
MOV DL,AL
ROL DL,4
AND DL,0FH
ADD DL,30H
CMP DL,'9'
JBE F1
ADD DL,7H

F1:MOV AH,02H
INT 21H
MOV AL,m3[BX]
AND AL,0FH
MOV DL,AL
ADD DL,30H
CMP DL,'9'
JBE F2
ADD DL,7
F2:MOV AH,02H
INT 21H
MOV DX,OFFSET M4
MOV AH,09H
INT 21H
inc ch
cmp ch,3
jnz l1
MOV DX,0AH
MOV AH,02H
INT 21H
mov ch,0
l1:INC CL
CMP CL,9
JNZ PP
MOV AH,4CH
INT 21H
END

Output:
THE multiplication OF TWO MATRIX IS
03 03 03
03 03 03
03 03 03

6 comments:

  1. nice stuff sir,
    thnx a lot
    keeps going :)
    you can also follow my website about microprocessor
    http://microprocessorforyou.blogspot.com

    ReplyDelete
  2. You have explanation for this code?

    ReplyDelete
  3. Thank you sir can u give explanation

    ReplyDelete
  4. The Explanation for program is informative , Now You Can Learn Microprocessors with Our Adaptable Online Videos Course Materials Video Lectures on Microprocessors from Superior Faculty Sign Up Now!

    ReplyDelete
  5. It's hard to believe that only last year Microsoft announced theAzure Data Lake Gen2the cloud version of its open source data lake platform. These are exciting times for enterprise developers, with the rush to the cloud having opened up new possibilities in terms of how data is stored and analyzed.

    ReplyDelete