2003-11-26 Theodore A. Roth * src/avrcore.c (avr_core_step): Make sure that one instruction is executed after a RETI (return from interrupt). Index: src/avrcore.c =================================================================== RCS file: /cvsroot/simulavr/simulavr/src/avrcore.c,v retrieving revision 1.70 diff -u -p -p -r1.70 avrcore.c --- src/avrcore.c 29 Oct 2003 19:40:55 -0000 1.70 +++ src/avrcore.c 27 Nov 2003 00:00:19 -0000 @@ -1077,8 +1077,11 @@ int avr_core_step( AvrCore *core ) /* Execute the asynchronous callbacks */ avr_core_async_cb_exec( core ); - /* check interrupts here */ - avr_core_check_interrupts( core ); + /* Check interrupts here. If the previous instruction was a reti, then we + need to delay handling of any pending IRQs until after the next + instruction is executed. */ + if (res != opcode_RETI) + avr_core_check_interrupts( core ); return res; }