Hi guys,
using inline assembler, gcc and atmega32..
void TIMER0_OVF_vect( void ) __attribute__ ( ( signal, naked ) ); void TIMER0_OVF_vect( void ) { asm volatile ( "push r0 \n\t" \ "push r1 ; ? \n\t" \ "in r0, __SREG__ \n\t" \ "push r0 ; ? \n\t" \ "push r24 \n\t" \ "lds r24, Timer0Overflows \n\t" \ "subi r24, 255 ; add 1 \n\t" \ "sts Timer0Overflows, r24 \n\t" \ "pop r24 \n\t" \ "pop r0 \n\t" \ "out __SREG__, r0 \n\t" \ "pop r1 \n\t" \ "pop r0 \n\t" \ "reti \n\t" \ ); }
if i remove the lines marked "?" (and the corresponding pops, of course), the application doesn't work (i'm not quite sure what goes wrong).. why do i need to save R0 and R1? as the code shows, they are not being used in the heart of the ISR.. does any of the other instructions use them as temp registers or something?
btw: the only reason i tried it this way is, that the compiler emits something similar when using the C-equivalent of the ISR code..
cheers...