You are on page 1of 2

PROGRAM TO FIND THE DETERMINANT OF A 3*3 MATRIX

ORG 00H
SRC EQU 30H;equating label to 30h
MOV R0,#SRC+5;storing the addres of the 6th element
MOV A,@R0;loadig the data
MOV 0F0H,A
MOV R0,#SRC+7;storing the addres of the 8th element
MOV A,@R0
MUL AB;multiplyng contents of A and B
MOV R1,A;storing the result temprerly
MOV R0,#SRC+4;storing the addres of the 5th element
MOV A,@R0
MOV 0F0H,A
MOV R0,#SRC+8;storing the addres of the 9th element
MOV A,@R0
MUL AB
CLR C
SUBB A,R1;subtracting the A and R1 contents
MOV R0,#SRC;storing the addres of the 1st element
MOV 0F0H,A
MOV A,@R0
MUL AB
MOV R1,A;storing the result temprerly
MOV R0,#SRC+5;storing the addres of the 6th element
MOV A,@R0
MOV 0F0H,A
MOV R0,#SRC+6;storing the addres of the 7th element
MOV A,@R0
MUL AB
MOV R2,A
MOV R0,#SRC+3;storing the addres of the 4th element
MOV A,@R0
MOV 0F0H,A
MOV R0,#SRC+8;storing the addres of the 9th element
MOV A,@R0
MUL AB
CLR C
SUBB A,R2
MOV 0F0H,A
MOV R0,#SRC+1;storing the addres of the 2nd element
MOV A,@R0
MUL AB
CPL A;complementing
ADD A,#1;and adding 1 to multiply with negative sign
MOV R2,A
MOV R0,#SRC+4;storing the addres of the 5th element
MOV A,@R0
MOV 0F0H,A
MOV R0,#SRC+6;storing the addres of the 7th element
MOV A,@R0
MUL AB
MOV R3,A
MOV R0,#SRC+3;storing the addres of the 4th element
MOV A,@R0
MOV 0F0H,A
MOV R0,#SRC+7;storing the addres of the 8th element
MOV A,@R0
MUL AB
CLR C
SUBB A,R3
MOV R0,#SRC
MOV 0F0H,A
MOV R0,#SRC+2;storing the addres of the 3rd element
MOV A,@R0
MUL AB
MOV R3,A
CLR C
MOV A,R1
ADDC A,R2
ADDC A,R3
MOV 50H,A;storing the final result
END

You might also like