
;-----------------------------------------------------------------
.nolist
.include "m128def.inc"
.list
; Interrupt service vectors

.org $0000
	rjmp Reset						; Reset vector
	
;-----------------------------------------------------------------
; Register defines for main loop
;-----------------------------------------------------------------


.def		mpr		=	r16			; defines multipurpose register
.def		rbin1L 	= 	r17			; Left 90 degrees upper byte
.def		rbin1H	= 	r18
.def		rbin2L	= 	r19
.def		rbin2H	=	r20



;-----------------------------------------------------------------
; Reset vector
;-----------------------------------------------------------------

Reset:
;-----Setting Stackpointer----------------------------------------
	ldi		MPR,low(RAMEND)			; Set stackptr to ram end
	out		SPL,MPR
	ldi 	MPR, high(RAMEND)
	out 	SPH, MPR

;-----Set Port Directions-----------------------------------------
	ser		mpr						; Set TEMP to $FF to...
	out		DDRB,mpr				; ...set data direction to "out"
;	ldi		mpr,(1<<PORTB1)|(1<<PORTB0)|(1<<PORTB2)|(1<<PORTB3)|(1<<PORTB4)
;	out		PORTB,mpr				

;	out		ddre,mpr
;	out 	PORTE,mpr

	out 	DDRC,mpr
	out		PORTC,mpr	

	clr 	mpr						; clear all bits
	out 	DDRD,mpr				; Set 'D' as input

.include "hex_ascii.inc"