AnsweredAssumed Answered

push and pop CCR register on stack

Question asked by Grzegorz Konopko on Jan 15, 2015
Latest reply on Jan 16, 2015 by Grzegorz Konopko



I use MC9S08DZ60. I would like to get functionality to push and pop CCR register on/from stack.

Something similar as quoted macros below (from PE) but CCR saved on stacked variable, not global variable as in example from PE



#define SaveStatusReg()       { asm PSHA; asm TPA; asm SEI; asm STA CCR_reg; asm PULA; }

#define RestoreStatusReg()   { asm PSHA; asm LDA CCR_reg; asm TAP; asm PULA; }


where CCR_reg is global variable, I would like to use auto variable located on stack,



#define SaveStatusReg()       volatile byte CCR_stack;  asm PSHA; asm TPA; asm SEI; asm XXX CCR_stack; asm PULA;

Could someone help me?

Best Regards