
ram_9:
	sprd	fp,r0		/* get test code */
	movd	r0,r1
	ashd	$-1,r1		/* shift out low bit */
	lprd	fp,r1		/* save test code */
	tbitb	$0,r0		/* was bit set? */
	bfc	ram_10		/* nope */

	addr	_ramtst9msg,r6	/* print Copy and Execute in Ram Test */
	addr	ram9_start,r7
	jump	printmsg
ram9_start:
	addr	_copyoutmsg,r6	/* print copying... */
	addr	ram9_cp,r7
	jump	printmsg
ram9_cp:
	addr	endcode,r0	
        addr	copycode,r1
	subd	r1,r0
	addr	32(r0),r0
	bicd	$0x1f,r0
	addr	copycode,r1			
	movd	r3,r2				
	movsd					
	addr	copycode,r1			/* source */
	movd	r3,r2				/* destination */
	movsd					/* copy code to ram */

	/* go execute the program just copied into ram */
	movd	r3,r2		/* code is here */
	jump	0(r2)	

copycode:
	sprd	sp,r0				/* size */
	movd	r3,r1		/* start address */
	movqd	$-1,0(r1)	/* write all f's */
	movqd	$0,4(r1)	/* write all zero's */
	addr	8(r1),r2	/* copy here */

	movsd			/* write words of f's and zeros's */

	sprd	sp,r0				/* size */
	movd	r3,r1		/* reload start address */
	cmpqd	$-1,0(r1)	/* is it all f's */
	bne	cpfailure
	cmpqd	$0,4(r1)	/* is it all zero's */
	bne	cpfailure

	cmpsd

	bfs	cpfailure	/* go jump to rom to print error mesg */
	bne	cpfailure

	jump	endcode		/* return normally */
cpfailure:
	jump	romcpfail
endcode:
	addr	_donemsg,r6	/* print verify done */
	addr	ram_10,r7
	jump	printmsg
romcpfail:
	

printmsg:

ram_10:

