;Copy memory block from RAM to EEPROM

Block_write:
	LD	R16,X+
	RCALL	EEwrite
	ADIW	ZH:ZL,1
	DEC	R17
	BRNE	Block_write
	RET
	
EEWrite:			
	SBIC	EECR,EEWE	
	RJMP	EEWrite	
	OUT	EEARH,ZH	
	OUT	EEARL,ZL	
	OUT	EEDR,R16	
	CLI			
	LDI	R16,$04		
	OUT	EECR, R16	
	LDI	R16,$02		
	OUT	EECR,R16	
	SEI			
	RET		