This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

JBC instruction from C?

Does anyone know of a C construct that will generate code similar to that produced with the #pragma DISABLE directive? Specifically I'm looking to get the JBC instruction. I'm trying to emulate the #pragma DISABLE directive for small sections of code within a function. Inline assembly is out since you lose C source level debugging capablility when you compile via the SRC directive.

Here's the best I have so far, but I'm (overly) paranoid that the interrupt state could change between the jump and the clear due to a task switch... I'm using Rtx51Tiny:

        data BYTE easav;
        if (EA==0)
        {
            easav=0;
        }
        else
        {
            EA=0;
            easav=1;
        }

... and that generates the following 'almost but not quite' atomic code:

	JB   	EA,?C0018
	CLR  	A
	MOV  	easav?341,A
	SJMP 	?C0019
?C0018:
	CLR  	EA
	MOV  	easav?341,#01H
?C0019:



I would prefer that the JB become a JBC, which would then make the CLR EA unneeded. Any thoughts? Thanks, Greg

0