
; Name:		Test SRAM write.asm
; Function:	Tests capability to write to internal SRAM
;			from $0100 to $10ff
;			Also, will test .BYTE functionality
; Date:		June 21, 2003

.include "m128def.inc"

.org $0000
	rjmp Reset						; Reset vector
.org $0500
.dseg

OCRA:	.BYTE 2


.cseg
Reset:

	ldi		XL,low(OCRA)				; load immediate default value
	ldi 	XH,high(OCRA)


	clr		XL
	clr		XH
	rjmp 	store
AddCycle:
	lds		XL,low(OCRA)			; get the OCRA stored in memory
	lds		XH,high(OCRA)
	ADIW 	XH:XL,1	
; Store	
Store:							; add one to it
	sts		low(OCRA),XL			; store OCRA to SRAM to free X pointer
	sts		high(OCRA),XH

; store it to the OCR1A registers here in actual code
	cpi XL,$FF
	brne Addcycle
	cpi XH,$FF
	brne Addcycle
	
