Hi I have a long question;
I am to write a program to perform matrix multiplication using the Teeside 6800 cross assembler.
Have to multiply matrix A=A with B. A is a KxL matirx, B is a LxM matrix, to give a matrix C which is KxM. This has to be added to a Matrix D.
Here is a high level language segment.
for I=0 to K-1
for j=0 to M-1
sum=0
for n=0 to L-1
sum=sum+ab
end
end
An incomplete 6800 assembly program that performs this is below:
Org $4000
matmult move.w d0, d3 %make a copy of K to d3
sub.w #1,d3 %init first for-loop counter i
loop1 move.w d2,d4 %make a copy of M to d4
sub.w #1,d4 init %second fot-loop counter j
loop2 clr.l d5 %clear sum
move.w d1,d6 %make a copy of L to d6
sub.w #1,d6 %init third for-loop counter n
loop3
sum = sum + in nj a b
……….
dbra d6, loop3
……… ij c = sum
dbra d4, loop2
dbra d3, loop1
trap #15 SYSCALL .RETURN
dc.w $0063
end matmult
Can someone complete this code for me to the multiplication of 2 matrix, and then add two another matrix with the 6800 instruction set. Thanks.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks