> Back to the MACRO, wouldn't it be enough with saving and disabling > INTCONbits.GIE? Reading 18F2550 datasheet, GIE disables all interrupts > so PEIE doesn't seem necessary here. Is it different with other PICs? Am I > missing something?
>From Figure 9-1 in DS39609B (Interrupt logic gate diagram), I believe that you are right. The __critical{} replacement code can thus be simplified / made more efficient via: uint8_t __intcon = INTCON; INTCON &= ~0x7f; // critical code here if (__intcon & 0x80) { INTCON |= 0x80; } Ideally, this results in something like: BANKSEL ___intcon MOVFF _INTCON, ___intcon BCF _INTCON, 7, A /* critical code */ BANKSEL ___intcon BTFSC ___intcon, 7, B BSF _INTCON, 7, A which will be difficult to implement using __asm __endasm due to impossible references to local variables :-(. The compiler should do fine, though. Have fun! Raphael ------------------------------------------------------------------------------ Virtualization & Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ _______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user