*******************************************************************************
*									      *
*  64-BIT ADDITION							      *
*  01/30/07 (dkc)							      *
*									      *
*  This C64 subroutine does 64-bit addition.  The calling sequence of the     *
*  subroutine is;							      *
*									      *
*     address of augend (A[0], A[1]) => a4				      *
*     address of addend (B[0], B[1]) => b4				      *
*									      *
*******************************************************************************
	.global _add64
	.text
_add64	ldw.d1 *+a4[1], a0	  ;  load A[1]
||	ldw.d2 *+b4[1], b0	  ;  load B[1]

	ldw.d1 *a4, a6		  ;  load A[0]
||	ldw.d2 *b4, b6		  ;  load B[0]

	nop 2

	b.s2 b3 		  ;  return

	mv.l1x b0, a9		  ;  load B[1]
||	zero.s1 a1		  ;  load 0

	addu.l1 a1:a0, a9, a1:a0  ;  A[1] + B[1]
||	add.l2x b6, a6, b6	  ;  A[0] + B[0] - carry

	and.l1 a1, 1, a1	  ;  isolate carry bit
||	stw.d2 a0, *+b4[1]	  ;  store A[1]+B[1]

	add.l2x b6, a1, b6	  ;  A[0] + B[0]

	stw.d2 b6, *b4		  ;  store A[0]+B[0]
	.end