Старт загрузчика
CODE
BOOTRESET: ; Bootloader reset point!
;---- STACK INIT --------;
ldi tmp, low(ramend) ;
out SPL,tmp ;
ldi tmp,high(ramend) ;
out SPH,tmp ;
cli
;---- Move_interrupts ---;
in tmp,MCUCR ; Get MCUCR
mov tmp1,tmp ;
ori tmp,(1<<IVCE) ; Enable change of Interrupt Vectors
out MCUCR,tmp ;
ori tmp1,(1<<IVSEL) ; Move interrupts to Boot Flash section
out MCUCR,tmp1 ;
JMP RESET ; переход к основной программе.
Старт основной программы
CODE
RESET: ;
;---- STACK INIT ------;
ldi tmp, low(ramend) ;
out SPL,tmp ;
ldi tmp,high(ramend) ;
out SPH,tmp ;
;----------------------;
clr zero ;
clr loop2 ;
;--- Move_interrupts --;
in tmp,MCUCR ; Get MCUCR
ori tmp,(1<<IVCE) ; Enable change of Interrupt Vectors
out MCUCR,tmp ;
out MCUCR,zero ;
;----------------------;
sts WDTCR,zero ; disable watchdog Timer
sei ; enable interrupts