	
	;***********************************************************************
	;* reset start
	;***********************************************************************
	
	.org	0
	
	;***********************************************************************
	;* user code start
	;***********************************************************************
	
userLevel
	
	
	;ACMD41
	
	
	
	movei	r5,$00
	movei	r6,$00
	moveih	r5,$00
	moveih	r6,$A0		;sd card base
	
	nop
	
	esadr	r6,r5
	
	;send reset reciver first
	
	;moveih	r0,2
	;nop
	;est	r0,0		;reset	
	
	;
	
	gpci	r7,2			;next 4 + X
	br	waste			;wait ~4ms
	nop		;delay slot
	nop		;delay slot
	nop		;delay slot
	nop		;delay slot
	
	
	
	;
		
	
	; cmd 55
	
	movei	r0,55		;cmd0 
	movei	r1,$0		;argument 0
	moveih	r0,1		;start send
	moveih	r1,$0		;
	
	nop
	
	est	r1,1		;low argument 0
	est	r1,2		;high argument 0
	est	r0,0		;cmd + start + expect recive 48
		
	;.stop
	
	gpci	r7,2			;next 4 + X
	br	waste
	nop		;delay slot
	nop		;delay slot
	nop		;delay slot
	nop		;delay slot
	
	
	; cmd 41
	
	movei	r0,41		;acmd 41 
	movei	r1,$ff		;argument 0
	moveih	r0,1		;start send
	moveih	r1,$ff		;
	
	nop
	
	est	r1,1		;low argument 0
	est	r1,2		;high argument 0
	est	r0,0		;cmd + start + expect recive 48
	
loop	br	loop
	nop		;delay slot
	nop		;delay slot
	nop		;delay slot
	nop		;delay slot

	
;***	
	
waste
	

	movei	r0,$ff
	nop
	moveih	r0,$ff
	nop

wasteLoop

	subi	r0,1
	brts	wasteLoop
	nop		;delay slot
	nop		;delay slot
	nop		;delay slot
	nop		;delay slot
	
	
	jmpi	r7,0
	nop		;delay slot
	nop		;delay slot
	nop		;delay slot
	nop		;delay slot		