Hello Vincent,
The reason for this behaviour is that SDCC turns polling and then clearing
a bit/sbit into an atomic action (using JBC). This is very useful when the
bit is a semaphore or is set inside an interrupt handler.
Maarten
> Hi.
>
> I'm looking at asm generated for the following loop (80
Le samedi 19 janvier 2013 06:48:41, Erik Petrich a écrit :
> The compiler is thinking you are trying to use TI as a binary semaphore
> and so implements the sequence with an atomic test and clear to eliminate
> the possibility that an interrupt might occur between the while loop and
> the assignmen
On Fri, 18 Jan 2013, Vincent Pelletier wrote:
> Hi.
>
> I'm looking at asm generated for the following loop (8051, a CYCFX2LP
> actually) with sdcc 3.1.0#7066:
>
> __sbit __at 0x98+1 TI;
> void main() {
> while (!TI);
> TI = 0;
> }
>
> I get this:
>
> 00101$:
> jbc _TI,00115$
>