0% found this document useful (0 votes)
58 views10 pages

Assembly Code for Matrix Multiplication

The document discusses a matrix multiplication problem where the product of three 2x2 matrices [R]=[A][B][C] is to be found. It then provides assembly language code to calculate the matrix multiplication.

Uploaded by

kemal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views10 pages

Assembly Code for Matrix Multiplication

The document discusses a matrix multiplication problem where the product of three 2x2 matrices [R]=[A][B][C] is to be found. It then provides assembly language code to calculate the matrix multiplication.

Uploaded by

kemal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Name: Kemal Mudie Tosora

Reg no: 18BCE2433

Microprocessor and interfacing lab assesment 4.

Submission date 18-Sep-2020

Question.
Matrix multiplication
• Find the product of three matrix [R]=[A][B][C], where [A], [B]
and [C] are 2X2 matrix.
ASSEMBLY LANGUAGE PROGRAM
; You may customize this and other start-up templates;

; The location of this template is c:\emu8086\inc\0_com_template.txt

ASSUME CS:CODE,DS:DATA
; add your code here

DATA SEGMENT

MAT1 DB 01H, 02H, 03H, 04H

MAT2 DB 05H, 06H, 06H, 06H

MAT3 DB 08H,09H,03H,02H

r1 DW 04H DUP(?)

r2 DW 04H DUP(?)

DATA ENDS

CODE SEGMENT

START:

MOV ax,DATA

MOV ds,ax

MOV SI,OFFSET MAT1

MOV DI,OFFSET MAT2

MOV bx,OFFSET r1

mov ax,0000h

mov AL,[SI]

mov DL,[DI]

mul DL

mov [bx],ax

mov ax,00h

mov al,[si+1]
mul [di+2]

add [bx],ax

inc bx

inc bx

mov ax,00h

mov al,[si]

mul [di+1]

mov [bx],ax

mov ax,00h

mov al,[si+1]

mul [di+3]

add [bx],ax

inc bx

mov ax,00h

mov al,[si+2]

mul [di]

mov [bx],ax

mov ax,00h

mov al,[si+3]

mul [di+2]

add [bx],ax
inc bx

mov ax,00h

mov al,[si+2]

mul [di+1]

mov [bx],ax

mov ax,00h

mov al,[si+3]

mul [di+3]

add [bx],ax

MOV bx,OFFSET 1

Mov cx,04h

MOV SI,OFFSET r1

MOV DI,OFFSET MAT3

MOV BX,OFFSET r2

mov ax,0000h

mov AL,[SI]

mov DL,[DI]

mul DL

mov [bx],ax
mov ax,00h

mov al,[si+2]

mul [di+2]

add [bx],ax

inc bx

mov ax,00h

mov al,[si]

mov DL,[DI+1]

mul DL

mov [bx],ax

mov ax,00h

mov al,[si+2]

mov DL,[DI+3]

mul DL

add [bx],ax

inc bx

mov ax,00h

mov al,[si+4]

mov DL,[DI]

mul DL
mov [bx],ax

mov ax,00h

mov al,[si+6]

mov DL,[DI+2]

mul DL

add [bx],ax

inc bx

mov ax,00h

mov al,[si+4]

mov DL,[DI+1]

mul DL

mov [bx],ax

mov ax,00h

mov al,[si+6]

mov DL,[DI+3]

mul DL

add [bx],ax

MOV AH,00H

INT 21H
CODE ENDS

END START

ret

You might also like