Does anyone know how to "push flags" on the HCS08 series microcontrollers?
I have a section of code that I need to make non-interruptable. But I can't simply do this:
DisableInterrupts
EnableInterrupts
... because I don't know whether or not interrupts were disabled in the first place, and if they were disabled, I don't want to enable them. I want to leave things the way I found them.
In the Intel world, I'd just do this:
PUSHF (push flags) DisableInterrupts
POPF (pop flags, restoring whatever state existed before I disabled interrupts)
I read all the docs I could find, but never saw this issue addressed. It says that the "CCR" register contains the global interrupt flag, but there's no assembly instruction to read it or push it unto the stack.
Does anyone have a solution for this?