We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I want to generate very efficient code using the carry-bit from C-code, and the instructions JNC or JC.
... sbit PinBit= P0^0; //port-IO bit ... CY=PinBit; //generates MOV C,PinBit ... if(CY) { //do something } IfNotCY: ...
The if(CY) instructiuons generates JNB CY,IfNotCY
How can i get it to use the more efficient JNC IfNotCY?
Analogously, if(!CY) should generate JC {label}.
CY=PinBit; //generates MOV C,PinBit ... if(CY)
Now that's a profoundly bad idea. You're writing C, not assembly. That means you do not, repeat: not, own the CPU registers. The compiler needs them for its own work.
Whatever made you assume that you could rely on the value of PinBit still being in the carry flag, after whatever actually is hidden inside that "..."?
The answer to you question is: don't do that. Try to even avoid thinking about doing that.