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 looked, is there a _push_(U8 var) to use in C without reverting to inline asm, there is the _nop_() in intrins.h there should be a _push_() and _pop_() as well.
I have ZERO interest in using inlime assembler which I know would solve this. I want to see the C source in the emulator.
Erik
"there should be a _push_() and _pop_()"
Should there?!
=8-0
Surely, the last thing you want is user code doing PUSH and POP inside a 'C' function?!
actually there are cases
push IE clear EA .... .... pop IE
instead of U8 IEsave; ... IEsave = IE; EA = 0; .... .... IE = IEsave;
and specifically for the SILabs chips
push SFRPAGE SFRPAGE = ..; .... .... pop SFRPAGE
push IE clear EA .... // How can you be sure the compiler doesn't PUSH something here...?? .... pop IE
good point - especially re portability. The one Keil 'trap' I can see is if you are one of those that pass umpteen parametres to a function.
Oh, well, nice thought - bubble burested
Another interesting thing with push/pop in C/C++ code (where the caller is responsible for popping any parameters after a call) is that a compiler can make many function calls before finally shrinking the stack. Such code would not like an intrinsic push/pop directly used by the user code.
This isn't of course not too common in the embedded world, because a lot of hw doesn't the required stack space.