Transpose an arbitrarily sized rectangular Matrix.




Transpose2DArray_B:
	;INPUT:
	;A0 = POINTER TO SOURCE ARRAY
	;A1 = POINTER TO BACKUP AREA 
	;	(YOU NEED THE SAME AMOUNT OF FREE SPACE AS THE SOURCE ARRAY.)
	;	(IT'S YOUR RESPONSIBILITY TO KNOW WHERE THAT IS.)
	;D0.W = ARRAY ROW LENGTH-1
        ;D1.W = ARRAY COLUMN HEIGHT-1
 
	MOVEM.L D2-D7,-(SP)
		MOVE.W D0,D4	;width - this copy is our loop counter
 
.outerloop:
		MOVE.W D1,D7	;height
		MOVEQ.L #0,D3
		MOVE.W D0,D6	;width - this copy is used to offset the array
		ADDQ.L #1,D6
 
.innerloop:
		MOVE.B (A0,D3),(A1)+
		ADD.W D6,D3
		DBRA D7,.innerloop
 
		ADDA.L #1,A0
		DBRA D4,.outerloop
 
	MOVEM.L (SP)+,D2-D7
	RTS